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


Java VCFHeaderLine类代码示例

本文整理汇总了Java中htsjdk.variant.vcf.VCFHeaderLine的典型用法代码示例。如果您正苦于以下问题:Java VCFHeaderLine类的具体用法?Java VCFHeaderLine怎么用?Java VCFHeaderLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VCFHeaderLine类属于htsjdk.variant.vcf包,在下文中一共展示了VCFHeaderLine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
@Override
public void initialize(final AnnotatorCompatible walker, final GenomeLocParser parser, final Set<VCFHeaderLine> headerLines) {
    boolean hasSBBSannotation = false;
    for (final VCFHeaderLine line : headerLines) {
        if (line instanceof VCFFormatHeaderLine) {
            final VCFFormatHeaderLine formatline = (VCFFormatHeaderLine) line;
            if (formatline.getID().equals(StrandBiasBySample.STRAND_BIAS_BY_SAMPLE_KEY_NAME)) {
                hasSBBSannotation = true;
                break;
            }
        }
    }

    if (hasSBBSannotation) {
        logger.info("StrandBiasBySample annotation exists in input VCF header. Attempting to use StrandBiasBySample " +
                "values to calculate strand bias annotation values. If no sample has the SB genotype annotation, annotation may still fail.");
        return;
    }

}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:21,代码来源:StrandBiasTest.java

示例2: onTraversalStart

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
@Override
public void onTraversalStart() {
    final VCFHeader inputHeader = getHeaderForVariants();
    final Set<VCFHeaderLine> headerLines = new HashSet<>(inputHeader.getMetaDataInSortedOrder());
    headerLines.add(new VCFInfoHeaderLine(EXPECTED_ALLELE_FRACTION_NAME, 1, VCFHeaderLineType.Float, "expected allele fraction in pooled bam"));
    final VCFHeader vcfHeader = new VCFHeader(headerLines, inputHeader.getGenotypeSamples());
    headerLines.addAll(getDefaultToolVCFHeaderLines());
    vcfWriter = createVCFWriter(outputVcf);
    vcfWriter.writeHeader(vcfHeader);

    final List<MixingFraction> mixingFractionsList = MixingFraction.readMixingFractions(inputMixingFractions);
    final Map<String, Double> mixingfractionsMap = mixingFractionsList.stream()
            .collect(Collectors.toMap(MixingFraction::getSample, MixingFraction::getMixingFraction));
    mixingFractionsInSampleOrder = inputHeader.getSampleNamesInOrder().stream()
            .mapToDouble(mixingfractionsMap::get).toArray();
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:17,代码来源:AnnotateVcfWithExpectedAlleleFraction.java

示例3: onTraversalStart

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
@Override
public void onTraversalStart() {
    final VCFHeader inputHeader = getHeaderForVariants();
    final Set<VCFHeaderLine> headerLines = new HashSet<>(inputHeader.getMetaDataInSortedOrder());
    Mutect2FilteringEngine.M_2_FILTER_NAMES.stream().map(GATKVCFHeaderLines::getFilterLine).forEach(headerLines::add);
    headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.ARTIFACT_IN_NORMAL_FILTER_NAME, "artifact_in_normal"));
    headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.MEDIAN_BASE_QUALITY_DIFFERENCE_FILTER_NAME, "ref - alt median base quality"));
    headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.MEDIAN_MAPPING_QUALITY_DIFFERENCE_FILTER_NAME, "ref - alt median mapping quality"));
    headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.MEDIAN_CLIPPING_DIFFERENCE_FILTER_NAME, "ref - alt median clipping"));
    headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.MEDIAN_FRAGMENT_LENGTH_DIFFERENCE_FILTER_NAME, "abs(ref - alt) median fragment length"));
    headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.READ_POSITION_FILTER_NAME, "median distance of alt variants from end of reads"));
    headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.CONTAMINATION_FILTER_NAME, "contamination"));
    headerLines.addAll(getDefaultToolVCFHeaderLines());
    final VCFHeader vcfHeader = new VCFHeader(headerLines, inputHeader.getGenotypeSamples());
    vcfWriter = createVCFWriter(new File(outputVcf));
    vcfWriter.writeHeader(vcfHeader);
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:18,代码来源:FilterMutectCalls.java

