本文整理汇总了Java中htsjdk.variant.vcf.VCFCodec.readActualHeader方法的典型用法代码示例。如果您正苦于以下问题:Java VCFCodec.readActualHeader方法的具体用法?Java VCFCodec.readActualHeader怎么用?Java VCFCodec.readActualHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.variant.vcf.VCFCodec
的用法示例。
在下文中一共展示了VCFCodec.readActualHeader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RODContentProvider
import htsjdk.variant.vcf.VCFCodec; //导入方法依赖的package包/类
public RODContentProvider(String name, VcfRecordPartition partition, GenomeLocParser genomeLocParser) {
this.name = name;
VCFCodec codec = new VCFCodec();
VCFHeaderLineIterable headerLineIterable = new VCFHeaderLineIterable(partition.vcfHeader());
vcfFileHeader = (VCFHeader) codec.readActualHeader(headerLineIterable);
ArrayList<VariantContext> vcfRecords = new ArrayList<>();
CollectionConverter.asJavaList(partition.records())
.forEach(record -> vcfRecords.add(codec.decode(record.toString())));
//为vcfRecord进行排序
Collections.sort(vcfRecords,
(record1, record2) -> record1.getStart() - record2.getStart());
vcfRecords.forEach(context ->
features.add(new GATKFeature.TribbleGATKFeature(genomeLocParser, context, name)));
}
示例2: getStaticDataInstance
import htsjdk.variant.vcf.VCFCodec; //导入方法依赖的package包/类
public static StaticData getStaticDataInstance(RefContigInfo refContigInfo,
boolean useGVCF,
SamHeaderInfo samHeaderInfo,
VcfHeaderInfo vcfHeaderInfo) {
StaticData data = new StaticData();
SAMSequenceDictionary samSequenceDictionary = SAMSequenceDictTransfer.transfer(refContigInfo);
data.genomeLocParser = new GenomeLocParser(samSequenceDictionary);
samHeaderInfo.addReadGroupInfo(ReadGroupInfo.apply("rg1", "sample1"));
SAMFileHeader header = SAMHeaderTransfer.transfer(samHeaderInfo);
List<SAMReadGroupRecord> readGroupInfos = header.getReadGroups();
List<String> samples = new ArrayList<>();
for (SAMReadGroupRecord readGroup : readGroupInfos) {
samples.add(readGroup.getSample());
}
data.haplotypeCaller = new HaplotypeCaller(data.genomeLocParser, samples, useGVCF);
data.basic2SAMRecordTransfer = new Basic2SAMRecordTransfer(header);
VCFCodec codec = new VCFCodec();
VCFHeaderLineIterable headerLineIterable = new VCFHeaderLineIterable(vcfHeaderInfo);
data.vcfFileHeader = (VCFHeader) codec.readActualHeader(headerLineIterable);
data.codec = codec;
return data;
}
示例3: createIndex
import htsjdk.variant.vcf.VCFCodec; //导入方法依赖的package包/类
private static Index createIndex(InputStream is) throws IOException {
TabixIndexCreator ctor = new TabixIndexCreator(TabixFormat.VCF);
VCFCodec codec = new VCFCodec();
VariantContext lastContext = null;
VariantContext currentContext;
final Map<String, VariantContext> visitedChromos = new HashMap<String, VariantContext>();
AsciiLineReader lineReader = new AsciiLineReader(is);
AsciiLineReaderIterator iterator = new AsciiLineReaderIterator(lineReader);
codec.readActualHeader(iterator);
while (iterator.hasNext()) {
final long position = iterator.getPosition();
currentContext = codec.decode(iterator.next());
checkSorted(lastContext, currentContext);
//should only visit chromosomes once
final String curChr = currentContext.getChr();
final String lastChr = lastContext != null ? lastContext.getChr() : null;
if(!curChr.equals(lastChr)){
if(visitedChromos.containsKey(curChr)){
throw new RuntimeException("Input file must have contiguous chromosomes.");
}else{
visitedChromos.put(curChr, currentContext);
}
}
ctor.addFeature(currentContext, position);
lastContext = currentContext;
}
iterator.close();
return ctor.finalizeIndex(iterator.getPosition());
}
示例4: VcfRecord2VCTransfer
import htsjdk.variant.vcf.VCFCodec; //导入方法依赖的package包/类
public VcfRecord2VCTransfer(VcfHeaderInfo vcfHeaderInfo) {
VCFCodec codec = new VCFCodec();
VCFHeaderLineIterable headerLineIterable = new VCFHeaderLineIterable(vcfHeaderInfo);
vcfFileHeader = (VCFHeader) codec.readActualHeader(headerLineIterable);
}