本文整理汇总了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();
}
}
示例2: getFilePosition
import htsjdk.samtools.util.BlockCompressedOutputStream; //导入方法依赖的package包/类
private long getFilePosition(GeneFile geneFile, BlockCompressedOutputStream bcos, PositionalOutputStream os) {
return geneFile.getCompressed() ? bcos.getFilePointer() : os.getPosition();
}