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


Java VCFCodec.readActualHeader方法代码示例

本文整理汇总了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)));
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:18,代码来源:RODContentProvider.java

示例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;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:24,代码来源:HaplotypeCallerAdapter.java

示例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());
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:34,代码来源:IndexCreator.java

示例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);
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:6,代码来源:VcfRecord2VCTransfer.java


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