• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java BigWigIterator类的典型用法和代码示例

java 4次浏览

本文整理汇总了Java中org.broad.igv.bbfile.BigWigIterator的典型用法代码示例。如果您正苦于以下问题:Java BigWigIterator类的具体用法?Java BigWigIterator怎么用?Java BigWigIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

BigWigIterator类属于org.broad.igv.bbfile包,在下文中一共展示了BigWigIterator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: bigWigToScores

点赞 3

import org.broad.igv.bbfile.BigWigIterator; //导入依赖的package包/类
/** Populate object using bigWig data 
 * @throws IOException 
 * @throws InvalidGenomicCoordsException */
private void bigWigToScores(BBFileReader reader) throws InvalidGenomicCoordsException, IOException{

	// List of length equal to screen size. Each inner map contains info about the screen locus 
	List<ScreenWiggleLocusInfo> screenWigLocInfoList= new ArrayList<ScreenWiggleLocusInfo>();
	for(int i= 0; i < getGc().getUserWindowSize(); i++){
		screenWigLocInfoList.add(new ScreenWiggleLocusInfo());
	}

	BigWigIterator iter = reader.getBigWigIterator(getGc().getChrom(), getGc().getFrom(), getGc().getChrom(), getGc().getTo(), false);
	while(iter.hasNext()){
		WigItem bw = iter.next();
		for(int i= bw.getStartBase(); i <= bw.getEndBase(); i++){
			int idx= Utils.getIndexOfclosestValue(i, this.getGc().getMapping()); // Where should this position be mapped on screen?
			screenWigLocInfoList.get(idx).increment(bw.getWigValue());
		} 
	}
	List<Float> screenScores= new ArrayList<Float>();
	for(ScreenWiggleLocusInfo x : screenWigLocInfoList){
		screenScores.add((float)x.getMeanScore());
	}
	this.setScreenScores(screenScores);		
}
 

开发者ID:dariober,
项目名称:ASCIIGenome,
代码行数:26,
代码来源:TrackWiggles.java

示例2: initRegionFromBigWig

点赞 3

import org.broad.igv.bbfile.BigWigIterator; //导入依赖的package包/类
private static String initRegionFromBigWig(String bigWigFile) throws IOException{
	
	BBFileReader reader= new BBFileReader(bigWigFile);
	if(! reader.isBigWigFile()){
		System.err.println("File " + bigWigFile + " is not bigWig.");
		throw new RuntimeException();
	}
	String region= reader.getChromosomeNames().get(0); // Just get chrom to start with
	
	for(String chrom : reader.getChromosomeNames()){
		BigWigIterator iter = reader.getBigWigIterator(chrom, 0, chrom, Integer.MAX_VALUE, false);
		if(iter.hasNext()){
			WigItem x = iter.next();
			region= x.getChromosome() + ":" + (x.getStartBase() + 1);
			reader.close();
			return region;
		}
	}
	reader.close();
	return region;
}
 

开发者ID:dariober,
项目名称:ASCIIGenome,
代码行数:22,
代码来源:Utils.java

示例3: canReadBigWigFromRemote

点赞 3

import org.broad.igv.bbfile.BigWigIterator; //导入依赖的package包/类
@Test
public void canReadBigWigFromRemote() throws IOException{
	// String urlStr= "http://hgdownload.cse.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeHaibTfbs/wgEncodeHaibTfbsA549Atf3V0422111Etoh02RawRep1.bigWig";
	String urlStr= "http://hgdownload.cse.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeHaibTfbs/wgEncodeHaibTfbsA549Cebpbsc150V0422111RawRep1.bigWig";
	BBFileReader reader=new BBFileReader(urlStr);
	System.out.println(reader.getChromosomeNames());
	BigWigIterator iter = reader.getBigWigIterator("chr1", 1000000, "chr1", 2000000, true);
	while(iter.hasNext()){
		System.out.println(iter.next().getStartBase());
	}
	System.out.println("NEW");
	iter = reader.getBigWigIterator("chr10", 1000000, "chr10", 2000000, true);
		while(iter.hasNext()){
			System.out.println(iter.next().getStartBase());
		}
	reader.close();
}
 

开发者ID:dariober,
项目名称:ASCIIGenome,
代码行数:18,
代码来源:TrackWigglesTest.java

示例4: computeBins

点赞 2

import org.broad.igv.bbfile.BigWigIterator; //导入依赖的package包/类
/**
 * Private method, does the actual work
 *
 * @param reader
 * @param chr
 * @param start
 * @param end
 * @param windowSize
 */
private static void computeBins(BBFileReader reader, String chr, int start, int end, int windowSize) {
    BigWigIterator iter = reader.getBigWigIterator(chr, start, chr, end, false);
    double sum = 0;
    int nPts = 0;
    double max = 0;
    int currentBin = 0;

    while (iter.hasNext()) {
        WigItem datum = iter.next();
        int dPosition = (datum.getStartBase() + datum.getEndBase()) / 2;


        if (dPosition > (currentBin + 1) * windowSize) {
            // Output previous window
            // if (nPts > 0) {

            double mean = sum / nPts;
            int wStart = windowSize * currentBin;
            int wEnd = wStart + windowSize;
            // unclear why, but sometimes datum.getChromosome() is null
            //System.out.println(datum.getChromosome() + "\t" + wStart + "\t" + wEnd + "\t" + mean + "\t" + max);
            System.out.println(chr + "\t" + wStart + "\t" + wEnd + "\t" + mean + "\t" + max);

            currentBin++;

            // deal with empty bins
            while (currentBin < dPosition / windowSize) {
                wStart = windowSize * currentBin;
                wEnd = wStart + windowSize;
                mean = 0;
                max = 0;
                System.out.println(chr + "\t" + wStart + "\t" + wEnd + "\t" + mean + "\t" + max);
                // System.out.println(datum.getChromosome() + "\t" + wStart + "\t" + wEnd + "\t" + mean + "\t" + max);
                currentBin++;
            }
            // Start new window
            currentBin = dPosition / windowSize;
            sum = 0;
            nPts = 0;
            max = 0;
        }

        sum += datum.getWigValue();
        max = Math.max(max, datum.getWigValue());
        nPts++;

    }
}
 

开发者ID:theaidenlab,
项目名称:Juicebox,
代码行数:58,
代码来源:BigWigUtils.java

示例5: WigItemIterator

点赞 2

import org.broad.igv.bbfile.BigWigIterator; //导入依赖的package包/类
WigItemIterator(final BigWigIterator delegate ){
this.delegate  = delegate;
}
 

开发者ID:lindenb,
项目名称:jvarkit,
代码行数:4,
代码来源:VCFBigWig.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)