private RPChromosomeRegion getChromosomeBounds(String startChromosome, int startBase, String endChromosome, int endBase) { // If the chromosome name length is > the key size we can't distinguish it if (startChromosome.length() > chromosomeIDTree.getKeySize()) { return null; } // find the chromosome ID's using the name to get a valid name key, then associated ID String startChromKey = chromosomeIDTree.getChromosomeKey(startChromosome); int startChromID = chromosomeIDTree.getChromosomeID(startChromKey); if (startChromID < 0) // mChromosome not in data? return null; String endChromKey = chromosomeIDTree.getChromosomeKey(endChromosome); int endChromID = chromosomeIDTree.getChromosomeID(endChromKey); if (endChromID < 0) // mChromosome not in data? return null; // create the bounding mChromosome region RPChromosomeRegion chromBounds = new RPChromosomeRegion(startChromID, startBase, endChromID, endBase); return chromBounds; }
public String getChromsomeFromId(int chromId) { return chromosomeIDTree.getChromosomeName(chromId); } } // end of BBFileReader
public ArrayList<String> getChromosomeNames() { ArrayList<String> chromosomeList = chromosomeIDTree.getChromosomeNames(); return chromosomeList; }
private boolean getDataBlock(int leafItemIndex) { // check for valid data block if (leafHitList == null || leafItemIndex >= leafHitList.size()) return false; // Perform a block read for indexed leaf item leafHitItem = leafHitList.get(leafItemIndex); // get the chromosome names associated with the hit region ID's int startChromID = leafHitItem.getChromosomeBounds().getStartChromID(); int endChromID = leafHitItem.getChromosomeBounds().getEndChromID(); chromosomeMap = chromIDTree.getChromosomeIDMap(startChromID, endChromID); boolean isLowToHigh = zoomDataTree.isIsLowToHigh(); int uncompressBufSize = zoomDataTree.getUncompressBuffSize(); // decompress leaf item data block for feature extraction zoomDataBlock = new ZoomDataBlock(zoomLevel, fis, leafHitItem, chromosomeMap, isLowToHigh, uncompressBufSize); // get data block zoom data record list and set next index to first item zoomRecordList = zoomDataBlock.getZoomData(selectionRegion, isContained); zoomRecordIndex = 0; // data block items available for iterator if (zoomRecordList.size() > 0) return true; else return false; }
public BPTree(SeekableStream fis, long fileOffset, boolean isLowToHigh) { // Save the seekable file handle and B+ Tree file offset // Note: the offset is the B+ Tree Header Table E file location this.fis = fis; treeOffset = fileOffset; idChromMap = new HashMap<>(); chromIdMap = new HashMap<>(); // read in B+ tree header - verify the B+ tree info exits treeHeader = new BPTreeHeader(this.fis, treeOffset, isLowToHigh); // log error if header not found and throw exception if (!treeHeader.isHeaderOK()) { int badMagic = treeHeader.getMagic(); log.error("Error reading B+ tree header: bad magic = " + badMagic); throw new RuntimeException("Error reading B+ tree header: bad magic = " + badMagic); } // assign B+ tree specifications from the header blockSize = treeHeader.getBlockSize(); keySize = treeHeader.getKeySize(); valueSize = treeHeader.getValSize(); itemCount = treeHeader.getItemCount(); // populate the tree - read in the nodes long nodeOffset = treeOffset + treeHeader.BPTREE_HEADER_SIZE; BPTreeNode parentNode = null; // parent node of the root is itself, or null // get the root node - which recursively populates the remaining nodes rootNode = readBPTreeNode(this.fis, nodeOffset, parentNode, isLowToHigh); }
if (chromIDTreeOffset != 0) { fileOffset = chromIDTreeOffset; chromosomeIDTree = new BPTree(fis, fileOffset, isLowToHigh);
public int getChromosomeID(String chromosomeKey) { int chromosomeID = chromosomeIDTree.getChromosomeID(chromosomeKey); return chromosomeID; }
public int getChromosomeID(String chromKey) { int chromosomeID; // Search the B+ tree to extract the Chromosome ID. BPTreeNode thisNode = rootNode; chromosomeID = findChromosomeID(thisNode, chromKey); return chromosomeID; }
public ArrayList<String> getChromosomeNames(){ // Search the B+ tree to extract the chromosome ID. BPTreeNode thisNode = rootNode; ArrayList<String> chromosomeList = new ArrayList<String>(); findAllChromosomeNames(thisNode, chromosomeList); return chromosomeList; }
private boolean getDataBlock(int leafItemIndex) { // check for valid data block if (leafItemIndex >= leafHitList.size()) return false; // Perform a block read for indexed leaf item leafHitItem = leafHitList.get(leafItemIndex); // get the chromosome names associated with the hit region ID's int startChromID = leafHitItem.getChromosomeBounds().getStartChromID(); int endChromID = leafHitItem.getChromosomeBounds().getEndChromID(); chromosomeMap = chromIDTree.getChromosomeIDMap(startChromID, endChromID); boolean isLowToHigh = chromDataTree.isIsLowToHigh(); int uncompressBufSize = chromDataTree.getUncompressBuffSize(); // decompress leaf item data block for feature extraction wigDataBlock = new BigWigDataBlock(fis, leafHitItem, chromosomeMap, isLowToHigh, uncompressBufSize); // get section Wig item list and set next index to first item wigItemList = wigDataBlock.getWigData(selectionRegion, isContained); wigItemIndex = 0; // data block items available for iterator if (wigItemList.size() > 0) return true; else return false; }
childOffset = bdis.readLong(); childNode = readBPTreeNode(this.fis, childOffset, thisNode, isLowToHigh);
if (chromIDTreeOffset != 0) { fileOffset = chromIDTreeOffset; chromosomeIDTree = new BPTree(fis, fileOffset, isLowToHigh);
public int getChromosomeID(String chromosomeKey) { int chromosomeID = chromosomeIDTree.getChromosomeID(chromosomeKey); return chromosomeID; }
public int getChromosomeID(String chromKey) { int chromosomeID; // Search the B+ tree to extract the Chromosome ID. BPTreeNode thisNode = rootNode; chromosomeID = findChromosomeID(thisNode, chromKey); return chromosomeID; }
public ArrayList<String> getChromosomeNames(){ // Search the B+ tree to extract the chromosome ID. BPTreeNode thisNode = rootNode; ArrayList<String> chromosomeList = new ArrayList<String>(); findAllChromosomeNames(thisNode, chromosomeList); return chromosomeList; }
private RPChromosomeRegion getChromosomeBounds(String startChromosome, int startBase, String endChromosome, int endBase) { // If the chromosome name length is > the key size we can't distinguish it if (startChromosome.length() > chromosomeIDTree.getKeySize()) { return null; } // find the chromosome ID's using the name to get a valid name key, then associated ID String startChromKey = chromosomeIDTree.getChromosomeKey(startChromosome); int startChromID = chromosomeIDTree.getChromosomeID(startChromKey); if (startChromID < 0) // mChromosome not in data? return null; String endChromKey = chromosomeIDTree.getChromosomeKey(endChromosome); int endChromID = chromosomeIDTree.getChromosomeID(endChromKey); if (endChromID < 0) // mChromosome not in data? return null; // create the bounding mChromosome region RPChromosomeRegion chromBounds = new RPChromosomeRegion(startChromID, startBase, endChromID, endBase); return chromBounds; }
private boolean getDataBlock(int leafItemIndex) { // check for valid data block if (leafItemIndex >= leafHitList.size()) return false; // Perform a block read for indexed leaf item leafHitItem = leafHitList.get(leafItemIndex); // get the chromosome names associated with the hit region ID's int startChromID = leafHitItem.getChromosomeBounds().getStartChromID(); int endChromID = leafHitItem.getChromosomeBounds().getEndChromID(); chromosomeMap = chromIDTree.getChromosomeIDMap(startChromID, endChromID); boolean isLowToHigh = chromDataTree.isIsLowToHigh(); int uncompressBufSize = chromDataTree.getUncompressBuffSize(); // decompress leaf item data block for feature extraction wigDataBlock = new BigWigDataBlock(fis, leafHitItem, chromosomeMap, isLowToHigh, uncompressBufSize); // get section Wig item list and set next index to first item wigItemList = wigDataBlock.getWigData(selectionRegion, isContained); wigItemIndex = 0; // data block items available for iterator if (wigItemList.size() > 0) return true; else return false; }
public BPTree(SeekableStream fis, long fileOffset, boolean isLowToHigh) { // Save the seekable file handle and B+ Tree file offset // Note: the offset is the B+ Tree Header Table E file location this.fis = fis; treeOffset = fileOffset; // read in B+ tree header - verify the B+ tree info exits treeHeader = new BPTreeHeader(this.fis, treeOffset, isLowToHigh); // log error if header not found and throw exception if(!treeHeader.isHeaderOK()){ int badMagic = treeHeader.getMagic(); log.error("Error reading B+ tree header: bad magic = " + badMagic); throw new RuntimeException("Error reading B+ tree header: bad magic = " + badMagic); } // assign B+ tree specifications from the header blockSize = treeHeader.getBlockSize(); keySize = treeHeader.getKeySize(); valueSize = treeHeader.getValSize(); itemCount = treeHeader.getItemCount(); // populate the tree - read in the nodes long nodeOffset = treeOffset + treeHeader.BPTREE_HEADER_SIZE; BPTreeNode parentNode = null; // parent node of the root is itself, or null // get the root node - which recursively populates the remaining nodes rootNode = readBPTreeNode(this.fis, nodeOffset, parentNode, isLowToHigh); }
public ArrayList<String> getChromosomeNames() { ArrayList<String> chromosomeList = chromosomeIDTree.getChromosomeNames(); return chromosomeList; }
public String getChromosomeName(int chromID) { String chromosomeName = chromosomeIDTree.getChromosomeName(chromID); return chromosomeName; }