本文整理汇总了Java中htsjdk.samtools.seekablestream.SeekableStreamFactory类的典型用法代码示例。如果您正苦于以下问题:Java SeekableStreamFactory类的具体用法?Java SeekableStreamFactory怎么用?Java SeekableStreamFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SeekableStreamFactory类属于htsjdk.samtools.seekablestream包,在下文中一共展示了SeekableStreamFactory类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initStream
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
public void initStream(final File plusFile) {
if(plusFile.exists()) {
try {
final ISeekableStreamFactory ssf = SeekableStreamFactory.getInstance();
final SeekableStream seekableStream =
ssf.getBufferedStream(ssf.getStreamFor(plusFile.getAbsolutePath()));
BlockCompressedInputStream is = new BlockCompressedInputStream(seekableStream);
writeIndex(is);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
} else {
throw new IllegalArgumentException("plus file in location:" + path +" is needed to write a plus index.");
}
}
开发者ID:mulinlab,项目名称:vanno,代码行数:17,代码来源:BinIndexWriter.java
示例2: addFileForPattern
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
public static void addFileForPattern(DBRunConfigBean db, List<DBRunConfigBean> dbs) {
final String path = db.getDbPath().trim();
if(!SeekableStreamFactory.isFilePath(path) || path.indexOf("*") == -1) {
db.checkDBConfig();
dbs.add(db);
} else {
final IndexFormat format = db.getIndexFormat();
final List<String> files = IOutils.readFileWithPattern(db.getDb());
for (String file : files) {
db = new DBRunConfigBean();
db.setDb(file);
if(format != null) db.setIndexFormat(format);
else db.setDbIndex();
db.checkDBConfig();
dbs.add(db);
}
}
}
开发者ID:mulinlab,项目名称:vanno,代码行数:20,代码来源:VannoUtils.java
示例3: initStream
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
public void initStream() {
File inputFile = new File(path);
if(inputFile.exists() && inputFile.getName().toLowerCase().endsWith(IntervalIndex.PLUS_EXTENSION)) {
try {
final ISeekableStreamFactory ssf = SeekableStreamFactory.getInstance();
final SeekableStream seekableStream =
ssf.getBufferedStream(ssf.getStreamFor(inputFile.getAbsolutePath()));
BlockCompressedInputStream is = new BlockCompressedInputStream(seekableStream);
writeIndex(is);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
} else {
throw new IllegalArgumentException("plus file is needed to write a plus index.");
}
}
开发者ID:mulinlab,项目名称:vanno,代码行数:18,代码来源:BinIndexWriter.java
示例4: readBytes
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
/**
* Read the bytes between file position posStart and posEnd
*/
private byte[] readBytes(long posStart, long posEnd) throws IOException {
SeekableStream ss = null;
try {
ss = SeekableStreamFactory.getInstance().getStreamFor(path);
int nBytes = (int) (posEnd - posStart);
byte[] bytes = new byte[nBytes];
ss.seek(posStart);
ss.readFully(bytes);
return bytes;
} finally {
if (ss != null) {
ss.close();
}
}
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:20,代码来源:FastaSequenceFile.java
示例5: createStream
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
private InputStream createStream(final FileInputStream fileStream) throws IOException {
// if this looks like a block compressed file and it in fact is, we will use it
// otherwise we will use the file as is
if (!AbstractFeatureReader.hasBlockCompressedExtension(inputFile)) {
return fileStream;
}
// make a buffered stream to test that this is in fact a valid block compressed file
final int bufferSize = Math.max(Defaults.BUFFER_SIZE,
BlockCompressedStreamConstants.MAX_COMPRESSED_BLOCK_SIZE);
final BufferedInputStream bufferedStream = new BufferedInputStream(fileStream, bufferSize);
if (!BlockCompressedInputStream.isValidFile(bufferedStream)) {
throw new TribbleException.MalformedFeatureFile(
"Input file is not in valid block compressed format.", inputFile.getAbsolutePath());
}
final ISeekableStreamFactory ssf = SeekableStreamFactory.getInstance();
// if we got here, the file is valid, make a SeekableStream for the BlockCompressedInputStream
// to read from
final SeekableStream seekableStream =
ssf.getBufferedStream(ssf.getStreamFor(inputFile.getAbsolutePath()));
return new BlockCompressedInputStream(seekableStream);
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:25,代码来源:FeatureIterator.java
示例6: SweepPlusReader
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
public SweepPlusReader(final String fn, final Index idx, final String plusFn, final AbstractReaderStack stack, Printter printter) throws IOException {
super(fn, idx, stack);
plus = new BlockCompressedInputStream(SeekableStreamFactory.getInstance().getBufferedStream(SeekableStreamFactory.getInstance().getStreamFor(plusFn)));
if(stack.getResultProcessor() instanceof MyResultProcess) {
((MyResultProcess)stack.getResultProcessor()).setProcessor(this);
}
dbPrintter = printter;
}
开发者ID:mulinlab,项目名称:vanno,代码行数:10,代码来源:SweepPlusReader.java
示例7: MixPlusReader
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
public MixPlusReader(final String fn, final Index idx, final String plusFn, final AbstractReaderStack stack, Printter printter) throws IOException {
super(fn, idx, stack);
plus = new BlockCompressedInputStream(SeekableStreamFactory.getInstance().getBufferedStream(SeekableStreamFactory.getInstance().getStreamFor(plusFn)));
if(stack.getResultProcessor() instanceof MyResultProcess) {
((MyResultProcess)stack.getResultProcessor()).setProcessor(this);
}
dbPrintter = printter;
}
开发者ID:mulinlab,项目名称:vanno,代码行数:11,代码来源:MixPlusReader.java
示例8: BlockReader
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
public BlockReader(final String fn, final String idxFn, final String plusFn, final AbstractReaderStack stack, Printter printter) throws IOException {
super(fn, idxFn);
this.stack = stack;
plus = new BlockCompressedInputStream(SeekableStreamFactory.getInstance().getBufferedStream(SeekableStreamFactory.getInstance().getStreamFor(plusFn)));
if(stack.getResultProcessor() instanceof MyResultProcess) {
((MyResultProcess)stack.getResultProcessor()).setProcessor(this);
}
dbPrintter = printter;
readAllIndex();
}
开发者ID:mulinlab,项目名称:vanno,代码行数:12,代码来源:BlockReader.java
示例9: readFile
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
public void readFile() {
ISeekableStreamFactory ssf = SeekableStreamFactory.getInstance();
SeekableStream fp;
try {
fp = ssf.getBufferedStream(ssf.getStreamFor(mIdxFn), 128000);
if (fp == null) return ;
BlockCompressedInputStream is = new BlockCompressedInputStream(fp);
readFile(is);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:mulinlab,项目名称:vanno,代码行数:15,代码来源:Index.java
示例10: isExist
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
public static boolean isExist(String path) {
if(!SeekableStreamFactory.isFilePath(path)) {
return exists(path);
} else {
return new File(path).exists();
}
}
开发者ID:mulinlab,项目名称:vanno,代码行数:8,代码来源:DBRunConfigBean.java
示例11: setDbIndex
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
public void setDbIndex() {
if(!SeekableStreamFactory.isFilePath(db)) {
if(this.indexFormat == null) {
throw new IllegalArgumentException("Please set up index format for remote file.");
} else if(this.indexFormat == IndexFormat.TBI) {
this.dbIndex = this.db + TabixUtils.STANDARD_INDEX_EXTENSION;
if(!isExist(this.dbIndex))
throw new IllegalArgumentException("Index file: " + this.dbIndex + " is not find.");
} else {
this.dbIndex = this.db + BinIndexWriter.PLUS_INDEX_EXTENSION;
this.plusFile = this.db + BinIndexWriter.PLUS_EXTENSION;
if(!isExist(this.dbIndex)) throw new IllegalArgumentException("Index file: " + this.dbIndex + " is not find.");
if(!isExist(this.plusFile)) throw new IllegalArgumentException("Plus file: " + this.plusFile + " is not find.");
}
} else {
if(this.indexFormat == IndexFormat.PLUS) {
checkPlus();
} else if(this.indexFormat == IndexFormat.TBI){
checkTbi();
} else {
this.dbIndex = this.db + BinIndexWriter.PLUS_INDEX_EXTENSION;
if(!isExist(this.dbIndex)) {
this.dbIndex = this.db + TabixUtils.STANDARD_INDEX_EXTENSION;
if(!isExist(this.dbIndex)) {
throw new IllegalArgumentException("We support two types of index file. The first is the tabix index file, the second type needs plus file and plus index file both. Please put the index in the same folder with the database file!");
} else {
this.indexFormat = IndexFormat.TBI;
}
} else {
this.plusFile = this.db + BinIndexWriter.PLUS_EXTENSION;
if(!isExist(this.plusFile)) {
throw new IllegalArgumentException("We cannot find plus file: "+ this.plusFile + ", you must put plus file and plus index file in the same folder!");
} else {
this.indexFormat = IndexFormat.PLUS;
}
}
}
}
idx = IndexFactory.readIndex(dbIndex);
}
开发者ID:mulinlab,项目名称:vanno,代码行数:41,代码来源:DBRunConfigBean.java
示例12: getHeader
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
public static VCFHeader getHeader(String filePath) {
try {
return VCFHeaderReader.readHeaderFrom(SeekableStreamFactory.getInstance().getStreamFor(filePath));
} catch (IOException e) {
throw new UserException("Failed to read VCF header from " + filePath + "\n Caused by:" + e.getMessage(), e);
}
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:8,代码来源:VariantsSparkSource.java
示例13: main
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
public static void main(String[] args) {
long t1 = System.currentTimeMillis();
try {
// final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("/Users/mulin/Desktop/linlin/out.vcf")));
// String s;
// int i=0;
// while((s = reader.readLine()) != null) {
// i++;
// }
// reader.close();
// System.out.println(i);
// int core = 6;
// BZIP2InputStream bz2_text = new BZIP2InputStream("/Users/mulin/Desktop/linlin/out.vcf", core);
//
// bz2_text.adjustPos();
// bz2_text.creatSpider();
//
// Reducer<Integer, Mapper<Integer>, Integer> r = new Reducer<Integer, Mapper<Integer>, Integer>() {
// public Integer doReducer(List<Mapper<Integer>> mappers) {
// for (Mapper<Integer> mapper : mappers) {
// System.out.println(mapper.getResult());
// }
// return null;
// }
// };
//
// SimpleMapReduce mr = new SimpleMapReduce<Integer, Integer>(core, r);
// Spider spider;
// for (int i = 0; i < core; i++) {
// spider = bz2_text.spider[i];
// mr.addMapper(new TestMapper<Integer>(spider));
// }
// mr.getResult();
//
//
// long t2 = System.currentTimeMillis();
//
// System.out.println("Time:" + (t2 - t1));
// System.out.println(Runtime.getRuntime().availableProcessors());
BlockCompressedInputStream plus = new BlockCompressedInputStream(SeekableStreamFactory.getInstance().getBufferedStream(SeekableStreamFactory.getInstance().getStreamFor("/Users/mulin/Desktop/dbNSFP3.0a.ANN.bgz.plus")));
int tid;
while(true) {
tid = BasicUtils.readInt(plus); if(tid == IntervalIndex.PLUS_FILE_END) break;
BasicUtils.readInt(plus);
BasicUtils.readInt(plus);
System.out.println(BasicUtils.readLong(plus));
}
long t2 = System.currentTimeMillis();
System.out.println("Time:" + (t2 - t1));
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:mulinlab,项目名称:vanno,代码行数:63,代码来源:TestSpider.java
示例14: TabixReaderMod
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
/**
* @param fn File name of the data file
*/
public TabixReaderMod(final String fn) throws IOException {
this(fn, null, SeekableStreamFactory.getInstance().getBufferedStream(SeekableStreamFactory.getInstance().getStreamFor(fn)));
}
开发者ID:rkataine,项目名称:BasePlayer,代码行数:7,代码来源:TabixReaderMod.java
示例15: readIndex
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
/**
* Read the Tabix index from the default file.
*/
private void readIndex() throws IOException {
ISeekableStreamFactory ssf = SeekableStreamFactory.getInstance();
readIndex(ssf.getBufferedStream(ssf.getStreamFor(mIdxFn), 128000));
}
开发者ID:rkataine,项目名称:BasePlayer,代码行数:8,代码来源:TabixReaderMod.java
示例16: BBFileReader
import htsjdk.samtools.seekablestream.SeekableStreamFactory; //导入依赖的package包/类
public BBFileReader(String path, BedTrack track) throws IOException {
this(path, SeekableStreamFactory.getInstance().getStreamFor(path), track);
}
开发者ID:rkataine,项目名称:BasePlayer,代码行数:6,代码来源:BBFileReader.java
注:本文中的htsjdk.samtools.seekablestream.SeekableStreamFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论