Search in sources :

Example 16 with VCFHeaderLine

use of htsjdk.variant.vcf.VCFHeaderLine in project gatk by broadinstitute.

the class VcfUtilsUnitTest method createHeaderLines.

private Set<VCFHeaderLine> createHeaderLines() {
    Set<VCFHeaderLine> headerLines = new HashSet<>(2);
    headerLines.add(new VCFContigHeaderLine("##contig=<ID=1,length=249250621,assembly=b37>", vcfHeaderVersion, "", 0));
    headerLines.add(new VCFContigHeaderLine("##contig=<ID=2,length=249250622,assembly=b37>", vcfHeaderVersion, "", 0));
    return headerLines;
}
Also used : VCFHeaderLine(htsjdk.variant.vcf.VCFHeaderLine) VCFContigHeaderLine(htsjdk.variant.vcf.VCFContigHeaderLine)

Example 17 with VCFHeaderLine

use of htsjdk.variant.vcf.VCFHeaderLine in project gatk-protected by broadinstitute.

the class ReferenceConfidenceModelUnitTest method testGetHeaderLines.

@Test
public void testGetHeaderLines() throws Exception {
    final Set<VCFHeaderLine> vcfHeaderLines = model.getVCFHeaderLines();
    Assert.assertEquals(vcfHeaderLines.size(), 1);
    Assert.assertEquals(vcfHeaderLines.iterator().next(), new VCFSimpleHeaderLine(GATKVCFConstants.SYMBOLIC_ALLELE_DEFINITION_HEADER_TAG, GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE_NAME, "Represents any possible alternative allele at this location"));
}
Also used : VCFHeaderLine(htsjdk.variant.vcf.VCFHeaderLine) VCFSimpleHeaderLine(htsjdk.variant.vcf.VCFSimpleHeaderLine) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 18 with VCFHeaderLine

use of htsjdk.variant.vcf.VCFHeaderLine in project gatk by broadinstitute.

the class Concordance method onTraversalStart.

@Override
public void onTraversalStart() {
    Set<VCFHeaderLine> defaultToolHeaderLines = getDefaultToolVCFHeaderLines();
    for (final ConcordanceState state : ConcordanceState.values()) {
        snpCounts.put(state, new MutableLong(0));
        indelCounts.put(state, new MutableLong(0));
    }
    if (truePositivesAndFalseNegativesVcf != null) {
        truePositivesAndFalseNegativesVcfWriter = createVCFWriter(truePositivesAndFalseNegativesVcf);
        final VCFHeader truthHeader = getTruthHeader();
        truthHeader.addMetaDataLine(TRUTH_STATUS_HEADER_LINE);
        defaultToolHeaderLines.forEach(truthHeader::addMetaDataLine);
        truePositivesAndFalseNegativesVcfWriter.writeHeader(truthHeader);
    }
    if (truePositivesAndFalsePositivesVcf != null) {
        truePositivesAndFalsePositivesVcfWriter = createVCFWriter(truePositivesAndFalsePositivesVcf);
        final VCFHeader evalHeader = getEvalHeader();
        defaultToolHeaderLines.forEach(evalHeader::addMetaDataLine);
        evalHeader.addMetaDataLine(TRUTH_STATUS_HEADER_LINE);
        truePositivesAndFalsePositivesVcfWriter.writeHeader(evalHeader);
    }
    if (filteredTrueNegativesAndFalseNegativesVcf != null) {
        filteredTrueNegativesAndFalseNegativesVcfWriter = createVCFWriter(filteredTrueNegativesAndFalseNegativesVcf);
        final VCFHeader evalHeader = getEvalHeader();
        evalHeader.addMetaDataLine(TRUTH_STATUS_HEADER_LINE);
        defaultToolHeaderLines.forEach(evalHeader::addMetaDataLine);
        filteredTrueNegativesAndFalseNegativesVcfWriter.writeHeader(evalHeader);
    }
}
Also used : VCFHeaderLine(htsjdk.variant.vcf.VCFHeaderLine) MutableLong(org.apache.commons.lang.mutable.MutableLong) VCFHeader(htsjdk.variant.vcf.VCFHeader)

Example 19 with VCFHeaderLine

use of htsjdk.variant.vcf.VCFHeaderLine in project gatk by broadinstitute.

the class AnnotateVcfWithExpectedAlleleFraction method onTraversalStart.

@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();
}
Also used : VCFHeaderLine(htsjdk.variant.vcf.VCFHeaderLine) VCFHeader(htsjdk.variant.vcf.VCFHeader) VCFInfoHeaderLine(htsjdk.variant.vcf.VCFInfoHeaderLine) HashSet(java.util.HashSet)

Aggregations

VCFHeaderLine (htsjdk.variant.vcf.VCFHeaderLine)19 VCFHeader (htsjdk.variant.vcf.VCFHeader)11 VCFSimpleHeaderLine (htsjdk.variant.vcf.VCFSimpleHeaderLine)5 File (java.io.File)5 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)4 Test (org.testng.annotations.Test)4 VCFContigHeaderLine (htsjdk.variant.vcf.VCFContigHeaderLine)3 HashSet (java.util.HashSet)3 SAMSequenceDictionary (htsjdk.samtools.SAMSequenceDictionary)2 VCFFilterHeaderLine (htsjdk.variant.vcf.VCFFilterHeaderLine)2 VCFInfoHeaderLine (htsjdk.variant.vcf.VCFInfoHeaderLine)2 MutableLong (org.apache.commons.lang.mutable.MutableLong)2 SAMSequenceRecord (htsjdk.samtools.SAMSequenceRecord)1 IndexedFastaSequenceFile (htsjdk.samtools.reference.IndexedFastaSequenceFile)1 VariantContext (htsjdk.variant.variantcontext.VariantContext)1 VCFIDHeaderLine (htsjdk.variant.vcf.VCFIDHeaderLine)1 FileNotFoundException (java.io.FileNotFoundException)1 PrintStream (java.io.PrintStream)1 HashMap (java.util.HashMap)1 CommandLineException (org.broadinstitute.barclay.argparser.CommandLineException)1