public BigWigDataBlock(SeekableStream fis, RPTreeLeafNodeItem leafHitItem, HashMap<Integer, String> chromosomeMap, boolean isLowToHigh, int uncompressBufSize){ this.leafHitItem = leafHitItem; this.chromosomeMap = chromosomeMap; this.isLowToHigh = isLowToHigh; fileOffset = this.leafHitItem.getDataOffset(); leafDataSize = this.leafHitItem.geDataSize(); byte[] buffer = new byte[(int) leafDataSize]; // read Wig data block into a buffer try { fis.seek(fileOffset); fis.readFully(buffer); // decompress if necessary - the buffer size is 0 for uncompressed data // Note: BBFile Table C specifies a decompression buffer size if(uncompressBufSize > 0) wigBuffer = BBCompressionUtils.decompress(buffer, uncompressBufSize); else wigBuffer = buffer; // use uncompressed read buffer directly }catch(IOException ex) { log.error("Error reading Wig section for leaf item ", ex); String error = String.format("Error reading Wig section for leaf item %d\n"); throw new RuntimeException(error, ex); } // initialize unread data size remDataSize = wigBuffer.length; // use getWigData to extract data block items }
public boolean insertItem(RPTreeNodeItem item){ RPTreeLeafNodeItem newItem = (RPTreeLeafNodeItem)item; // Note: assumes all keys are inserted in rank order leafItems.add(newItem); // todo: compare region and insert at appropriate indexed rank location // leafHitItem.add( index, (RPTreeLeafNodeItem)item ); // update leaf node chromosome bounds - use extremes // Update node bounds or start node chromosome bounds with first entry if(chromosomeBounds == null) chromosomeBounds = new RPChromosomeRegion(newItem.getChromosomeBounds()); else chromosomeBounds = chromosomeBounds.getExtremes(newItem.getChromosomeBounds()); // successful insert return true; }
public void print() { log.debug("R+ tree leaf node data item "); log.debug("StartChromID = " + getStartChromID()); log.debug("StartBase = " + getStartBase()); log.debug("EndChromID = " + getEndChromID()); log.debug("EndBase = " + getEndBase()); // leaf node specific entries log.debug("DataOffset = " + dataOffset); log.debug("DataSize = " + dataSize); }
hitValue = leafItem.compareRegions(selectionRegion);
thisNode.insertItem(new RPTreeLeafNodeItem(startChromID, startBase, endChromID, endBase, dataOffset, dataSize)); } else {
public void printItems(){ log.debug("Leaf Node contains " + leafItems.size() + " items:"); for(int item = 0; item < leafItems.size(); ++item){ leafItems.get(item).print(); } }
hitValue = leafItem.compareRegions(selectionRegion);
thisNode.insertItem(new RPTreeLeafNodeItem(startChromID, startBase, endChromID, endBase, dataOffset, dataSize)); } else {
public void printItems(){ log.debug("Leaf Node contains " + leafItems.size() + " items:"); for(int item = 0; item < leafItems.size(); ++item){ leafItems.get(item).print(); } }
public BigWigDataBlock(SeekableStream fis, RPTreeLeafNodeItem leafHitItem, HashMap<Integer, String> chromosomeMap, boolean isLowToHigh, int uncompressBufSize){ this.leafHitItem = leafHitItem; this.chromosomeMap = chromosomeMap; this.isLowToHigh = isLowToHigh; fileOffset = this.leafHitItem.getDataOffset(); leafDataSize = this.leafHitItem.geDataSize(); byte[] buffer = new byte[(int) leafDataSize]; // read Wig data block into a buffer try { fis.seek(fileOffset); fis.readFully(buffer); // decompress if necessary - the buffer size is 0 for uncompressed data // Note: BBFile Table C specifies a decompression buffer size if(uncompressBufSize > 0) wigBuffer = BBCompressionUtils.decompress(buffer, uncompressBufSize); else wigBuffer = buffer; // use uncompressed read buffer directly }catch(IOException ex) { log.error("Error reading Wig section for leaf item ", ex); String error = String.format("Error reading Wig section for leaf item %d\n"); throw new RuntimeException(error, ex); } // initialize unread data size remDataSize = wigBuffer.length; // use getWigData to extract data block items }
public boolean insertItem(RPTreeNodeItem item){ RPTreeLeafNodeItem newItem = (RPTreeLeafNodeItem)item; // Note: assumes all keys are inserted in rank order leafItems.add(newItem); // todo: compare region and insert at appropriate indexed rank location // leafHitItem.add( index, (RPTreeLeafNodeItem)item ); // update leaf node chromosome bounds - use extremes // Update node bounds or start node chromosome bounds with first entry if(chromosomeBounds == null) chromosomeBounds = new RPChromosomeRegion(newItem.getChromosomeBounds()); else chromosomeBounds = chromosomeBounds.getExtremes(newItem.getChromosomeBounds()); // successful insert return true; }
public void print() { log.debug("R+ tree leaf node data item "); log.debug("StartChromID = " + getStartChromID()); log.debug("StartBase = " + getStartBase()); log.debug("EndChromID = " + getEndChromID()); log.debug("EndBase = " + getEndBase()); // leaf node specific entries log.debug("DataOffset = " + dataOffset); log.debug("DataSize = " + dataSize); }
hitValue = leafItem.compareRegions(selectionRegion);
thisNode.insertItem(new RPTreeLeafNodeItem(startChromID, startBase, endChromID, endBase, dataOffset, dataSize)); } else {
this.isLowToHigh = isLowToHigh; dataBlockSize = this.leafHitItem.geDataSize(); byte[] buffer = new byte[(int) dataBlockSize]; fileOffset = this.leafHitItem.getDataOffset();
private int getHitList(RPChromosomeRegion hitRegion, boolean contained) { // hit list for hit region; subject to mMaxLeafHits limitation leafHitList = chromDataTree.getChromosomeDataHits(hitRegion, contained); // check if any leaf items were selected int nHits = leafHitList.size(); if (nHits == 0) return 0; else leafItemIndex = 0; // reset hit item index to start of list // find hit bounds from first and last hit items int startChromID = leafHitList.get(0).getChromosomeBounds().getStartChromID(); int startBase = leafHitList.get(0).getChromosomeBounds().getStartBase(); int endChromID = leafHitList.get(nHits - 1).getChromosomeBounds().getEndChromID(); int endBase = leafHitList.get(nHits - 1).getChromosomeBounds().getEndBase(); // save hit region; not currently used but useful for debug this.hitRegion = new RPChromosomeRegion(startChromID, startBase, endChromID, endBase); return nHits; }
this.isLowToHigh = isLowToHigh; dataBlockSize = this.leafHitItem.geDataSize(); byte[] buffer = new byte[(int) dataBlockSize]; fileOffset = this.leafHitItem.getDataOffset();
private int getHitList(RPChromosomeRegion hitRegion, boolean contained) { // hit list for hit region; subject to mMaxLeafHits limitation leafHitList = zoomDataTree.getChromosomeDataHits(hitRegion, contained); // check if any leaf items were selected int nHits = leafHitList.size(); if (nHits == 0) return 0; // no data hits found else leafItemIndex = 0; // reset hit item index to start of list // find hit bounds int startChromID = leafHitList.get(0).getChromosomeBounds().getStartChromID(); int startBase = leafHitList.get(0).getChromosomeBounds().getStartBase(); int endChromID = leafHitList.get(nHits - 1).getChromosomeBounds().getEndChromID(); int endBase = leafHitList.get(nHits - 1).getChromosomeBounds().getEndBase(); // save hit region definition; not currently used but useful for debug this.hitRegion = new RPChromosomeRegion(startChromID, startBase, endChromID, endBase); return nHits; }
this.isLowToHigh = isLowToHigh; fileOffset = this.leafHitItem.getDataOffset(); dataBlockSize = this.leafHitItem.geDataSize(); byte[] buffer = new byte[(int) dataBlockSize];
private int getHitList(RPChromosomeRegion hitRegion, boolean contained) { // hit list for hit region; subject to mMaxLeafHits limitation leafHitList = chromDataTree.getChromosomeDataHits(hitRegion, contained); // check if any leaf items were selected int nHits = leafHitList.size(); if (nHits == 0) return 0; else leafItemIndex = 0; // reset hit item index to start of list // find hit bounds from first and last hit items int startChromID = leafHitList.get(0).getChromosomeBounds().getStartChromID(); int startBase = leafHitList.get(0).getChromosomeBounds().getStartBase(); int endChromID = leafHitList.get(nHits - 1).getChromosomeBounds().getEndChromID(); int endBase = leafHitList.get(nHits - 1).getChromosomeBounds().getEndBase(); // save hit region; not currently used but useful for debug this.hitRegion = new RPChromosomeRegion(startChromID, startBase, endChromID, endBase); return nHits; }