• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BBFileReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: TrackWiggles

import org.broad.igv.bbfile.BBFileReader; //导入依赖的package包/类
/**
 * Read bigWig from local file or remote URL.
 * @param filename Filename or URL to access 
 * @param gc Query coordinates and size of printable window 
 * @throws IOException 
 * @throws InvalidRecordException 
 * @throws InvalidGenomicCoordsException 
 * @throws SQLException 
 * @throws ClassNotFoundException */
public TrackWiggles(String filename, GenomicCoords gc, int bdgDataColIdx) throws IOException, InvalidRecordException, InvalidGenomicCoordsException, ClassNotFoundException, SQLException{

	this.setFilename(filename);
	this.setWorkFilename(filename);
	this.bdgDataColIdx= bdgDataColIdx;
	this.setTrackFormat(Utils.getFileTypeFromName(this.getWorkFilename()));
	
	if(this.getTrackFormat().equals(TrackFormat.BIGWIG)){
		this.setTrackFormat(TrackFormat.BIGWIG);
		this.bigWigReader=new BBFileReader(this.getWorkFilename()); // or url for remote access.
		if(!this.bigWigReader.getBBFileHeader().isBigWig()){
			throw new RuntimeException("Invalid file type " + this.getWorkFilename());
		}
		
	} else if(this.getTrackFormat().equals(TrackFormat.BEDGRAPH) && ! Utils.hasTabixIndex(filename)){
			String tabixBdg= this.tabixBedgraphToTmpFile(filename);
			this.setWorkFilename(tabixBdg);
	}
	this.setGc(gc);
	
}
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:31,代码来源:TrackWiggles.java


示例2: bigWigToScores

import org.broad.igv.bbfile.BBFileReader; //导入依赖的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


示例3: initRegionFromBigBed

import org.broad.igv.bbfile.BBFileReader; //导入依赖的package包/类
private static String initRegionFromBigBed(String bigBedFile) throws IOException{
	
	BBFileReader reader= new BBFileReader(bigBedFile);
	if(! reader.isBigBedFile()){
		System.err.println("File " + bigBedFile + " is not bigBed.");
		throw new RuntimeException();
	}
	String region= reader.getChromosomeNames().get(0); // Just get chrom to start with
	
	for(String chrom : reader.getChromosomeNames()){
		BigBedIterator iter = reader.getBigBedIterator(chrom, 0, chrom, Integer.MAX_VALUE, false);
		if(iter.hasNext()){
			BedFeature x= (BedFeature) iter.next();
			region= x.getChromosome() + ":" + (x.getStartBase() + 1);
			reader.close();
			return region;
		}
	}
	reader.close();
	return region;
}
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:22,代码来源:Utils.java


示例4: initRegionFromBigWig

import org.broad.igv.bbfile.BBFileReader; //导入依赖的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


示例5: canReadBigWigFromRemote

import org.broad.igv.bbfile.BBFileReader; //导入依赖的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


示例6: MethylTrack

