当前位置: 首页>>代码示例>>Java>>正文


Java BlockCompressedOutputStream.getFilePointer方法代码示例

本文整理汇总了Java中htsjdk.samtools.util.BlockCompressedOutputStream.getFilePointer方法的典型用法代码示例。如果您正苦于以下问题:Java BlockCompressedOutputStream.getFilePointer方法的具体用法?Java BlockCompressedOutputStream.getFilePointer怎么用?Java BlockCompressedOutputStream.getFilePointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在htsjdk.samtools.util.BlockCompressedOutputStream的用法示例。


在下文中一共展示了BlockCompressedOutputStream.getFilePointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: blockCompressAndIndex

import htsjdk.samtools.util.BlockCompressedOutputStream; //导入方法依赖的package包/类
/**
 * Block compress input file and create associated tabix index. Newly created file and index are
 * deleted on exit if deleteOnExit true.
 * @throws IOException 
 * @throws InvalidRecordException 
 * */
private void blockCompressAndIndex(String in, String bgzfOut, boolean deleteOnExit) throws IOException, InvalidRecordException {
			
	File inFile= new File(in);
	File outFile= new File(bgzfOut);
	
	LineIterator lin= utils.IOUtils.openURIForLineIterator(inFile.getAbsolutePath());

	BlockCompressedOutputStream writer = new BlockCompressedOutputStream(outFile);
	long filePosition= writer.getFilePointer();
			
	TabixIndexCreator indexCreator=new TabixIndexCreator(TabixFormat.GFF);		
	
	while(lin.hasNext()){
		String line = lin.next();			
		GtfLine gtf= new GtfLine(line.split("\t"));
		writer.write(line.getBytes());
		writer.write('\n');
		indexCreator.addFeature(gtf, filePosition);
		filePosition = writer.getFilePointer();
	}
	writer.flush();
			
	File tbi= new File(bgzfOut + TabixUtils.STANDARD_INDEX_EXTENSION);
	if(tbi.exists() && tbi.isFile()){
		writer.close();
		throw new RuntimeException("Index file exists: " + tbi);
	}
	Index index = indexCreator.finalizeIndex(writer.getFilePointer());
	index.writeBasedOnFeatureFile(outFile);
	writer.close();
	
	if(deleteOnExit){
		outFile.deleteOnExit();
		File idx= new File(outFile.getAbsolutePath() + TabixUtils.STANDARD_INDEX_EXTENSION);
		idx.deleteOnExit();
	}
}
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:44,代码来源:UcscFetch.java

示例2: getFilePosition

import htsjdk.samtools.util.BlockCompressedOutputStream; //导入方法依赖的package包/类
private long getFilePosition(GeneFile geneFile, BlockCompressedOutputStream bcos, PositionalOutputStream os) {
    return geneFile.getCompressed() ? bcos.getFilePointer() : os.getPosition();
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:4,代码来源:GeneRegisterer.java


注:本文中的htsjdk.samtools.util.BlockCompressedOutputStream.getFilePointer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。