本文整理汇总了Java中htsjdk.tribble.FeatureCodecHeader类的典型用法代码示例。如果您正苦于以下问题:Java FeatureCodecHeader类的具体用法?Java FeatureCodecHeader怎么用?Java FeatureCodecHeader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FeatureCodecHeader类属于htsjdk.tribble包,在下文中一共展示了FeatureCodecHeader类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: readSingleHeader
import htsjdk.tribble.FeatureCodecHeader; //导入依赖的package包/类
public void readSingleHeader(Path vcfPath, Configuration conf) throws IOException {
FileSystem fs = vcfPath.getFileSystem(conf);
if(!fs.exists(vcfPath))
throw new RuntimeException(vcfPath.toString() + " don't exists.");
if(!fs.isFile(vcfPath)) {
throw new RuntimeException(vcfPath.toString() + " is not a file. GaeaSingleVcfHeader parser only support one vcf file.");
}
FSDataInputStream in = fs.open(vcfPath);
AsciiLineReaderIterator it = new AsciiLineReaderIterator(new AsciiLineReader(in));
VCFCodec codec = new VCFCodec();
Object header = codec.readHeader(it);
vcfHeader = (VCFHeader)(((FeatureCodecHeader)header).getHeaderValue());
sampleNames.addAll(vcfHeader.getGenotypeSamples());
buildHeaderInfo();
it.close();
}
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:17,代码来源:SingleVCFHeader.java
示例2: VCFRecordWriter
import htsjdk.tribble.FeatureCodecHeader; //导入依赖的package包/类
/** A VCFHeader is read from the input Path. */
public VCFRecordWriter(
Path output, Path input, boolean writeHeader, TaskAttemptContext ctx)
throws IOException
{
final AsciiLineReader r = new AsciiLineReader(
input.getFileSystem(ctx.getConfiguration()).open(input));
final FeatureCodecHeader h = codec.readHeader(new AsciiLineReaderIterator(r));
if (h == null || !(h.getHeaderValue() instanceof VCFHeader))
throw new IOException("No VCF header found in "+ input);
r.close();
init(output, (VCFHeader) h.getHeaderValue(), writeHeader, ctx);
}
开发者ID:HadoopGenomics,项目名称:Hadoop-BAM,代码行数:17,代码来源:VCFRecordWriter.java
示例3: FeatureIterator
import htsjdk.tribble.FeatureCodecHeader; //导入依赖的package包/类
/**
* @param inputFile The file from which to read. Stream for reading is opened on construction.
* @param codec feature codec, of features, that iterator should handle
*/
public FeatureIterator(final File inputFile, final FeatureCodec<T, S> codec) {
this.codec = codec;
this.inputFile = inputFile;
final FeatureCodecHeader header = readHeader();
source = (S) codec.makeIndexableSourceFromStream(initStream(inputFile, header.getHeaderEnd()));
readNextFeature();
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:12,代码来源:FeatureIterator.java
示例4: readHeader
import htsjdk.tribble.FeatureCodecHeader; //导入依赖的package包/类
/**
* Some codecs, e.g. VCF files, need the header to decode features. This is a rather poor design,
* the internal header is set as a side-affect of reading it, but we have to live with it for now.
*/
private FeatureCodecHeader readHeader() {
try {
final S sourceFromStream = this.codec.makeSourceFromStream(initStream(inputFile, 0));
final FeatureCodecHeader header = this.codec.readHeader(sourceFromStream);
codec.close(sourceFromStream);
return header;
} catch (IOException e) {
LOGGER.error(MessageHelper.getMessage(MessagesConstants.ERROR_FILE_HEADER_READING), e);
throw new TribbleException.InvalidHeader(e.getMessage());
}
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:16,代码来源:FeatureIterator.java
示例5: FeatureIterator
import htsjdk.tribble.FeatureCodecHeader; //导入依赖的package包/类
/**
* @param inputFile The file from which to read. Stream for reading is opened on construction.
* @param codec
*/
public FeatureIterator(final File inputFile, final FeatureCodec<F, S> codec) {
this.codec = codec;
this.inputFile = inputFile;
final FeatureCodecHeader header = readHeader();
source =
(S) makeIndexableSourceFromStream(initStream(inputFile, header.getHeaderEnd()));
readNextFeature();
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:13,代码来源:IndexUtils.java
示例6: readHeader
import htsjdk.tribble.FeatureCodecHeader; //导入依赖的package包/类
/**
* Some codecs, e.g. VCF files, need the header to decode features. This is a rather poor design,
* the internal header is set as a side-affect of reading it, but we have to live with it for now.
*/
private FeatureCodecHeader readHeader() {
try {
final S headerSource = this.codec.makeSourceFromStream(initStream(inputFile, 0));
final FeatureCodecHeader header = this.codec.readHeader(headerSource);
codec.close(headerSource);
return header;
} catch (final IOException e) {
throw new IndexException(e.getMessage(), e);
}
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:15,代码来源:IndexUtils.java
示例7: readHeader
import htsjdk.tribble.FeatureCodecHeader; //导入依赖的package包/类
@Override
public FeatureCodecHeader readHeader(final B b) throws IOException {
if (delegatee == null) {
throw new IllegalStateException("this codec cannot be used without a delegatee.");
}
return delegatee.readHeader(b);
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:8,代码来源:ProgressReportingDelegatingCodec.java
示例8: run
import htsjdk.tribble.FeatureCodecHeader; //导入依赖的package包/类
@Override
public int run(String[] args) throws Exception {
BioJob job = BioJob.getInstance();
Configuration conf = job.getConfiguration();
conf.setBoolean(GaeaVCFOutputFormat.HEADER_MODIFY, true);
String[] remainArgs = remainArgs(args, conf);
options = new VCFQualityControlOptions();
options.parse(remainArgs);
options.setHadoopConf(remainArgs, conf);
//merge header
vcfHeaders = new MultipleVCFHeader();
vcfHeaders.mergeHeader(new Path(options.getInputs()), options.getOutputPath(), job, false);
if(options.isRecal()) {
// vqsr
job.setJobName("Gaea variant quality score recalibration");
job.setJarByClass(VCFQualityControl.class);
job.setMapperClass(VariantRecalibrationMapper.class);
job.setReducerClass(VariantRecalibrationReducer.class);
job.setOutputKeyValue(IntWritable.class, Text.class,
NullWritable.class, VariantContextWritable.class);
job.setNumReduceTasks(vcfHeaders.getFileNum());
FileInputFormat.addInputPaths(job, options.getInputs());
job.setInputFormatClass(VCFMultipleInputFormat.class);
Path statistics = new Path(options.getOutputPath() + "/tmp");
//job.setOutputFormatClass(VariantRecalibrationOutputFormat.class);
job.setOutputFormatClass(GaeaVCFOutputFormat.class);
FileOutputFormat.setOutputPath(job, statistics);
return job.waitForCompletion(true) ? 0 : 1;
} else {
// hard filter
HardFilter fe = new HardFilter(options.getFilterName(), options.getSnpFilter(), options.getIndelFilter());
for(Path vcfPath : options.getInputFiles()) {
AsciiLineReaderIterator iterator = new AsciiLineReaderIterator(new AsciiLineReader(HdfsFileManager.getInputStream(vcfPath, conf)));
VCFCodec codec = new VCFCodec();
VCFHeader vHeader = (VCFHeader)(((FeatureCodecHeader)codec.readHeader(iterator)).getHeaderValue());
String output = options.getOutputPath() + vcfPath.toString();
for(VCFHeaderLine headerLine : fe.filterHeaders())
vHeader.addMetaDataLine(headerLine);
VCFHdfsWriter writer = new VCFHdfsWriter(output, false, false, conf);
writer.writeHeader(vHeader);
ReportDatum report = null;
while(iterator.hasNext()){
VariantContext vc = codec.decode(iterator.next());
vc = fe.filter(vc);
ReportDatum datum = new ReportDatum.Builder(vc).isSnp().isIndel().isTransition().build();
if(report == null)
report = datum;
else
report.combine(datum);
writer.add(vc);
}
}
return 1;
}
}
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:65,代码来源:VCFQualityControl.java
示例9: readHeader
import htsjdk.tribble.FeatureCodecHeader; //导入依赖的package包/类
@Override
public FeatureCodecHeader readHeader(PositionalBufferedStream stream) throws IOException {
return this.wrappedCodec.readHeader(stream);
}
开发者ID:hyounesy,项目名称:ALEA,代码行数:5,代码来源:BCF2WrapperCodec.java
示例10: readHeader
import htsjdk.tribble.FeatureCodecHeader; //导入依赖的package包/类
@Override
public FeatureCodecHeader readHeader(EmblTableIterator o) throws IOException {
return null;
}
开发者ID:hyounesy,项目名称:ALEA,代码行数:5,代码来源:EMBLTableCodec.java
示例11: readHeader
import htsjdk.tribble.FeatureCodecHeader; //导入依赖的package包/类
@Override
public FeatureCodecHeader readHeader(final LineIterator lineIterator) throws IOException {
return new FeatureCodecHeader(readActualHeader(lineIterator), FeatureCodecHeader.NO_HEADER_END);
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:5,代码来源:GencodeGtfCodec.java
注:本文中的htsjdk.tribble.FeatureCodecHeader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论