示例4: configureHeaders

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
public static void configureHeaders(Configuration conf, Path[] vcfs, String sampleGroup)
    throws IOException {
  List<VCFHeader> headers = new ArrayList<>();
  for (Path vcf : vcfs) {
    InputStream inputStream = vcf.getFileSystem(conf).open(vcf);
    VcfBlockIterator iterator = new VcfBlockIterator(inputStream, new FullVcfCodec());
    VCFHeader header = iterator.getHeader();
    header.addMetaDataLine(new VCFHeaderLine(VARIANT_SET_ID, vcf.getName()));
    headers.add(header);
  }
  VCFHeader[] headersArray = headers.toArray(new VCFHeader[headers.size()]);
  conf.set(VARIANT_HEADERS,
      Base64.encodeBase64String(SerializationUtils.serialize(headersArray)));
  if (sampleGroup != null) {
    conf.set(SAMPLE_GROUP, sampleGroup);
  }
}
 
开发者ID:cloudera,项目名称:quince,代码行数:18,代码来源:VCFToGA4GHVariantFn.java

示例5: createVCFHeaderLineList

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
/**
 * Prepare the VCF header lines
 */
private Set<VCFHeaderLine> createVCFHeaderLineList(Map<String, VCFHeader> vcfHeaders) {

    final Set<VCFHeaderLine> headerLines = VCFUtils.smartMergeHeaders(vcfHeaders.values(), true);
    headerLines.addAll(getDefaultToolVCFHeaderLines());

    // need AC, AN and AF since output if set filtered genotypes to no-call
    if (setFilteredGenotypesToNocall) {
        GATKVariantContextUtils.addChromosomeCountsToHeader(headerLines);
    }

    if (keepOriginalChrCounts) {
        headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.ORIGINAL_AC_KEY));
        headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.ORIGINAL_AF_KEY));
        headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.ORIGINAL_AN_KEY));
    }
    if (keepOriginalDepth) {
        headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.ORIGINAL_DP_KEY));
    }

    headerLines.addAll(Arrays.asList(ChromosomeCounts.descriptions));
    headerLines.add(VCFStandardHeaderLines.getInfoLine(VCFConstants.DEPTH_KEY));

    return headerLines;
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:28,代码来源:SelectVariants.java

