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 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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; // 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; }
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; // 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; }
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; }
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 bedDataBlock = new BigBedDataBlock(fis, leafHitItem, chromosomeMap, isLowToHigh, uncompressBufSize); // get data block Bed feature list and set next index to first item bedFeatureList = bedDataBlock.getBedData(selectionRegion, contained); bedFeatureIndex = 0; // data block items available for iterator if(bedFeatureList.size() > 0) return true; else return false; }
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; }
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; }
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; }
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; }
private List<BedFeature> readBedDataBlock(RPTreeLeafNodeItem leafHitItem) { // 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 BigBedDataBlock bedDataBlock = new BigBedDataBlock(fis, leafHitItem, chromosomeMap, isLowToHigh, uncompressBufSize); // get data block Bed feature list and set next index to first item return bedDataBlock.getBedData(selectionRegion, contained); }
private void findAllChromosomeRegions(RPTreeNode thisNode, ArrayList<RPChromosomeRegion> regionList) { // search down the tree recursively starting with the root node if (thisNode.isLeaf()) { int nLeaves = thisNode.getItemCount(); for (int index = 0; index < nLeaves; ++index) { RPTreeLeafNodeItem leaf = (RPTreeLeafNodeItem) thisNode.getItem(index); // add all leaf regions RPChromosomeRegion region = leaf.getChromosomeBounds(); regionList.add(region); } } else { // get all child nodes int nNodes = thisNode.getItemCount(); for (int index = 0; index < nNodes; ++index) { RPTreeChildNodeItem childItem = (RPTreeChildNodeItem) thisNode.getItem(index); RPTreeNode childNode = childItem.getChildNode(); findAllChromosomeRegions(childNode, regionList); } } }
private void findAllChromosomeRegions(RPTreeNode thisNode, ArrayList<RPChromosomeRegion> regionList) { // search down the tree recursively starting with the root node if (thisNode.isLeaf()) { int nLeaves = thisNode.getItemCount(); for (int index = 0; index < nLeaves; ++index) { RPTreeLeafNodeItem leaf = (RPTreeLeafNodeItem) thisNode.getItem(index); // add all leaf regions RPChromosomeRegion region = leaf.getChromosomeBounds(); regionList.add(region); } } else { // get all child nodes int nNodes = thisNode.getItemCount(); for (int index = 0; index < nNodes; ++index) { RPTreeChildNodeItem childItem = (RPTreeChildNodeItem) thisNode.getItem(index); RPTreeNode childNode = childItem.getChildNode(); findAllChromosomeRegions(childNode, regionList); } } }
private void findAllChromosomeRegions(RPTreeNode thisNode, ArrayList<RPChromosomeRegion> regionList) { // search down the tree recursively starting with the root node if (thisNode.isLeaf()) { int nLeaves = thisNode.getItemCount(); for (int index = 0; index < nLeaves; ++index) { RPTreeLeafNodeItem leaf = (RPTreeLeafNodeItem) thisNode.getItem(index); // add all leaf regions RPChromosomeRegion region = leaf.getChromosomeBounds(); regionList.add(region); } } else { // get all child nodes int nNodes = thisNode.getItemCount(); for (int index = 0; index < nNodes; ++index) { RPTreeChildNodeItem childItem = (RPTreeChildNodeItem) thisNode.getItem(index); RPTreeNode childNode = childItem.getChildNode(); findAllChromosomeRegions(childNode, regionList); } } }