本文整理了Java中org.broad.igv.bbfile.ZoomLevelIterator
类的一些代码示例,展示了ZoomLevelIterator
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoomLevelIterator
类的具体详情如下:
包路径:org.broad.igv.bbfile.ZoomLevelIterator
类名称:ZoomLevelIterator
[英]Created by IntelliJ IDEA. User: martind Date: Apr 16, 2010 Time: 4:19:29 PM To change this template use File | Settings | File Templates.
[中]由IntelliJ IDEA创建。用户:martind日期:2010年4月16日时间:下午4:19:29要更改此模板,请使用文件|设置|文件模板。
代码示例来源:origin: igvteam/igv
private int getHitRegion(RPChromosomeRegion hitRegion, boolean contained) {
int hitCount = 0;
// check if new hit list is needed
// Note: getHitList will reset mLeafItemIndex to 0, the beginning of new hit list
if (leafHitList == null) { //|| mLeafItemIndex >= mLeafHitList.size()){
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;
}
代码示例来源:origin: igvteam/igv
protected List<LocusScore> getZoomSummaryScores(String chr, int start, int end, int zoom) {
Chromosome c = genome.getChromosome(chr);
if (c == null) return null;
double nBins = Math.pow(2, zoom);
double scale = c.getLength() / (nBins * 700);
BBZoomLevelHeader zlHeader = getZoomLevelForScale(scale);
if (zlHeader == null) return null;
int bbLevel = zlHeader.getZoomLevel();
int reductionLevel = zlHeader.getReductionLevel();
// If we are at the highest precomputed resolution compare to the requested resolution. If they differ
// by more than a factor of 2 compute "on the fly"
String tmp = chrNameMap.get(chr);
String querySeq = tmp == null ? chr : tmp;
if (reader.isBigBedFile() || bbLevel > 1 || (bbLevel == 1 && (reductionLevel / scale) < 2)) {
ArrayList<LocusScore> scores = new ArrayList(1000);
ZoomLevelIterator zlIter = reader.getZoomLevelIterator(bbLevel, querySeq, start, querySeq, end, false);
while (zlIter.hasNext()) {
ZoomDataRecord rec = zlIter.next();
float v = getValue(rec);
BasicScore bs = new BasicScore(rec.getChromStart(), rec.getChromEnd(), v);
scores.add(bs);
}
return scores;
} else {
// No precomputed scores for this resolution level
return null;
}
}
代码示例来源:origin: pcingola/SnpEff
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;
}
代码示例来源:origin: edu.toronto.cs.savant/savant-core
ZoomLevelIterator zoomIterator = new ZoomLevelIterator(fis, chromosomeIDTree,
zoomDataTree, zoomLevel, selectionRegion, contained);
代码示例来源:origin: igvteam/igv
lowestResHeader.getZoomLevel(), firstChr, 0, lastChr, Integer.MAX_VALUE, false);
while (zlIter.hasNext()) {
ZoomDataRecord rec = zlIter.next();
代码示例来源:origin: igvteam/igv
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;
}
代码示例来源:origin: pcingola/SnpEff
ZoomLevelIterator zoomIterator = new ZoomLevelIterator(fis, chromosomeIDTree,
zoomDataTree, zoomLevel, selectionRegion, contained);
代码示例来源:origin: edu.toronto.cs.savant/savant-core
private int getHitRegion(RPChromosomeRegion hitRegion, boolean contained) {
int hitCount = 0;
// check if new hit list is needed
// Note: getHitList will reset mLeafItemIndex to 0, the beginning of new hit list
if (leafHitList == null) { //|| mLeafItemIndex >= mLeafHitList.size()){
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;
}
代码示例来源:origin: igvteam/igv
if (zlIter.hasNext()) {
while (zlIter.hasNext()) {
ZoomDataRecord rec = zlIter.next();
values[nValues++] = (rec.getMeanVal());
if (nValues >= 10000) {
代码示例来源:origin: edu.toronto.cs.savant/savant-core
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;
}
代码示例来源:origin: igvteam/igv
/**
* Returns an iterator for zoom level records for all chromosome regions.
* <p/>
* Note: the BBFile can be BigBed or BigWig.
* <p/>
* Parameters:
* zoomLevel - zoom level for data extraction; levels start at 1
* <p/>
* Returns:
* Iterator to provide BedFeature(s) for the requested chromosome region.
* Error conditions:
* 1) An empty iterator is returned if region has no data available
*/
synchronized public ZoomLevelIterator getZoomLevelIterator(int zoomLevel) {
// check for valid zoom level
if (zoomLevel < 1 || zoomLevel > zoomLevelCount)
throw new RuntimeException("Error: ZoomLevelIterator zoom level is out of range\n");
// get the appropriate zoom level R+ zoom data index tree
RPTree zoomDataTree = zoomLevels.getZoomLevelRPTree(zoomLevel);
// get all regions bounds
RPChromosomeRegion selectionRegion = zoomDataTree.getChromosomeBounds();
// compose an iterator
boolean contained = true; //all regions are contained
ZoomLevelIterator zoomIterator = new ZoomLevelIterator(fis, chromosomeIDTree,
zoomDataTree, zoomLevel, selectionRegion, contained);
return zoomIterator;
}
代码示例来源:origin: pcingola/SnpEff
private int getHitRegion(RPChromosomeRegion hitRegion, boolean contained) {
int hitCount = 0;
// check if new hit list is needed
// Note: getHitList will reset mLeafItemIndex to 0, the beginning of new hit list
if (leafHitList == null) { //|| mLeafItemIndex >= mLeafHitList.size()){
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;
}
代码示例来源:origin: org.opencb.biodata/biodata-tools
ZoomDataRecord wItem;
int length, chunkStart, chunkEnd;
while (zoomIterator.hasNext()) {
wItem = zoomIterator.next();
chunkStart = (Math.max(region.getStart(), wItem.getChromStart()) - region.getStart()) / windowSize;
chunkEnd = (Math.min(region.getEnd(), wItem.getChromEnd()) - region.getStart() - 1) / windowSize;
代码示例来源:origin: igvteam/igv
int hitCount = getHitRegion(selectionRegion, contained);
if (hitCount == 0) {
empty = true;
代码示例来源:origin: edu.toronto.cs.savant/savant-core
/**
* Returns an iterator for zoom level records for all chromosome regions.
* <p/>
* Note: the BBFile can be BigBed or BigWig.
* <p/>
* Parameters:
* zoomLevel - zoom level for data extraction; levels start at 1
* <p/>
* Returns:
* Iterator to provide BedFeature(s) for the requested chromosome region.
* Error conditions:
* 1) An empty iterator is returned if region has no data available
*/
public ZoomLevelIterator getZoomLevelIterator(int zoomLevel) {
// check for valid zoom level
if (zoomLevel < 1 || zoomLevel > zoomLevelCount)
throw new RuntimeException("Error: ZoomLevelIterator zoom level is out of range\n");
// get the appropriate zoom level R+ zoom data index tree
RPTree zoomDataTree = zoomLevels.getZoomLevelRPTree(zoomLevel);
// get all regions bounds
RPChromosomeRegion selectionRegion = zoomDataTree.getChromosomeBounds();
// compose an iterator
boolean contained = true; //all regions are contained
ZoomLevelIterator zoomIterator = new ZoomLevelIterator(fis, chromosomeIDTree,
zoomDataTree, zoomLevel, selectionRegion, contained);
return zoomIterator;
}
代码示例来源:origin: igvteam/igv
@Test
public void testBigBed() throws IOException {
String path = TestUtils.DATA_DIR + "bb/chr21.refseq.bb";
BBFileReader bbReader = new BBFileReader(path);
BBFileHeader bbFileHdr = bbReader.getBBFileHeader();
assertTrue(bbFileHdr.isBigBed());
String chr = "chr21";
int start = 26490012;
int end = 42182827;
for (BBZoomLevelHeader header : bbReader.getZoomLevels().getZoomLevelHeaders()) {
assertNotNull(header);
ZoomLevelIterator zlIter = bbReader.getZoomLevelIterator(header.getZoomLevel(), chr, start, chr, end, false);
while (zlIter.hasNext()) {
ZoomDataRecord rec = zlIter.next();
int n = rec.getBasesCovered();
if (n > 0) {
assertEquals(chr, rec.getChromName());
assertTrue(rec.getChromEnd() >= start && rec.getChromStart() <= end);
}
}
}
}
代码示例来源:origin: pcingola/SnpEff
int hitCount = getHitRegion(selectionRegion, contained);
if (hitCount == 0) {
empty = true;
代码示例来源:origin: pcingola/SnpEff
/**
* Returns an iterator for zoom level records for all chromosome regions.
* <p/>
* Note: the BBFile can be BigBed or BigWig.
* <p/>
* Parameters:
* zoomLevel - zoom level for data extraction; levels start at 1
* <p/>
* Returns:
* Iterator to provide BedFeature(s) for the requested chromosome region.
* Error conditions:
* 1) An empty iterator is returned if region has no data available
*/
public ZoomLevelIterator getZoomLevelIterator(int zoomLevel) {
// check for valid zoom level
if (zoomLevel < 1 || zoomLevel > zoomLevelCount)
throw new RuntimeException("Error: ZoomLevelIterator zoom level is out of range\n");
// get the appropriate zoom level R+ zoom data index tree
RPTree zoomDataTree = zoomLevels.getZoomLevelRPTree(zoomLevel);
// get all regions bounds
RPChromosomeRegion selectionRegion = zoomDataTree.getChromosomeBounds();
// compose an iterator
boolean contained = true; //all regions are contained
ZoomLevelIterator zoomIterator = new ZoomLevelIterator(fis, chromosomeIDTree,
zoomDataTree, zoomLevel, selectionRegion, contained);
return zoomIterator;
}
代码示例来源:origin: edu.toronto.cs.savant/savant-core
int hitCount = getHitRegion(selectionRegion, contained);
if (hitCount == 0) {
empty = true;
代码示例来源:origin: igvteam/igv
ZoomLevelIterator zoomIterator = new ZoomLevelIterator(fis, chromosomeIDTree,
zoomDataTree, zoomLevel, selectionRegion, contained);
内容来源于网络,如有侵权,请联系作者删除!