import org.broad.igv.bbfile.BBFileReader; //导入依赖的package包/类
public MethylTrack(ResourceLocator dataResourceLocator, BBFileReader reader, Genome genome) throws IOException {
    super(dataResourceLocator);
    setHeight(60);
    renderer = new PointsRenderer();

    boolean isWGBS;
    if (reader.getAutoSql() != null && reader.getAutoSql().startsWith("table BisulfiteSeq")) {
        resolutionThreshold = FIVE_MB;
        dataSource = new CachingMethylSource(new BBMethylDataSource(reader, BBMethylDataSource.Type.USC, genome), resolutionThreshold);
        //dataSource = new BBMethylDataSource(reader, BBMethylDataSource.Type.USC, genome);
    } else {
        isWGBS = dataResourceLocator.getPath().contains("BiSeq_cpgMethylation");
        resolutionThreshold = isWGBS ? FIVE_MB : FIFTY_MB;
        dataSource = new CachingMethylSource(new BBMethylDataSource(reader, BBMethylDataSource.Type.ZILLER, genome), resolutionThreshold);
        //dataSource = new BBMethylDataSource(reader, BBMethylDataSource.Type.USC, genome);
    }

    loadedRange = new Range("", -1, -1, Collections.<MethylScore>emptyList());
    setDataRange(new DataRange(0, 100));
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:21,代码来源:MethylTrack.java


示例7: computeBins

import org.broad.igv.bbfile.BBFileReader; //导入依赖的package包/类
public static void computeBins(String path, String chr, int start, int end, int windowSize) throws IOException {

        BBFileReader reader = new BBFileReader(path);
        boolean found = false;
        StringBuilder errString = new StringBuilder();
        for (String chr1 : reader.getChromosomeNames()) {
            if (chr.equals(chr1)) found = true;
            errString.append("\"").append(chr1).append("\" ");
        }
        if (!found) {
            System.err.println("Chromosome \"" + chr + "\" not found in " + path);
            System.err.println("The chromosomes in " + path + " are " + errString);
            return;
        }
        computeBins(reader, chr, start, end, windowSize);

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


示例8: open

import org.broad.igv.bbfile.BBFileReader; //导入依赖的package包/类
public BigWigResource open(final OnNotFound onNotFound)
{
try {
	this.bbFileReader= new BBFileReader(this.biwWigFile);
	}
catch(final IOException err)
	{
	throw new RuntimeIOException("Cannot open "+this.biwWigFile,err);
	}
if(!this.bbFileReader.isBigWigFile())
	{
	this.bbFileReader=null;
	throw new RuntimeIOException(this.biwWigFile+" is not a bigWIG file. ("+this.getToken()+")");
	}
this.contigNameConverter = ContigNameConverter.fromContigSet(new HashSet<>(this.bbFileReader.getChromosomeNames()));
this.contigNameConverter.setOnNotFound(onNotFound);
return this;
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:19,代码来源:VCFBigWig.java


示例9: TrackIntervalFeature

import org.broad.igv.bbfile.BBFileReader; //导入依赖的package包/类
public TrackIntervalFeature(final String filename, GenomicCoords gc) throws IOException, InvalidGenomicCoordsException, ClassNotFoundException, InvalidRecordException, SQLException{
	
	this.setFilename(filename);

	if(Utils.getFileTypeFromName(filename).equals(TrackFormat.BIGBED)){
		
		this.bigBedReader = new BBFileReader(filename);  // or url for remote access.
		if(!this.bigBedReader.getBBFileHeader().isBigBed()){
			throw new RuntimeException("File " + filename + " is not bigBed.");
		}
		
		this.setWorkFilename(filename);
		this.setTrackFormat(TrackFormat.BIGBED);
		
	} else if( ! Utils.hasTabixIndex(filename)){
		// Tabix index not found for this file. Sort and index input to tmp.

		String suffix= new File(filename).getName();
		if( ! suffix.endsWith(".gz")){
			suffix += ".gz";
		}
		String tmpWorkFile= Utils.createTempFile(".asciigenome.", "." + suffix).getAbsolutePath();
		new File(tmpWorkFile).deleteOnExit();
		new File(new File(tmpWorkFile).getAbsolutePath() + ".tbi").deleteOnExit();
		this.setWorkFilename(tmpWorkFile);

		this.setTrackFormat(Utils.getFileTypeFromName(new File(filename).getName()));
		new MakeTabixIndex(filename, new File( this.getWorkFilename() ), Utils.trackFormatToTabixFormat(this.getTrackFormat()));	

		this.setWorkFilename(tmpWorkFile);
		this.tabixReader= new TabixReader(new File(this.getWorkFilename()).getAbsolutePath());
		
	} else { // This means the input is tabix indexed.
		this.setWorkFilename(filename);
		this.setTrackFormat(Utils.getFileTypeFromName(new File(filename).getName()));
		this.tabixReader= new TabixReader(this.getWorkFilename());
	}
	this.setGc(gc);
}
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:40,代码来源:TrackIntervalFeature.java


示例10: TabixBigBedIterator

import org.broad.igv.bbfile.BBFileReader; //导入依赖的package包/类
protected TabixBigBedIterator(BBFileReader reader, String chrom, int start, int end){
	this.bigBedIterator= reader.getBigBedIterator(chrom, start, chrom, end, false);
}
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:4,代码来源:TabixBigBedIterator.java


示例11: TabixBigBedReader

import org.broad.igv.bbfile.BBFileReader; //导入依赖的package包/类
protected TabixBigBedReader(BBFileReader bigBedReader){
	this.bigBedReader = bigBedReader;
}
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:4,代码来源:TabixBigBedReader.java


示例12: ZillerDataSource2

import org.broad.igv.bbfile.BBFileReader; //导入依赖的package包/类
public ZillerDataSource2(String path, Genome genome) throws IOException {
    super(genome);
    reader = new BBFileReader(path);
    init(genome);
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:6,代码来源:ZillerDataSource2.java


示例13: BBMethylDataSource

import org.broad.igv.bbfile.BBFileReader; //导入依赖的package包/类
public BBMethylDataSource(BBFileReader reader, Type type, Genome genome) throws IOException {
    this.reader = reader;
    this.type = type;
    init(genome);
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:6,代码来源:BBMethylDataSource.java


示例14: loadMethylTrack

import org.broad.igv.bbfile.BBFileReader; //导入依赖的package包/类
private void loadMethylTrack(ResourceLocator locator, BBFileReader reader, List<Track> newTracks, Genome genome) throws IOException {

        MethylTrack track = new MethylTrack(locator, reader, genome);
        newTracks.add(track);
    }
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:6,代码来源:TrackLoader.java



注:本文中的org.broad.igv.bbfile.BBFileReader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ISpeciesRoot类代码示例发布时间:2022-05-22
下一篇:
Java Time类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap