public int setSelectionRegion(RPChromosomeRegion selectionRegion, boolean contained) { this.selectionRegion = selectionRegion; isContained = contained; // set up hit list and first data block read leafHitList = null; // Must nullify existing hit list first! int hitCount = getHitRegion(selectionRegion, contained); if (hitCount == 0) // no hits - no point in fetching data throw new RuntimeException("No wig data found in the selection region"); // Ready for next() data extraction return hitCount; }
public int setSelectionRegion(RPChromosomeRegion selectionRegion, boolean contained) { this.selectionRegion = selectionRegion; isContained = contained; // set up hit list and first data block read leafHitList = null; // Must nullify existing hit list first! int hitCount = getHitRegion(selectionRegion, contained); if (hitCount == 0) // no hits - no point in fetching data throw new RuntimeException("No wig data found in the selection region"); // Ready for next() data extraction return hitCount; }
public int setSelectionRegion(RPChromosomeRegion selectionRegion, boolean contained) { this.selectionRegion = selectionRegion; isContained = contained; // set up hit list and first data block read leafHitList = null; // Must nullify existing hit list first! int hitCount = getHitRegion(selectionRegion, contained); if (hitCount == 0) // no hits - no point in fetching data throw new RuntimeException("No wig data found in the selection region"); // Ready for next() data extraction return hitCount; }
int hitCount = getHitRegion(selectionRegion, contained); if (hitCount == 0) { empty = true;
int hitCount = getHitRegion(selectionRegion, contained); if (hitCount == 0) { empty = true;
int hitCount = getHitRegion(selectionRegion, contained); if (hitCount == 0) { empty = true;
private int getHitRegion(RPChromosomeRegion hitRegion, boolean contained) { int hitCount = 0; // check if new hit list is needed if (leafHitList == null) { hitCount = getHitList(hitRegion, contained); if (hitCount == 0) return 0; // no hit data found } else { hitCount = leafHitList.size() - leafItemIndex; if (hitCount == 0) return 0; // hit list exhausted } // Perform a block read for starting base of selection region - use first leaf hit dataBlockRead = getDataBlock(leafItemIndex++); // try next item - probably intersection issue // Note: recursive call until a block is valid or hit list exhuasted if (!dataBlockRead) hitCount = getHitRegion(hitRegion, contained); return hitCount; }
private int getHitRegion(RPChromosomeRegion hitRegion, boolean contained) { int hitCount = 0; // check if new hit list is needed if (leafHitList == null) { hitCount = getHitList(hitRegion, contained); if (hitCount == 0) return 0; // no hit data found } else { hitCount = leafHitList.size() - leafItemIndex; if (hitCount == 0) return 0; // hit list exhausted } // Perform a block read for starting base of selection region - use first leaf hit dataBlockRead = getDataBlock(leafItemIndex++); // try next item - probably intersection issue // Note: recursive call until a block is valid or hit list exhuasted if (!dataBlockRead) hitCount = getHitRegion(hitRegion, contained); return hitCount; }
private int getHitRegion(RPChromosomeRegion hitRegion, boolean contained) { int hitCount = 0; // check if new hit list is needed if (leafHitList == null) { hitCount = getHitList(hitRegion, contained); if (hitCount == 0) return 0; // no hit data found } else { hitCount = leafHitList.size() - leafItemIndex; if (hitCount == 0) return 0; // hit list exhausted } // Perform a block read for starting base of selection region - use first leaf hit dataBlockRead = getDataBlock(leafItemIndex++); // try next item - probably intersection issue // Note: recursive call until a block is valid or hit list exhuasted if (!dataBlockRead) hitCount = getHitRegion(hitRegion, contained); return hitCount; }
/** * Method returns the current Wig item and advances to the next Wig record. * <p/> * Returns: * Wig item for current BigWig data record. * <p/> * Note: If "next" method is called when a "next item" does not exist, * an NoSuchElementException will be thrown. */ public WigItem next() { // return next Wig item in list if (wigItemIndex < wigItemList.size()) return (wigItemList.get(wigItemIndex++)); // attempt to get next leaf item data block else { int nHits = getHitRegion(selectionRegion, isContained); if (nHits > 0) { // Note: getDataBlock initializes bed feature index to 0 return (wigItemList.get(wigItemIndex++)); // return 1st Data Block item } else { String result = String.format("Failed to find data for wig region (%d,%d,%d,%d)\n", hitRegion.getStartChromID(), hitRegion.getStartBase(), hitRegion.getEndChromID(), hitRegion.getEndBase()); log.error(result); return null; //throw new NoSuchElementException(result); } } }
/** * Method returns the current Wig item and advances to the next Wig record. * <p/> * Returns: * Wig item for current BigWig data record. * <p/> * Note: If "next" method is called when a "next item" does not exist, * an NoSuchElementException will be thrown. */ public WigItem next() { // return next Wig item in list if (wigItemIndex < wigItemList.size()) return (wigItemList.get(wigItemIndex++)); // attempt to get next leaf item data block else { int nHits = getHitRegion(selectionRegion, isContained); if (nHits > 0) { // Note: getDataBlock initializes bed feature index to 0 return (wigItemList.get(wigItemIndex++)); // return 1st Data Block item } else { String result = String.format("Failed to find data for wig region (%d,%d,%d,%d)\n", hitRegion.getStartChromID(), hitRegion.getStartBase(), hitRegion.getEndChromID(), hitRegion.getEndBase()); log.error(result); return null; //throw new NoSuchElementException(result); } } }
/** * Method returns the current Wig item and advances to the next Wig record. * <p/> * Returns: * Wig item for current BigWig data record. * <p/> * Note: If "next" method is called when a "next item" does not exist, * an NoSuchElementException will be thrown. */ public WigItem next() { // return next Wig item in list if (wigItemIndex < wigItemList.size()) return (wigItemList.get(wigItemIndex++)); // attempt to get next leaf item data block else { int nHits = getHitRegion(selectionRegion, isContained); if (nHits > 0) { // Note: getDataBlock initializes bed feature index to 0 return (wigItemList.get(wigItemIndex++)); // return 1st Data Block item } else { String result = String.format("Failed to find data for wig region (%d,%d,%d,%d)\n", hitRegion.getStartChromID(), hitRegion.getStartBase(), hitRegion.getEndChromID(), hitRegion.getEndBase()); log.error(result); return null; //throw new NoSuchElementException(result); } } }