示例6: getVCFWriter

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
private VariantContextWriter getVCFWriter() {
    final SortedSet<String> samples = getSamplesForVariants();

    final VCFHeader inputVCFHeader = new VCFHeader(getHeaderForVariants().getMetaDataInInputOrder(), samples);

    final Set<VCFHeaderLine> headerLines = new LinkedHashSet<>(inputVCFHeader.getMetaDataInInputOrder());
    headerLines.addAll(getDefaultToolVCFHeaderLines());

    headerLines.addAll(annotationEngine.getVCFAnnotationDescriptions());

    // add headers for annotations added by this tool
    headerLines.add(VCFStandardHeaderLines.getInfoLine(VCFConstants.DEPTH_KEY));   // needed for gVCFs without DP tags
    if ( dbsnp.dbsnp != null  ) {
        VCFStandardHeaderLines.addStandardInfoLines(headerLines, true, VCFConstants.DBSNP_KEY);
    }

    VariantContextWriter writer = createVCFWriter(outputFile);

    final Set<String> sampleNameSet = new IndexedSampleList(samples).asSetOfSamples();
    final VCFHeader vcfHeader = new VCFHeader(headerLines, new TreeSet<>(sampleNameSet));
    writer.writeHeader(vcfHeader);

    return writer;
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:25,代码来源:CombineGVCFs.java

示例7: onTraversalStart

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
@Override
public void onTraversalStart() {
    final VCFHeader inputHeader = getHeaderForVariants();
    final Set<VCFHeaderLine> headerLines = inputHeader.getMetaDataInSortedOrder().stream()
            .filter(line -> !line.getKey().equals(Mutect2FilteringEngine.FILTERING_STATUS_VCF_KEY)) //remove header line from Mutect2 stating that calls are unfiltered.
            .collect(Collectors.toSet());
    headerLines.add(new VCFHeaderLine(Mutect2FilteringEngine.FILTERING_STATUS_VCF_KEY, "These calls have been filtered by " + FilterMutectCalls.class.getSimpleName() + " to label false positives with a list of failed filters and true positives with PASS."));

    GATKVCFConstants.MUTECT_FILTER_NAMES.stream().map(GATKVCFHeaderLines::getFilterLine).forEach(headerLines::add);

    headerLines.addAll(getDefaultToolVCFHeaderLines());

    final VCFHeader vcfHeader = new VCFHeader(headerLines, inputHeader.getGenotypeSamples());
    vcfWriter = createVCFWriter(new File(outputVcf));
    vcfWriter.writeHeader(vcfHeader);

    final String tumorSample = getHeaderForVariants().getMetaDataLine(Mutect2Engine.TUMOR_SAMPLE_KEY_IN_VCF_HEADER).getValue();
    filteringEngine = new Mutect2FilteringEngine(MTFAC, tumorSample);
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:20,代码来源:FilterMutectCalls.java

示例8: testGetDefaultToolVCFHeaderLines

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
@Test
public void testGetDefaultToolVCFHeaderLines() throws IOException {
    final TestGATKToolWithFeatures tool = new TestGATKToolWithFeatures();
    final File vcfFile = new File(publicTestDir + "org/broadinstitute/hellbender/engine/feature_data_source_test_with_bigHeader.vcf");
    final String[] args = {"--mask", vcfFile.getCanonicalPath(), "--" + StandardArgumentDefinitions.ADD_OUTPUT_VCF_COMMANDLINE, "true"};
    tool.instanceMain(args);

    Set<VCFHeaderLine> stdHeaderLines = tool.getDefaultToolVCFHeaderLines();
    VCFHeader hdr = new VCFHeader(stdHeaderLines);

    VCFHeaderLine sourceLine = hdr.getOtherHeaderLine("source");
    Assert.assertEquals(sourceLine.getValue(), tool.getClass().getSimpleName());

    VCFIDHeaderLine commandLine = (VCFIDHeaderLine) hdr.getOtherHeaderLine("GATKCommandLine");
    Assert.assertEquals(commandLine.getID(), tool.getClass().getSimpleName());

    String commandLineString = commandLine.toString();
    assertContains(commandLineString,"CommandLine=");
    assertContains(commandLineString,"Version=");
    assertContains(commandLineString,"Date=");
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:22,代码来源:GATKToolUnitTest.java

示例9: getMinimalVCFHeader

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
private static VCFHeader getMinimalVCFHeader() {
    final Set<VCFHeaderLine> headerlines = new LinkedHashSet<>();
    VCFStandardHeaderLines.addStandardFormatLines(headerlines, true,
            VCFConstants.GENOTYPE_KEY, VCFConstants.DEPTH_KEY,
            VCFConstants.GENOTYPE_QUALITY_KEY, VCFConstants.GENOTYPE_PL_KEY,
            VCFConstants.GENOTYPE_ALLELE_DEPTHS);

    VCFStandardHeaderLines.addStandardInfoLines(headerlines, true,
            VCFConstants.DEPTH_KEY,
            VCFConstants.RMS_MAPPING_QUALITY_KEY,
            VCFConstants.MAPPING_QUALITY_ZERO_KEY );

    Arrays.asList(GATKVCFConstants.BASE_QUAL_RANK_SUM_KEY,
           GATKVCFConstants.CLIPPING_RANK_SUM_KEY,
           GATKVCFConstants.MLE_ALLELE_COUNT_KEY,
           GATKVCFConstants.MLE_ALLELE_FREQUENCY_KEY,
           GATKVCFConstants.MAP_QUAL_RANK_SUM_KEY,
           GATKVCFConstants.READ_POS_RANK_SUM_KEY)
           .forEach( c -> headerlines.add(GATKVCFHeaderLines.getInfoLine(c)));

    headerlines.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.STRAND_BIAS_BY_SAMPLE_KEY));
    return new VCFHeader(headerlines, Collections.singleton(SAMPLE_NAME));
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:24,代码来源:GVCFWriterUnitTest.java

示例10: openVariantContextWriter

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
/**
 * Return a new {@link VariantContextWriter} that uses the header from <code>reader</code> but has the header
 * extended header through {@link #extendHeaderFields}.
 *
 * @param header
 *            the VCF header to use for the construction
 * @param fileName
 *            path to output file
 * @param additionalHeaderLines
 *            additional {@link VCFHeaderLine}s to add
 * @param generateIndex
 *            whether or not to generate an index
 * @return A correct writer for variantContexts
 */
public static VariantContextWriter openVariantContextWriter(VCFHeader header, String fileName,
		Collection<VCFHeaderLine> additionalHeaderLines, boolean generateIndex) {
	VariantContextWriterBuilder builder = makeBuilder(header);
	builder.setOutputFile(new File(fileName));
	if (!generateIndex)
		builder.unsetOption(Options.INDEX_ON_THE_FLY);

	// construct VariantContextWriter and write out header
	VariantContextWriter out = builder.build();
	final VCFHeader updatedHeader = extendHeaderFields(new VCFHeader(header));
	for (VCFHeaderLine headerLine : additionalHeaderLines)
		updatedHeader.addMetaDataLine(headerLine);
	out.writeHeader(updatedHeader);
	return out;
}
 
开发者ID:charite,项目名称:jannovar,代码行数:30,代码来源:VariantContextWriterConstructionHelper.java

示例11: open

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
public void open(final VCFHeader src)
{	
	
final File fileout=getFile();
LOG.info("opening VCF file \""+fileout+"\" for writing");
final File parent=fileout.getParentFile();
if(parent!=null) {
	parent.mkdirs();
}
	
this.header= new VCFHeader(src);
this.header.addMetaDataLine(new VCFHeaderLine("ForkVcf.GroupId", String.valueOf(this.groupId)));
try {
	this._writer = VCFUtils.createVariantContextWriter(fileout);
} catch (IOException e) {
	throw new RuntimeIOException(e);
}
this._writer.writeHeader(this.header);
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:20,代码来源:ForkVcf.java

示例12: open

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
public void open(final VCFHeader src)
{	
	
final File fileout=getFile();
LOG.info("opening VCF file \""+fileout+"\" for writing");
final File parent=fileout.getParentFile();
if(parent!=null) {
	parent.mkdirs();
}
	
this.header= new VCFHeader(src);
this.header.addMetaDataLine(new VCFHeaderLine("SplitVcf.GroupName", this.groupName));
try {
	this._writer = VCFUtils.createVariantContextWriter(fileout);
} catch (IOException e) {
	throw new RuntimeIOException(e);
}
this._writer.writeHeader(this.header);
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:20,代码来源:SplitVcf.java

示例13: extractSampleNames

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
/** general utility for program using VCFMulti2One:
 *  Extract SampleNames
 */
static Set<String> extractSampleNames(final VCFHeader header)
	{
	final List<String> sample_list =header.getSampleNamesInOrder();
	if(sample_list.size()!=1 || !sample_list.get(0).equals(DEFAULT_VCF_SAMPLE_NAME))
		{
		throw new IllegalArgumentException("Not a VCF produced by VcfMultiToOne");
		}
	final Set<String> samples = new TreeSet<String>();
	for(final VCFHeaderLine h:header.getMetaDataInInputOrder())
		{
		if(h.getKey().equals(SAMPLE_HEADER_DECLARATION))
			{
			sample_list.add(h.getValue());
			}
		}
	return samples;
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:21,代码来源:VcfMultiToOne.java

示例14: toVCFHeaderLines

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
public Set<VCFHeaderLine> toVCFHeaderLines()  {
final Set<VCFHeaderLine> set = new LinkedHashSet<>();
for(final Family f:families.values())
	{
	for(final Person p:f.getIndividuals()) {
		final StringBuilder sb=new StringBuilder();
		sb.append("<Family=");
		sb.append(f.getId());
		sb.append(",ID=");
		sb.append(p.getId());
		sb.append(",Father=");
		sb.append(p.getFather()==null?"0":p.getFather().getId());
		sb.append(",Mother=");
		sb.append(p.getMother()==null?"0":p.getMother().getId());
		sb.append(",Sex=");
		sb.append(p.getSex().intValue());
		sb.append(",Status=");
		sb.append(p.getStatus().intValue());
		sb.append(">");
		set.add(new VCFHeaderLine(VcfHeaderKey, sb.toString()));
		}
	}

return set;
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:26,代码来源:Pedigree.java

示例15: getVCFHeaderLines

import htsjdk.variant.vcf.VCFHeaderLine; //导入依赖的package包/类
/**
 * Get the VCF header lines to include when emitting reference confidence values via calculateRefConfidence
 * @return a non-null set of VCFHeaderLines
 */
public Set<VCFHeaderLine> getVCFHeaderLines() {
    final Set<VCFHeaderLine> headerLines = new LinkedHashSet<>();
    // TODO - do we need a new kind of VCF Header subclass for specifying arbitrary alternate alleles?
    headerLines.add(new VCFSimpleHeaderLine(ALTERNATE_ALLELE_STRING, GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE_NAME, "Represents any possible alternative allele at this location"));
    //headerLines.add(new VCFFormatHeaderLine(INDEL_INFORMATIVE_DEPTH, 1, VCFHeaderLineType.Integer, "Number of reads at locus that are informative about an indel of size <= " + indelInformativeDepthIndelSize));
    return headerLines;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:12,代码来源:ReferenceConfidenceModel.java


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