diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/AlleleCountBySample.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/AlleleCountBySample.java index 2ce885d1c..5fe0509cf 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/AlleleCountBySample.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/AlleleCountBySample.java @@ -54,10 +54,7 @@ package org.broadinstitute.gatk.tools.walkers.annotator; import htsjdk.variant.variantcontext.Genotype; import htsjdk.variant.variantcontext.GenotypeBuilder; import htsjdk.variant.variantcontext.VariantContext; -import htsjdk.variant.vcf.VCFConstants; import htsjdk.variant.vcf.VCFFormatHeaderLine; -import htsjdk.variant.vcf.VCFHeaderLineCount; -import htsjdk.variant.vcf.VCFHeaderLineType; import org.broadinstitute.gatk.utils.contexts.AlignmentContext; import org.broadinstitute.gatk.utils.contexts.ReferenceContext; import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker; @@ -68,6 +65,8 @@ import org.broadinstitute.gatk.tools.walkers.genotyper.GenotypeLikelihoodCalcula import org.broadinstitute.gatk.tools.walkers.genotyper.GenotypeLikelihoodCalculators; import org.broadinstitute.gatk.utils.MathUtils; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.Arrays; import java.util.Collections; @@ -82,11 +81,11 @@ import java.util.List; @SuppressWarnings("unused") public final class AlleleCountBySample extends GenotypeAnnotation { - private final static List keyNames = Collections.unmodifiableList(Arrays.asList(VCFConstants.MLE_PER_SAMPLE_ALLELE_COUNT_KEY,VCFConstants.MLE_PER_SAMPLE_ALLELE_FRACTION_KEY)); + private final static List keyNames = Collections.unmodifiableList(Arrays.asList(GATKVCFConstants.MLE_PER_SAMPLE_ALLELE_COUNT_KEY,GATKVCFConstants.MLE_PER_SAMPLE_ALLELE_FRACTION_KEY)); private final static List descriptors = Collections.unmodifiableList(Arrays.asList( - new VCFFormatHeaderLine(VCFConstants.MLE_PER_SAMPLE_ALLELE_COUNT_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Integer, "Maximum likelihood expectation (MLE) for the alternate allele count, in the same order as listed, for each individual sample"), - new VCFFormatHeaderLine(VCFConstants.MLE_PER_SAMPLE_ALLELE_FRACTION_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Maximum likelihood expectation (MLE) for the alternate allele fraction, in the same order as listed, for each individual sample") + GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.MLE_PER_SAMPLE_ALLELE_COUNT_KEY), + GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.MLE_PER_SAMPLE_ALLELE_FRACTION_KEY) )); @Override @@ -120,8 +119,8 @@ public final class AlleleCountBySample extends GenotypeAnnotation { AC[alleleIndex - 1] = alleleCount; AF[alleleIndex - 1] = ((double) alleleCount) / (double) ploidy; } - gb.attribute(VCFConstants.MLE_PER_SAMPLE_ALLELE_COUNT_KEY, AC); - gb.attribute(VCFConstants.MLE_PER_SAMPLE_ALLELE_FRACTION_KEY, AF); + gb.attribute(GATKVCFConstants.MLE_PER_SAMPLE_ALLELE_COUNT_KEY, AC); + gb.attribute(GATKVCFConstants.MLE_PER_SAMPLE_ALLELE_FRACTION_KEY, AF); } @Override diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/BaseQualityRankSumTest.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/BaseQualityRankSumTest.java index e5d0d92d6..8033b554d 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/BaseQualityRankSumTest.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/BaseQualityRankSumTest.java @@ -54,9 +54,10 @@ package org.broadinstitute.gatk.tools.walkers.annotator; import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; import org.broadinstitute.gatk.utils.sam.ReadUtils; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import org.broadinstitute.gatk.utils.pileup.PileupElement; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -75,10 +76,10 @@ import java.util.*; */ public class BaseQualityRankSumTest extends RankSumTest implements StandardAnnotation { @Override - public List getKeyNames() { return Arrays.asList("BaseQRankSum"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.BASE_QUAL_RANK_SUM_KEY); } @Override - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("BaseQRankSum", 1, VCFHeaderLineType.Float, "Z-score from Wilcoxon rank sum test of Alt Vs. Ref base qualities")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } @Override protected Double getElementForRead(final GATKSAMRecord read, final int refLoc) { diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/ClippingRankSumTest.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/ClippingRankSumTest.java index 660d78a79..a3034e658 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/ClippingRankSumTest.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/ClippingRankSumTest.java @@ -51,11 +51,11 @@ package org.broadinstitute.gatk.tools.walkers.annotator; -import org.broadinstitute.gatk.utils.pileup.PileupElement; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import org.broadinstitute.gatk.utils.sam.AlignmentUtils; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -73,10 +73,10 @@ import java.util.*; */ public class ClippingRankSumTest extends RankSumTest { @Override - public List getKeyNames() { return Arrays.asList("ClippingRankSum"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.CLIPPING_RANK_SUM_KEY); } @Override - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("ClippingRankSum", 1, VCFHeaderLineType.Float, "Z-score From Wilcoxon rank sum test of Alt vs. Ref number of hard clipped bases")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } @Override protected Double getElementForRead(final GATKSAMRecord read, final int refLoc) { diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/FisherStrand.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/FisherStrand.java index 29fe4754e..e52c58187 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/FisherStrand.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/FisherStrand.java @@ -59,9 +59,10 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.StandardAnnota import org.broadinstitute.gatk.utils.contexts.AlignmentContext; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.QualityUtils; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -91,7 +92,6 @@ public class FisherStrand extends StrandBiasTest implements StandardAnnotation, private final static boolean ENABLE_DEBUGGING = false; private final static Logger logger = Logger.getLogger(FisherStrand.class); - private static final String FS = "FS"; private static final double MIN_PVALUE = 1E-320; private static final int MIN_QUAL_FOR_FILTERED_TEST = 17; private static final int MIN_COUNT = ARRAY_DIM; @@ -151,17 +151,17 @@ public class FisherStrand extends StrandBiasTest implements StandardAnnotation, */ protected Map annotationForOneTable(final double pValue) { final Object value = String.format("%.3f", QualityUtils.phredScaleErrorRate(Math.max(pValue, MIN_PVALUE))); // prevent INFINITYs - return Collections.singletonMap(FS, value); + return Collections.singletonMap(getKeyNames().get(0), value); } @Override public List getKeyNames() { - return Collections.singletonList(FS); + return Collections.singletonList(GATKVCFConstants.FISHER_STRAND_KEY); } @Override public List getDescriptions() { - return Collections.singletonList(new VCFInfoHeaderLine(FS, 1, VCFHeaderLineType.Float, "Phred-scaled p-value using Fisher's exact test to detect strand bias")); + return Collections.singletonList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } /** @@ -269,7 +269,7 @@ public class FisherStrand extends StrandBiasTest implements StandardAnnotation, */ private void printTable(final String name, final int[][] table) { if ( ENABLE_DEBUGGING ) { - final String pValue = (String)annotationForOneTable(pValueForContingencyTable(table)).get(FS); + final String pValue = (String)annotationForOneTable(pValueForContingencyTable(table)).get(getKeyNames().get(0)); logger.info(String.format("FS %s (REF+, REF-, ALT+, ALT-) = (%d, %d, %d, %d) = %s", name, table[0][0], table[0][1], table[1][0], table[1][1], pValue)); } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/GCContent.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/GCContent.java index 6d3dfd6d8..1ca9a428a 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/GCContent.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/GCContent.java @@ -58,9 +58,9 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.AnnotatorCompa import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.BaseUtils; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import java.util.Arrays; import java.util.HashMap; @@ -85,14 +85,14 @@ public class GCContent extends InfoFieldAnnotation { final VariantContext vc, final Map stratifiedPerReadAlleleLikelihoodMap) { double content = computeGCContent(ref); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(getKeyNames().get(0), String.format("%.2f", content)); return map; } - public List getKeyNames() { return Arrays.asList("GC"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.GC_CONTENT_KEY); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("GC", 1, VCFHeaderLineType.Integer, "GC content around the variant (see docs for window size details)")); } + public List getDescriptions() { return Arrays.asList(); } public boolean useZeroQualityReads() { return false; } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/GenotypeSummaries.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/GenotypeSummaries.java index f3a95e6ae..83c3837b3 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/GenotypeSummaries.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/GenotypeSummaries.java @@ -61,8 +61,9 @@ import org.broadinstitute.gatk.utils.MathUtils; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import htsjdk.variant.variantcontext.Genotype; import htsjdk.variant.variantcontext.VariantContext; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -74,12 +75,6 @@ import java.util.*; public class GenotypeSummaries extends InfoFieldAnnotation implements ActiveRegionBasedAnnotation { - public final static String CCC = "CCC"; - public final static String NCC = "NCC"; - public final static String HWP = "HWP"; - public final static String GQ_MEAN = "GQ_MEAN"; - public final static String GQ_STDDEV = "GQ_STDDEV"; - @Override public Map annotate(final RefMetaDataTracker tracker, final AnnotatorCompatible walker, @@ -91,7 +86,7 @@ public class GenotypeSummaries extends InfoFieldAnnotation implements ActiveRegi return null; final Map returnMap = new HashMap<>(); - returnMap.put(NCC, vc.getNoCallCount()); + returnMap.put(GATKVCFConstants.NOCALL_CHROM_KEY, vc.getNoCallCount()); final MathUtils.RunningAverage average = new MathUtils.RunningAverage(); for( final Genotype g : vc.getGenotypes() ) { @@ -100,9 +95,9 @@ public class GenotypeSummaries extends InfoFieldAnnotation implements ActiveRegi } } if( average.observationCount() > 0L ) { - returnMap.put(GQ_MEAN, String.format("%.2f", average.mean())); + returnMap.put(GATKVCFConstants.GQ_MEAN_KEY, String.format("%.2f", average.mean())); if( average.observationCount() > 1L ) { - returnMap.put(GQ_STDDEV, String.format("%.2f", average.stddev())); + returnMap.put(GATKVCFConstants.GQ_STDEV_KEY, String.format("%.2f", average.stddev())); } } @@ -111,17 +106,9 @@ public class GenotypeSummaries extends InfoFieldAnnotation implements ActiveRegi @Override public List getKeyNames() { - return Arrays.asList(CCC, NCC, HWP, GQ_MEAN, GQ_STDDEV); - } - - @Override - public List getDescriptions() { return Arrays.asList( - new VCFInfoHeaderLine(CCC, 1, VCFHeaderLineType.Integer, "Number of called chromosomes"), - new VCFInfoHeaderLine(NCC, 1, VCFHeaderLineType.Integer, "Number of no-called samples"), - new VCFInfoHeaderLine(HWP, 1, VCFHeaderLineType.Float, "P value from test of Hardy Weinberg Equilibrium"), - new VCFInfoHeaderLine(GQ_MEAN, 1, VCFHeaderLineType.Float, "Mean of all GQ values"), - new VCFInfoHeaderLine(GQ_STDDEV, 1, VCFHeaderLineType.Float, "Standard deviation of all GQ values") - ); + GATKVCFConstants.NOCALL_CHROM_KEY, + GATKVCFConstants.GQ_MEAN_KEY, + GATKVCFConstants.GQ_STDEV_KEY); } } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/HaplotypeScore.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/HaplotypeScore.java index 953f22d59..44c38e757 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/HaplotypeScore.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/HaplotypeScore.java @@ -64,7 +64,6 @@ import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.BaseUtils; import org.broadinstitute.gatk.utils.MathUtils; import org.broadinstitute.gatk.utils.QualityUtils; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import org.broadinstitute.gatk.utils.exceptions.ReviewedGATKException; import org.broadinstitute.gatk.utils.pileup.PileupElement; @@ -73,6 +72,8 @@ import org.broadinstitute.gatk.utils.sam.AlignmentUtils; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; import htsjdk.variant.variantcontext.Genotype; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.io.Serializable; import java.util.*; @@ -151,7 +152,7 @@ public class HaplotypeScore extends InfoFieldAnnotation implements StandardAnnot } // annotate the score in the info field - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put(getKeyNames().get(0), String.format("%.4f", scoreRA.mean())); return map; } @@ -173,8 +174,8 @@ public class HaplotypeScore extends InfoFieldAnnotation implements StandardAnnot int haplotypesToCompute = vc.getAlternateAlleles().size() + 1; - final PriorityQueue candidateHaplotypeQueue = new PriorityQueue(100, new HaplotypeComparator()); - final PriorityQueue consensusHaplotypeQueue = new PriorityQueue(MAX_CONSENSUS_HAPLOTYPES_TO_CONSIDER, new HaplotypeComparator()); + final PriorityQueue candidateHaplotypeQueue = new PriorityQueue<>(100, new HaplotypeComparator()); + final PriorityQueue consensusHaplotypeQueue = new PriorityQueue<>(MAX_CONSENSUS_HAPLOTYPES_TO_CONSIDER, new HaplotypeComparator()); for (final PileupElement p : pileup) { final Haplotype haplotypeFromRead = getHaplotypeFromRead(p, contextSize, locus); @@ -214,7 +215,7 @@ public class HaplotypeScore extends InfoFieldAnnotation implements StandardAnnot // The consensus haplotypes are in a quality-ordered priority queue, so the best haplotypes are just the ones at the front of the queue final Haplotype haplotype1 = consensusHaplotypeQueue.poll(); - List hlist = new ArrayList(); + List hlist = new ArrayList<>(); hlist.add(new Haplotype(haplotype1.getBases(), 60)); for (int k = 1; k < haplotypesToCompute; k++) { @@ -329,7 +330,7 @@ public class HaplotypeScore extends InfoFieldAnnotation implements StandardAnnot if (DEBUG) System.out.printf("HAP1: %s%n", haplotypes.get(0)); if (DEBUG) System.out.printf("HAP2: %s%n", haplotypes.get(1)); - final ArrayList haplotypeScores = new ArrayList(); + final ArrayList haplotypeScores = new ArrayList<>(); for (final PileupElement p : pileup) { // Score all the reads in the pileup, even the filtered ones final double[] scores = new double[haplotypes.size()]; @@ -412,12 +413,12 @@ public class HaplotypeScore extends InfoFieldAnnotation implements StandardAnnot @Override public List getKeyNames() { - return Arrays.asList("HaplotypeScore"); + return Arrays.asList(GATKVCFConstants.HAPLOTYPE_SCORE_KEY); } @Override public List getDescriptions() { - return Arrays.asList(new VCFInfoHeaderLine("HaplotypeScore", 1, VCFHeaderLineType.Float, "Consistency of the site with at most two segregating haplotypes")); + return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } private static class Haplotype { diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/HardyWeinberg.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/HardyWeinberg.java index 6765cc8ea..9bf17a721 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/HardyWeinberg.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/HardyWeinberg.java @@ -61,11 +61,12 @@ import org.broadinstitute.gatk.utils.contexts.ReferenceContext; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker; import org.broadinstitute.gatk.utils.QualityUtils; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.Genotype; import htsjdk.variant.variantcontext.GenotypesContext; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -137,14 +138,14 @@ public class HardyWeinberg extends InfoFieldAnnotation implements ExperimentalAn double pvalue = HardyWeinbergCalculation.hwCalculate(refCount, hetCount, homCount); //System.out.println(refCount + " " + hetCount + " " + homCount + " " + pvalue); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(getKeyNames().get(0), String.format("%.1f", QualityUtils.phredScaleErrorRate(pvalue))); return map; } @Override - public List getKeyNames() { return Arrays.asList("HW"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.HARDY_WEINBERG_KEY); } @Override - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HW", 1, VCFHeaderLineType.Float, "Phred-scaled p-value for Hardy-Weinberg violation")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } } \ No newline at end of file diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/HomopolymerRun.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/HomopolymerRun.java index a0148eac2..4bc2151fe 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/HomopolymerRun.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/HomopolymerRun.java @@ -59,9 +59,10 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.ExperimentalAn import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.GenomeLoc; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.Arrays; import java.util.HashMap; @@ -103,14 +104,14 @@ public class HomopolymerRun extends InfoFieldAnnotation implements ExperimentalA return null; } - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(getKeyNames().get(0), String.format("%d", run)); return map; } - public List getKeyNames() { return Arrays.asList("HRun"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.HOMOPOLYMER_RUN_KEY); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HRun", 1, VCFHeaderLineType.Integer, "Largest Contiguous Homopolymer Run of Variant Allele In Either Direction")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } public boolean useZeroQualityReads() { return false; } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/InbreedingCoeff.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/InbreedingCoeff.java index 7ce3214b5..ef541b023 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/InbreedingCoeff.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/InbreedingCoeff.java @@ -63,11 +63,12 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.InfoFieldAnnot import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.MathUtils; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.Genotype; import htsjdk.variant.variantcontext.GenotypesContext; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -88,7 +89,6 @@ public class InbreedingCoeff extends InfoFieldAnnotation implements StandardAnno private final static Logger logger = Logger.getLogger(InbreedingCoeff.class); private static final int MIN_SAMPLES = 10; - private static final String INBREEDING_COEFFICIENT_KEY_NAME = "InbreedingCoeff"; private Set founderIds; private int sampleCount; private boolean pedigreeCheckWarningLogged = false; @@ -182,8 +182,8 @@ public class InbreedingCoeff extends InfoFieldAnnotation implements StandardAnno } @Override - public List getKeyNames() { return Collections.singletonList(INBREEDING_COEFFICIENT_KEY_NAME); } + public List getKeyNames() { return Collections.singletonList(GATKVCFConstants.INBREEDING_COEFFICIENT_KEY); } @Override - public List getDescriptions() { return Collections.singletonList(new VCFInfoHeaderLine(INBREEDING_COEFFICIENT_KEY_NAME, 1, VCFHeaderLineType.Float, "Inbreeding coefficient as estimated from the genotype likelihoods per-sample when compared against the Hardy-Weinberg expectation")); } + public List getDescriptions() { return Collections.singletonList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } } \ No newline at end of file diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/LikelihoodRankSumTest.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/LikelihoodRankSumTest.java index fd383c0e3..e480bfccc 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/LikelihoodRankSumTest.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/LikelihoodRankSumTest.java @@ -53,8 +53,9 @@ package org.broadinstitute.gatk.tools.walkers.annotator; import org.broadinstitute.gatk.utils.genotyper.MostLikelyAllele; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.Arrays; import java.util.List; @@ -73,10 +74,10 @@ import java.util.List; */ public class LikelihoodRankSumTest extends RankSumTest { @Override - public List getKeyNames() { return Arrays.asList("LikelihoodRankSum"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.LIKELIHOOD_RANK_SUM_KEY); } @Override - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("LikelihoodRankSum", 1, VCFHeaderLineType.Float, "Z-score from Wilcoxon rank sum test of Alt Vs. Ref haplotype likelihoods")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } @Override protected Double getElementForRead(final GATKSAMRecord read, final int refLoc, final MostLikelyAllele mostLikelyAllele) { diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/MVLikelihoodRatio.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/MVLikelihoodRatio.java index c08279252..b957619f3 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/MVLikelihoodRatio.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/MVLikelihoodRatio.java @@ -62,9 +62,10 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.InfoFieldAnnot import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.RodRequiringAnnotation; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.engine.samples.MendelianViolation; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -95,7 +96,6 @@ public class MVLikelihoodRatio extends InfoFieldAnnotation implements RodRequiri private final static Logger logger = Logger.getLogger(MVLikelihoodRatio.class); private MendelianViolation mendelianViolation = null; - public static final String MVLR_KEY = "MVLR"; private Set trios; private boolean walkerIdentityCheckWarningLogged = false; private boolean pedigreeCheckWarningLogged = false; @@ -132,7 +132,7 @@ public class MVLikelihoodRatio extends InfoFieldAnnotation implements RodRequiri mendelianViolation = new MendelianViolation(((VariantAnnotator)walker).minGenotypeQualityP ); } - Map attributeMap = new HashMap(1); + Map attributeMap = new HashMap<>(1); //double pNoMV = 1.0; double maxMVLR = Double.MIN_VALUE; for ( Trio trio : trios ) { @@ -146,17 +146,16 @@ public class MVLikelihoodRatio extends InfoFieldAnnotation implements RodRequiri //double pSomeMV = 1.0-pNoMV; //toRet.put("MVLR",Math.log10(pSomeMV)-Math.log10(1.0-pSomeMV)); if ( Double.compare(maxMVLR,Double.MIN_VALUE) != 0 ) - attributeMap.put(MVLR_KEY,maxMVLR); + attributeMap.put(getKeyNames().get(0), maxMVLR); return attributeMap; } - // return the names and descriptions used for the VCF INFO meta field + // return the descriptions used for the VCF INFO meta field @Override - public List getKeyNames() { return Arrays.asList(MVLR_KEY); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.MENDEL_VIOLATION_LR_KEY); } @Override - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(MVLR_KEY, 1, VCFHeaderLineType.Float, "Mendelian violation likelihood ratio: L[MV] - L[No MV]")); } - + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } private boolean contextHasTrioLikelihoods(VariantContext context, Trio trio) { for ( String sample : Arrays.asList(trio.getMaternalID(),trio.getPaternalID(),trio.getChildID()) ) { diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/MappingQualityRankSumTest.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/MappingQualityRankSumTest.java index 9da84183e..9eb8924f6 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/MappingQualityRankSumTest.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/MappingQualityRankSumTest.java @@ -53,9 +53,10 @@ package org.broadinstitute.gatk.tools.walkers.annotator; import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.gatk.utils.pileup.PileupElement; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -80,10 +81,10 @@ import java.util.*; */ public class MappingQualityRankSumTest extends RankSumTest implements StandardAnnotation { @Override - public List getKeyNames() { return Arrays.asList("MQRankSum"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.MAP_QUAL_RANK_SUM_KEY); } @Override - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("MQRankSum", 1, VCFHeaderLineType.Float, "Z-score From Wilcoxon rank sum test of Alt vs. Ref read mapping qualities")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } @Override protected Double getElementForRead(final GATKSAMRecord read, final int refLoc) { diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/PossibleDeNovo.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/PossibleDeNovo.java index ddafc7d22..6471488a5 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/PossibleDeNovo.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/PossibleDeNovo.java @@ -64,9 +64,8 @@ import org.broadinstitute.gatk.utils.contexts.ReferenceContext; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker; import org.broadinstitute.gatk.engine.samples.MendelianViolation; -import htsjdk.variant.vcf.VCFHeaderLineType; -import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import java.util.*; @@ -97,10 +96,8 @@ public class PossibleDeNovo extends InfoFieldAnnotation implements RodRequiringA private final static Logger logger = Logger.getLogger(PossibleDeNovo.class); private MendelianViolation mendelianViolation = null; - public static final String HI_CONF_DENOVO_KEY = "hiConfDeNovo"; - public static final String LO_CONF_DENOVO_KEY = "loConfDeNovo"; - private final int hi_GQ_threshold = 20; - private final int lo_GQ_threshold = 10; + private final int hi_GQ_threshold = 20; //WARNING - If you change this value, update the description in GATKVCFHeaderLines + private final int lo_GQ_threshold = 10; //WARNING - If you change this value, update the description in GATKVCFHeaderLines private final double percentOfSamplesCutoff = 0.001; //for many, many samples use 0.1% of samples as allele frequency threshold for de novos private final int flatNumberOfSamplesCutoff = 4; private Set trios; @@ -137,11 +134,11 @@ public class PossibleDeNovo extends InfoFieldAnnotation implements RodRequiringA mendelianViolation = new MendelianViolation(((VariantAnnotator)walker).minGenotypeQualityP ); } - final Map attributeMap = new HashMap(1); + final Map attributeMap = new HashMap<>(1); boolean isHighConfDeNovo = false; boolean isLowConfDeNovo = false; - final List highConfDeNovoChildren = new ArrayList(); - final List lowConfDeNovoChildren = new ArrayList(); + final List highConfDeNovoChildren = new ArrayList<>(); + final List lowConfDeNovoChildren = new ArrayList<>(); for ( final Trio trio : trios ) { if (vc.isBiallelic() && contextHasTrioLikelihoods(vc,trio) && mendelianViolation.isViolation(trio.getMother(),trio.getFather(),trio.getChild(),vc) ) { @@ -164,20 +161,15 @@ public class PossibleDeNovo extends InfoFieldAnnotation implements RodRequiringA final double AFcutoff = Math.max(flatNumberOfSamplesCutoff,percentNumberOfSamplesCutoff); final int deNovoAlleleCount = vc.getCalledChrCount(vc.getAlternateAllele(0)); //we assume we're biallelic above so use the first alt if ( isHighConfDeNovo && deNovoAlleleCount < AFcutoff ) - attributeMap.put(HI_CONF_DENOVO_KEY,highConfDeNovoChildren); + attributeMap.put(GATKVCFConstants.HI_CONF_DENOVO_KEY,highConfDeNovoChildren); if ( isLowConfDeNovo && deNovoAlleleCount < AFcutoff ) - attributeMap.put(LO_CONF_DENOVO_KEY,lowConfDeNovoChildren); + attributeMap.put(GATKVCFConstants.LO_CONF_DENOVO_KEY,lowConfDeNovoChildren); return attributeMap; } // return the descriptions used for the VCF INFO meta field @Override - public List getKeyNames() { return Arrays.asList(HI_CONF_DENOVO_KEY,LO_CONF_DENOVO_KEY); } - - @Override - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(HI_CONF_DENOVO_KEY, 1, VCFHeaderLineType.String, "High confidence possible de novo mutation (GQ >= "+hi_GQ_threshold+" for all trio members)=[comma-delimited list of child samples]"), - new VCFInfoHeaderLine(LO_CONF_DENOVO_KEY, 1, VCFHeaderLineType.String, "Low confidence possible de novo mutation (GQ >= "+lo_GQ_threshold+" for child, GQ > 0 for parents)=[comma-delimited list of child samples]")); } - + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.HI_CONF_DENOVO_KEY, GATKVCFConstants.LO_CONF_DENOVO_KEY); } private boolean contextHasTrioLikelihoods(VariantContext context, Trio trio) { for ( String sample : Arrays.asList(trio.getMaternalID(),trio.getPaternalID(),trio.getChildID()) ) { diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/QualByDepth.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/QualByDepth.java index 49db309f3..6ea117986 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/QualByDepth.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/QualByDepth.java @@ -61,8 +61,9 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.InfoFieldAnnot import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.gatk.utils.MathUtils; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.Genotype; import htsjdk.variant.variantcontext.GenotypesContext; @@ -197,10 +198,10 @@ public class QualByDepth extends InfoFieldAnnotation implements StandardAnnotati private final static double IDEAL_HIGH_QD = 30; private final static double JITTER_SIGMA = 3; - public List getKeyNames() { return Arrays.asList("QD"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.QUAL_BY_DEPTH_KEY); } public List getDescriptions() { - return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Float, "Variant Confidence/Quality by Depth")); + return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/ReadPosRankSumTest.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/ReadPosRankSumTest.java index 11f59157a..590854065 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/ReadPosRankSumTest.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/ReadPosRankSumTest.java @@ -57,12 +57,13 @@ import htsjdk.samtools.CigarOperator; import htsjdk.samtools.SAMRecord; import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.gatk.tools.walkers.indels.PairHMMIndelErrorModel; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import org.broadinstitute.gatk.utils.pileup.PileupElement; import org.broadinstitute.gatk.utils.sam.AlignmentUtils; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; import org.broadinstitute.gatk.utils.sam.ReadUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -85,11 +86,11 @@ import java.util.*; public class ReadPosRankSumTest extends RankSumTest implements StandardAnnotation { @Override - public List getKeyNames() { return Arrays.asList("ReadPosRankSum"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.READ_POS_RANK_SUM_KEY); } @Override public List getDescriptions() { - return Arrays.asList(new VCFInfoHeaderLine("ReadPosRankSum", 1, VCFHeaderLineType.Float, "Z-score from Wilcoxon rank sum test of Alt vs. Ref read position bias")); + return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } @Override diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/SampleList.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/SampleList.java index e82b485f3..7b156f335 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/SampleList.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/SampleList.java @@ -57,11 +57,11 @@ import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker; import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.AnnotatorCompatible; import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; -import htsjdk.variant.vcf.VCFHeaderLineCount; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.Genotype; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.Arrays; import java.util.HashMap; @@ -84,7 +84,7 @@ public class SampleList extends InfoFieldAnnotation { if ( vc.isMonomorphicInSamples() || !vc.hasGenotypes() ) return null; - StringBuffer samples = new StringBuffer(); + final StringBuilder samples = new StringBuilder(); for ( Genotype genotype : vc.getGenotypesOrderedByName() ) { if ( genotype.isCalled() && !genotype.isHomRef() ){ if ( samples.length() > 0 ) @@ -97,11 +97,11 @@ public class SampleList extends InfoFieldAnnotation { return null; Map map = new HashMap(); - map.put("Samples", samples.toString()); + map.put(getKeyNames().get(0), samples.toString()); return map; } - public List getKeyNames() { return Arrays.asList("Samples"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.SAMPLE_LIST_KEY); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("Samples", VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.String, "List of polymorphic samples")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/SpanningDeletions.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/SpanningDeletions.java index 5f4b27139..883ba50bf 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/SpanningDeletions.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/SpanningDeletions.java @@ -61,9 +61,10 @@ import org.broadinstitute.gatk.utils.contexts.ReferenceContext; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker; import org.broadinstitute.gatk.utils.pileup.PileupElement; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -121,14 +122,14 @@ public class SpanningDeletions extends InfoFieldAnnotation implements StandardAn deletions++; } } - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(getKeyNames().get(0), String.format("%.2f", depth == 0 ? 0.0 : (double)deletions/(double)depth)); return map; } @Override - public List getKeyNames() { return Arrays.asList("Dels"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.SPANNING_DELETIONS_KEY); } @Override - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("Dels", 1, VCFHeaderLineType.Float, "Fraction of Reads Containing Spanning Deletions")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } } \ No newline at end of file diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandAlleleCountsBySample.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandAlleleCountsBySample.java index 2a2907651..118016504 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandAlleleCountsBySample.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandAlleleCountsBySample.java @@ -56,8 +56,6 @@ import htsjdk.variant.variantcontext.Genotype; import htsjdk.variant.variantcontext.GenotypeBuilder; import htsjdk.variant.variantcontext.VariantContext; import htsjdk.variant.vcf.VCFFormatHeaderLine; -import htsjdk.variant.vcf.VCFHeaderLineCount; -import htsjdk.variant.vcf.VCFHeaderLineType; import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.AnnotatorCompatible; import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.GenotypeAnnotation; import org.broadinstitute.gatk.utils.contexts.AlignmentContext; @@ -66,6 +64,8 @@ import org.broadinstitute.gatk.utils.genotyper.MostLikelyAllele; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.Collections; import java.util.List; @@ -99,8 +99,6 @@ import java.util.Map; public class StrandAlleleCountsBySample extends GenotypeAnnotation { - public final static String STRAND_COUNT_BY_SAMPLE_KEY_NAME = "SAC"; - @Override public void annotate(final RefMetaDataTracker tracker, final AnnotatorCompatible walker, @@ -113,17 +111,15 @@ public class StrandAlleleCountsBySample extends GenotypeAnnotation { if ( ! isAppropriateInput(alleleLikelihoodMap, g) ) return; - gb.attribute(STRAND_COUNT_BY_SAMPLE_KEY_NAME, getStrandCounts(Collections.singletonMap(g.getSampleName(), alleleLikelihoodMap), vc)); + gb.attribute(GATKVCFConstants.STRAND_COUNT_BY_SAMPLE_KEY, getStrandCounts(Collections.singletonMap(g.getSampleName(), alleleLikelihoodMap), vc)); } @Override - public List getKeyNames() { return Collections.singletonList(STRAND_COUNT_BY_SAMPLE_KEY_NAME); } + public List getKeyNames() { return Collections.singletonList(GATKVCFConstants.STRAND_COUNT_BY_SAMPLE_KEY); } @Override public List getDescriptions() { - return Collections.singletonList( - new VCFFormatHeaderLine(getKeyNames().get(0), VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.Integer, - "Number of reads on the forward and reverse strand supporting each allele (including reference)")); + return Collections.singletonList(GATKVCFHeaderLines.getFormatLine(getKeyNames().get(0))); } private boolean isAppropriateInput(final PerReadAlleleLikelihoodMap map, final Genotype g) { diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandBiasBySample.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandBiasBySample.java index 1b2043004..7e26945fc 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandBiasBySample.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandBiasBySample.java @@ -61,7 +61,8 @@ import htsjdk.variant.variantcontext.Genotype; import htsjdk.variant.variantcontext.GenotypeBuilder; import htsjdk.variant.variantcontext.VariantContext; import htsjdk.variant.vcf.VCFFormatHeaderLine; -import htsjdk.variant.vcf.VCFHeaderLineType; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -92,8 +93,6 @@ import java.util.*; public class StrandBiasBySample extends GenotypeAnnotation { - public final static String STRAND_BIAS_BY_SAMPLE_KEY_NAME = "SB"; - @Override public void annotate(final RefMetaDataTracker tracker, final AnnotatorCompatible walker, @@ -108,14 +107,14 @@ public class StrandBiasBySample extends GenotypeAnnotation { final int[][] table = FisherStrand.getContingencyTable(Collections.singletonMap(g.getSampleName(), alleleLikelihoodMap), vc, 0); - gb.attribute(STRAND_BIAS_BY_SAMPLE_KEY_NAME, FisherStrand.getContingencyArray(table)); + gb.attribute(GATKVCFConstants.STRAND_BIAS_BY_SAMPLE_KEY, FisherStrand.getContingencyArray(table)); } @Override - public List getKeyNames() { return Collections.singletonList(STRAND_BIAS_BY_SAMPLE_KEY_NAME); } + public List getKeyNames() { return Collections.singletonList(GATKVCFConstants.STRAND_BIAS_BY_SAMPLE_KEY); } @Override - public List getDescriptions() { return Collections.singletonList(new VCFFormatHeaderLine(getKeyNames().get(0), 4, VCFHeaderLineType.Integer, "Per-sample component statistics which comprise the Fisher's Exact Test to detect strand bias.")); } + public List getDescriptions() { return Collections.singletonList(GATKVCFHeaderLines.getFormatLine(getKeyNames().get(0))); } private boolean isAppropriateInput(final PerReadAlleleLikelihoodMap map, final Genotype g) { return ! (map == null || g == null || !g.isCalled()); diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandBiasTest.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandBiasTest.java index d5e875fd2..40d8cecf6 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandBiasTest.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandBiasTest.java @@ -70,6 +70,7 @@ import org.broadinstitute.gatk.utils.genotyper.MostLikelyAllele; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.pileup.PileupElement; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import java.util.*; @@ -92,7 +93,7 @@ public abstract class StrandBiasTest extends InfoFieldAnnotation { for ( final VCFHeaderLine line : headerLines) { if ( line instanceof VCFFormatHeaderLine) { final VCFFormatHeaderLine formatline = (VCFFormatHeaderLine)line; - if ( formatline.getID().equals(VCFConstants.STRAND_BIAS_KEY) ) { + if ( formatline.getID().equals(GATKVCFConstants.STRAND_BIAS_BY_SAMPLE_KEY) ) { logger.warn("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; @@ -123,7 +124,7 @@ public abstract class StrandBiasTest extends InfoFieldAnnotation { // if the genotype and strand bias are provided, calculate the annotation from the Genotype (GT) field if ( vc.hasGenotypes() ) { for (final Genotype g : vc.getGenotypes()) { - if (g.hasAnyAttribute(StrandBiasBySample.STRAND_BIAS_BY_SAMPLE_KEY_NAME)) { + if (g.hasAnyAttribute(GATKVCFConstants.STRAND_BIAS_BY_SAMPLE_KEY)) { return calculateAnnotationFromGTfield(vc.getGenotypes()); } } @@ -176,11 +177,11 @@ public abstract class StrandBiasTest extends InfoFieldAnnotation { boolean foundData = false; for( final Genotype g : genotypes ) { - if( g.isNoCall() || ! g.hasAnyAttribute(StrandBiasBySample.STRAND_BIAS_BY_SAMPLE_KEY_NAME) ) + if( g.isNoCall() || ! g.hasAnyAttribute(GATKVCFConstants.STRAND_BIAS_BY_SAMPLE_KEY) ) continue; foundData = true; - final String sbbsString = (String) g.getAnyAttribute(StrandBiasBySample.STRAND_BIAS_BY_SAMPLE_KEY_NAME); + final String sbbsString = (String) g.getAnyAttribute(GATKVCFConstants.STRAND_BIAS_BY_SAMPLE_KEY); final int[] data = encodeSBBS(sbbsString); if ( passesMinimumThreshold(data, minCount) ) { for( int index = 0; index < sbArray.length; index++ ) { diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandOddsRatio.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandOddsRatio.java index c77dcb8f0..92c0973d7 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandOddsRatio.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/StrandOddsRatio.java @@ -57,8 +57,9 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.ActiveRegionBa import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import htsjdk.variant.variantcontext.VariantContext; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -99,8 +100,6 @@ public class StrandOddsRatio extends StrandBiasTest implements StandardAnnotatio private final static double AUGMENTATION_CONSTANT = 1.0; private static final int MIN_COUNT = 0; - private static final String SOR = "SOR"; - @Override protected Map calculateAnnotationFromGTfield(GenotypesContext genotypes){ final int[][] tableFromPerSampleAnnotations = getTableFromSamples( genotypes, MIN_COUNT ); @@ -179,16 +178,16 @@ public class StrandOddsRatio extends StrandBiasTest implements StandardAnnotatio */ protected Map annotationForOneTable(final double ratio) { final Object value = String.format("%.3f", ratio); - return Collections.singletonMap(SOR, value); + return Collections.singletonMap(getKeyNames().get(0), value); } @Override public List getDescriptions() { - return Collections.singletonList(new VCFInfoHeaderLine(SOR, 1, VCFHeaderLineType.Float, "Symmetric Odds Ratio of 2x2 contingency table to detect strand bias")); + return Collections.singletonList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } @Override public List getKeyNames() { - return Collections.singletonList(SOR); + return Collections.singletonList(GATKVCFConstants.STRAND_ODDS_RATIO_KEY); } } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/TandemRepeatAnnotator.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/TandemRepeatAnnotator.java index df8f096e5..cba6c6636 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/TandemRepeatAnnotator.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/TandemRepeatAnnotator.java @@ -61,11 +61,9 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.StandardAnnota import org.broadinstitute.gatk.tools.walkers.haplotypecaller.HaplotypeCaller; import org.broadinstitute.gatk.utils.exceptions.UserException; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import org.broadinstitute.gatk.utils.collections.Pair; -import htsjdk.variant.vcf.VCFHeaderLineCount; -import htsjdk.variant.vcf.VCFHeaderLineType; -import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.VariantContext; import java.util.*; @@ -85,9 +83,6 @@ import java.util.*; */ public class TandemRepeatAnnotator extends InfoFieldAnnotation implements StandardAnnotation { private final static Logger logger = Logger.getLogger(TandemRepeatAnnotator.class); - private static final String STR_PRESENT = "STR"; - private static final String REPEAT_UNIT_KEY = "RU"; - private static final String REPEATS_PER_ALLELE_KEY = "RPA"; private boolean walkerIdentityCheckWarningLogged = false; @Override @@ -110,33 +105,27 @@ public class TandemRepeatAnnotator extends InfoFieldAnnotation implements Standa if ( !vc.isIndel()) return null; - Pair,byte[]> result = GATKVariantContextUtils.getNumTandemRepeatUnits(vc, ref.getForwardBases()); + final Pair,byte[]> result = GATKVariantContextUtils.getNumTandemRepeatUnits(vc, ref.getForwardBases()); if (result == null) return null; - byte[] repeatUnit = result.second; - List numUnits = result.first; + final byte[] repeatUnit = result.second; + final List numUnits = result.first; - Map map = new HashMap(); - map.put(STR_PRESENT,true); - map.put(REPEAT_UNIT_KEY,new String(repeatUnit)); - map.put(REPEATS_PER_ALLELE_KEY, numUnits); + final Map map = new HashMap<>(); + map.put(GATKVCFConstants.STR_PRESENT_KEY, true); + map.put(GATKVCFConstants.REPEAT_UNIT_KEY, new String(repeatUnit)); + map.put(GATKVCFConstants.REPEATS_PER_ALLELE_KEY, numUnits); return map; } - protected static final String[] keyNames = {STR_PRESENT, REPEAT_UNIT_KEY,REPEATS_PER_ALLELE_KEY }; - protected static final VCFInfoHeaderLine[] descriptions = { - new VCFInfoHeaderLine(STR_PRESENT, 0, VCFHeaderLineType.Flag, "Variant is a short tandem repeat"), - new VCFInfoHeaderLine(REPEAT_UNIT_KEY, 1, VCFHeaderLineType.String, "Tandem repeat unit (bases)"), - new VCFInfoHeaderLine(REPEATS_PER_ALLELE_KEY, VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.Integer, "Number of times tandem repeat unit is repeated, for each allele (including reference)") }; - @Override public List getKeyNames() { - return Arrays.asList(keyNames); + return Arrays.asList( + GATKVCFConstants.STR_PRESENT_KEY, + GATKVCFConstants.REPEAT_UNIT_KEY, + GATKVCFConstants.REPEATS_PER_ALLELE_KEY); } - @Override - public List getDescriptions() { return Arrays.asList(descriptions); } - } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/TransmissionDisequilibriumTest.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/TransmissionDisequilibriumTest.java index 41f539ca7..e01b5f091 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/TransmissionDisequilibriumTest.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/TransmissionDisequilibriumTest.java @@ -61,10 +61,10 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.InfoFieldAnnot import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.RodRequiringAnnotation; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.MathUtils; -import htsjdk.variant.vcf.VCFHeaderLineCount; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -125,8 +125,8 @@ public class TransmissionDisequilibriumTest extends InfoFieldAnnotation implemen } } - final Map toRet = new HashMap(1); - final HashSet triosToTest = new HashSet(); + final Map toRet = new HashMap<>(1); + final HashSet triosToTest = new HashSet<>(); for( final Sample child : trios ) { final boolean hasAppropriateGenotypes = vc.hasGenotype(child.getID()) && vc.getGenotype(child.getID()).hasLikelihoods() && @@ -146,15 +146,15 @@ public class TransmissionDisequilibriumTest extends InfoFieldAnnotation implemen // return the descriptions used for the VCF INFO meta field @Override - public List getKeyNames() { return Arrays.asList("TDT"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.TRANSMISSION_DISEQUILIBRIUM_KEY); } @Override - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("TDT", VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Test statistic from Wittkowski transmission disequilibrium test.")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } // Following derivation in http://en.wikipedia.org/wiki/Transmission_disequilibrium_test#A_modified_version_of_the_TDT private List calculateTDT( final VariantContext vc, final Set triosToTest ) { - List pairwiseTDTs = new ArrayList(10); + List pairwiseTDTs = new ArrayList<>(10); final int HomRefIndex = 0; // for each pair of alleles, add the likelihoods diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/VariantType.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/VariantType.java index 5b4bab87e..c92cac17c 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/VariantType.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/VariantType.java @@ -58,9 +58,10 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.AnnotatorCompa import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.IndelUtils; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -100,13 +101,13 @@ public class VariantType extends InfoFieldAnnotation { } } - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(getKeyNames().get(0), String.format("%s", type)); return map; } - public List getKeyNames() { return Arrays.asList("VariantType"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.VARIANT_TYPE_KEY); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("VariantType", 1, VCFHeaderLineType.String, "Variant type description")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/diagnostics/diagnosetargets/DiagnoseTargets.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/diagnostics/diagnosetargets/DiagnoseTargets.java index d2cb4439b..5715f3b87 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/diagnostics/diagnosetargets/DiagnoseTargets.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/diagnostics/diagnosetargets/DiagnoseTargets.java @@ -70,6 +70,8 @@ import htsjdk.variant.variantcontext.*; import htsjdk.variant.variantcontext.writer.VariantContextWriter; import htsjdk.variant.vcf.*; import org.broadinstitute.gatk.utils.sam.ReadUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.io.PrintStream; import java.util.*; @@ -124,12 +126,6 @@ import java.util.*; @Downsample(by = DownsampleType.NONE) public class DiagnoseTargets extends LocusWalker { - private static final String AVG_INTERVAL_DP_KEY = "IDP"; - private static final String LOW_COVERAGE_LOCI = "LL"; - private static final String ZERO_COVERAGE_LOCI = "ZL"; - private static final String GC_CONTENT_KEY = "GC"; - - @Output(doc = "File to which interval statistics should be written") private VariantContextWriter vcfWriter = null; @@ -150,8 +146,8 @@ public class DiagnoseTargets extends LocusWalker { if (getToolkit().getIntervals() == null || getToolkit().getIntervals().isEmpty()) throw new UserException("This tool only works if you provide one or more intervals (use the -L argument). If you want to run whole genome, use -T DepthOfCoverage instead."); - intervalMap = new LinkedHashMap(INITIAL_HASH_SIZE); - intervalListIterator = new PeekableIterator(getToolkit().getIntervals().iterator()); + intervalMap = new LinkedHashMap<>(INITIAL_HASH_SIZE); + intervalListIterator = new PeekableIterator<>(getToolkit().getIntervals().iterator()); // get all of the unique sample names for the VCF Header samples = ReadUtils.getSAMFileSamples(getToolkit().getSAMFileHeader()); @@ -224,7 +220,7 @@ public class DiagnoseTargets extends LocusWalker { */ private void outputFinishedIntervals(final GenomeLoc refLocus, final byte refBase) { // output any intervals that were finished - final List toRemove = new LinkedList(); + final List toRemove = new LinkedList<>(); for (GenomeLoc key : intervalMap.keySet()) { if (key.isBefore(refLocus)) { final IntervalStratification intervalStats = intervalMap.get(key); @@ -263,17 +259,17 @@ public class DiagnoseTargets extends LocusWalker { private void outputStatsToVCF(final IntervalStratification stats, final Allele refAllele) { GenomeLoc interval = stats.getInterval(); - final List alleles = new ArrayList(); - final Map attributes = new HashMap(); - final ArrayList genotypes = new ArrayList(); + final List alleles = new ArrayList<>(); + final Map attributes = new HashMap<>(); + final ArrayList genotypes = new ArrayList<>(); for (String sample : samples) { final GenotypeBuilder gb = new GenotypeBuilder(sample); SampleStratification sampleStat = stats.getSampleStatistics(sample); - gb.attribute(AVG_INTERVAL_DP_KEY, sampleStat.averageCoverage(interval.size())); - gb.attribute(LOW_COVERAGE_LOCI, sampleStat.getNLowCoveredLoci()); - gb.attribute(ZERO_COVERAGE_LOCI, sampleStat.getNUncoveredLoci()); + gb.attribute(GATKVCFConstants.AVG_INTERVAL_DP_BY_SAMPLE_KEY, sampleStat.averageCoverage(interval.size())); + gb.attribute(GATKVCFConstants.LOW_COVERAGE_LOCI, sampleStat.getNLowCoveredLoci()); + gb.attribute(GATKVCFConstants.ZERO_COVERAGE_LOCI, sampleStat.getNUncoveredLoci()); gb.filters(statusToStrings(stats.getSampleStatistics(sample).callableStatuses(), false)); genotypes.add(gb.make()); @@ -283,11 +279,11 @@ public class DiagnoseTargets extends LocusWalker { VariantContextBuilder vcb = new VariantContextBuilder("DiagnoseTargets", interval.getContig(), interval.getStart(), interval.getStop(), alleles); vcb = vcb.log10PError(VariantContext.NO_LOG10_PERROR); - vcb.filters(new LinkedHashSet(statusToStrings(stats.callableStatuses(), true))); + vcb.filters(new LinkedHashSet<>(statusToStrings(stats.callableStatuses(), true))); attributes.put(VCFConstants.END_KEY, interval.getStop()); - attributes.put(AVG_INTERVAL_DP_KEY, stats.averageCoverage(interval.size())); - attributes.put(GC_CONTENT_KEY, stats.gcContent()); + attributes.put(GATKVCFConstants.AVG_INTERVAL_DP_KEY, stats.averageCoverage(interval.size())); + attributes.put(GATKVCFConstants.INTERVAL_GC_CONTENT_KEY, stats.gcContent()); vcb = vcb.attributes(attributes); vcb = vcb.genotypes(genotypes); @@ -347,7 +343,7 @@ public class DiagnoseTargets extends LocusWalker { * @return a matching set of strings */ private List statusToStrings(Iterable statuses, final boolean isInfoField) { - List output = new LinkedList(); + List output = new LinkedList<>(); for (CallableStatus status : statuses) if ( isInfoField || status != CallableStatus.PASS ) @@ -398,19 +394,19 @@ public class DiagnoseTargets extends LocusWalker { * @return A set of VCF header lines */ private static Set getHeaderInfo() { - Set headerLines = new HashSet(); + Set headerLines = new HashSet<>(); // INFO fields for overall data headerLines.add(VCFStandardHeaderLines.getInfoLine(VCFConstants.END_KEY)); - headerLines.add(new VCFInfoHeaderLine(AVG_INTERVAL_DP_KEY, 1, VCFHeaderLineType.Float, "Average depth across the interval. Sum of the depth in a loci divided by interval size.")); - headerLines.add(new VCFInfoHeaderLine(GC_CONTENT_KEY, 1, VCFHeaderLineType.Float, "GC Content of the interval")); + headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.AVG_INTERVAL_DP_KEY)); + headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.INTERVAL_GC_CONTENT_KEY)); headerLines.add(new VCFInfoHeaderLine("Diagnose Targets", 0, VCFHeaderLineType.Flag, "DiagnoseTargets mode")); // FORMAT fields for each genotype headerLines.add(VCFStandardHeaderLines.getFormatLine(VCFConstants.GENOTYPE_FILTER_KEY)); - headerLines.add(new VCFFormatHeaderLine(AVG_INTERVAL_DP_KEY, 1, VCFHeaderLineType.Float, "Average sample depth across the interval. Sum of the sample specific depth in all loci divided by interval size.")); - headerLines.add(new VCFFormatHeaderLine(LOW_COVERAGE_LOCI, 1, VCFHeaderLineType.Integer, "Number of loci for this sample, in this interval with low coverage (below the minimum coverage) but not zero.")); - headerLines.add(new VCFFormatHeaderLine(ZERO_COVERAGE_LOCI, 1, VCFHeaderLineType.Integer, "Number of loci for this sample, in this interval with zero coverage.")); + headerLines.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.AVG_INTERVAL_DP_BY_SAMPLE_KEY)); + headerLines.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.LOW_COVERAGE_LOCI)); + headerLines.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.ZERO_COVERAGE_LOCI)); // FILTER fields for (CallableStatus stat : CallableStatus.values()) diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/GeneralPloidyGenotypeLikelihoods.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/GeneralPloidyGenotypeLikelihoods.java index 349734b07..984215df3 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/GeneralPloidyGenotypeLikelihoods.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/GeneralPloidyGenotypeLikelihoods.java @@ -54,7 +54,6 @@ package org.broadinstitute.gatk.tools.walkers.genotyper; import htsjdk.samtools.SAMUtils; import htsjdk.variant.variantcontext.Allele; import htsjdk.variant.variantcontext.GenotypeLikelihoods; -import htsjdk.variant.vcf.VCFConstants; import org.broadinstitute.gatk.tools.walkers.genotyper.afcalc.ExactACcounts; import org.broadinstitute.gatk.tools.walkers.genotyper.afcalc.ExactACset; import org.broadinstitute.gatk.utils.MathUtils; @@ -62,6 +61,7 @@ import org.broadinstitute.gatk.utils.collections.Pair; import org.broadinstitute.gatk.utils.exceptions.ReviewedGATKException; import org.broadinstitute.gatk.utils.exceptions.UserException; import org.broadinstitute.gatk.utils.pileup.ReadBackedPileup; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import java.util.*; @@ -319,7 +319,7 @@ public abstract class GeneralPloidyGenotypeLikelihoods { iterator.next(); } if (VERBOSE) { - System.out.println(VCFConstants.MLE_ALLELE_COUNT_KEY + ": " + Arrays.toString(mlInd)); + System.out.println(GATKVCFConstants.MLE_ALLELE_COUNT_KEY + ": " + Arrays.toString(mlInd)); } return new Pair(mlInd,maxVal); } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/GeneralPloidyGenotypeLikelihoodsCalculationModel.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/GeneralPloidyGenotypeLikelihoodsCalculationModel.java index 8d07268d3..49e49d82d 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/GeneralPloidyGenotypeLikelihoodsCalculationModel.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/GeneralPloidyGenotypeLikelihoodsCalculationModel.java @@ -60,11 +60,11 @@ import org.broadinstitute.gatk.utils.GenomeLoc; import org.broadinstitute.gatk.utils.GenomeLocParser; import org.broadinstitute.gatk.utils.MathUtils; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; -import htsjdk.variant.vcf.VCFConstants; import org.broadinstitute.gatk.utils.collections.Pair; import org.broadinstitute.gatk.utils.exceptions.ReviewedGATKException; import org.broadinstitute.gatk.utils.pileup.ReadBackedPileup; import htsjdk.variant.variantcontext.*; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import java.util.*; @@ -287,7 +287,7 @@ public abstract class GeneralPloidyGenotypeLikelihoodsCalculationModel extends G final HashMap attributes = new HashMap(); if (UAC.referenceSampleName != null && perLaneErrorModels != null) - attributes.put(VCFConstants.REFSAMPLE_DEPTH_KEY, ErrorModel.getTotalReferenceDepth(perLaneErrorModels)); + attributes.put(GATKVCFConstants.REFSAMPLE_DEPTH_KEY, ErrorModel.getTotalReferenceDepth(perLaneErrorModels)); builder.attributes(attributes); // create the genotypes; no-call everyone for now diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/GenotypingEngine.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/GenotypingEngine.java index 63caf8a14..8dd616f41 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/GenotypingEngine.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/GenotypingEngine.java @@ -54,11 +54,8 @@ package org.broadinstitute.gatk.tools.walkers.genotyper; import com.google.java.contract.Ensures; import com.google.java.contract.Requires; import htsjdk.variant.variantcontext.*; -import htsjdk.variant.vcf.VCFConstants; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import org.apache.log4j.Logger; -import org.broadinstitute.gatk.tools.walkers.genotyper.StandardCallerArgumentCollection; import org.broadinstitute.gatk.utils.contexts.AlignmentContext; import org.broadinstitute.gatk.utils.contexts.AlignmentContextUtils; import org.broadinstitute.gatk.utils.contexts.ReferenceContext; @@ -75,6 +72,8 @@ import org.broadinstitute.gatk.utils.QualityUtils; import org.broadinstitute.gatk.utils.exceptions.UserException; import org.broadinstitute.gatk.utils.gga.GenotypingGivenAllelesUtils; import org.broadinstitute.gatk.utils.pileup.ReadBackedPileup; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import java.util.*; @@ -86,10 +85,6 @@ import java.util.*; */ public abstract class GenotypingEngine { - public static final String NUMBER_OF_DISCOVERED_ALLELES_KEY = "NDA"; - - public static final String LOW_QUAL_FILTER_NAME = "LowQual"; - protected final AFCalculatorProvider afCalculatorProvider ; protected Logger logger; @@ -158,7 +153,7 @@ public abstract class GenotypingEngine getAppropriateVCFInfoHeaders() { Set headerInfo = new HashSet<>(); if ( configuration.genotypeArgs.ANNOTATE_NUMBER_OF_ALLELES_DISCOVERED ) - headerInfo.add(new VCFInfoHeaderLine(UnifiedGenotypingEngine.NUMBER_OF_DISCOVERED_ALLELES_KEY, 1, VCFHeaderLineType.Integer, "Number of alternate alleles discovered (but not necessarily genotyped) at this site")); + headerInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.NUMBER_OF_DISCOVERED_ALLELES_KEY)); return headerInfo; } @@ -262,7 +257,7 @@ public abstract class GenotypingEngine inputPriors) { - final double[] priors = new double[N + 1]; - double sum = 0.0; - final AFPriorProvider result; - if (!inputPriors.isEmpty()) { // user-specified priors if (inputPriors.size() != N) @@ -652,17 +643,17 @@ public abstract class GenotypingEngine 0 ) { - attributes.put(VCFConstants.MLE_ALLELE_COUNT_KEY, alleleCountsofMLE); + attributes.put(GATKVCFConstants.MLE_ALLELE_COUNT_KEY, alleleCountsofMLE); final ArrayList MLEfrequencies = calculateMLEAlleleFrequencies(alleleCountsofMLE, genotypes); - attributes.put(VCFConstants.MLE_ALLELE_FREQUENCY_KEY, MLEfrequencies); + attributes.put(GATKVCFConstants.MLE_ALLELE_FREQUENCY_KEY, MLEfrequencies); } if ( configuration.genotypeArgs.ANNOTATE_NUMBER_OF_ALLELES_DISCOVERED ) - attributes.put(NUMBER_OF_DISCOVERED_ALLELES_KEY, vc.getAlternateAlleles().size()); + attributes.put(GATKVCFConstants.NUMBER_OF_DISCOVERED_ALLELES_KEY, vc.getAlternateAlleles().size()); return attributes; @@ -674,7 +665,7 @@ public abstract class GenotypingEngine MLEfrequencies = new ArrayList(alleleCountsofMLE.size()); + final ArrayList MLEfrequencies = new ArrayList<>(alleleCountsofMLE.size()); // the MLEAC is allowed to be larger than the AN (e.g. in the case of all PLs being 0, the GT is ./. but the exact model may arbitrarily choose an AC>1) for (final int AC : alleleCountsofMLE ) MLEfrequencies.add(Math.min(1.0, (double)AC / (double)AN)); diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java index 66be00a08..9f8e88fac 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java @@ -69,6 +69,7 @@ import org.broadinstitute.gatk.utils.pileup.PileupElement; import org.broadinstitute.gatk.utils.pileup.ReadBackedPileup; import org.broadinstitute.gatk.utils.pileup.ReadBackedPileupImpl; import htsjdk.variant.variantcontext.*; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import java.util.*; @@ -202,7 +203,7 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC gb.DP(sampleData.depth); gb.alleles(noCall); if (UAC.annotateAllSitesWithPLs) - gb.attribute(UnifiedGenotypingEngine.PL_FOR_ALL_SNP_ALLELES_KEY,GenotypeLikelihoods.fromLog10Likelihoods(MathUtils.normalizeFromLog10(allLikelihoods, false, true))); + gb.attribute(GATKVCFConstants.PL_FOR_ALL_SNP_ALLELES_KEY,GenotypeLikelihoods.fromLog10Likelihoods(MathUtils.normalizeFromLog10(allLikelihoods, false, true))); genotypes.add(gb.make()); } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotyper.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotyper.java index 2f23f4852..b3fe7867a 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotyper.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotyper.java @@ -79,6 +79,8 @@ import org.broadinstitute.gatk.utils.exceptions.UserException; import org.broadinstitute.gatk.utils.help.DocumentedGATKFeature; import org.broadinstitute.gatk.utils.help.HelpConstants; import org.broadinstitute.gatk.utils.sam.ReadUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import java.io.PrintStream; @@ -336,20 +338,19 @@ public class UnifiedGenotyper extends LocusWalker, Unif // add the pool values for each genotype if (UAC.genotypeArgs.samplePloidy != GATKVariantContextUtils.DEFAULT_PLOIDY) { - headerInfo.add(new VCFFormatHeaderLine(VCFConstants.MLE_PER_SAMPLE_ALLELE_COUNT_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Integer, "Maximum likelihood expectation (MLE) for the alternate allele count, in the same order as listed, for each individual sample")); - headerInfo.add(new VCFFormatHeaderLine(VCFConstants.MLE_PER_SAMPLE_ALLELE_FRACTION_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Maximum likelihood expectation (MLE) for the alternate allele fraction, in the same order as listed, for each individual sample")); + headerInfo.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.MLE_PER_SAMPLE_ALLELE_COUNT_KEY)); + headerInfo.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.MLE_PER_SAMPLE_ALLELE_FRACTION_KEY)); } if (UAC.referenceSampleName != null) { - headerInfo.add(new VCFInfoHeaderLine(VCFConstants.REFSAMPLE_DEPTH_KEY, 1, VCFHeaderLineType.Integer, "Total reference sample depth")); + headerInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.REFSAMPLE_DEPTH_KEY)); } if (UAC.annotateAllSitesWithPLs) { - headerInfo.add(new VCFFormatHeaderLine(UnifiedGenotypingEngine.PL_FOR_ALL_SNP_ALLELES_KEY, 10, VCFHeaderLineType.Integer, "Phred-scaled genotype likelihoods for all 4 possible bases regardless of whether there is statistical evidence for them. Ordering is always PL for AA AC CC GA GC GG TA TC TG TT.")); + headerInfo.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.PL_FOR_ALL_SNP_ALLELES_KEY)); } - VCFStandardHeaderLines.addStandardInfoLines(headerInfo, true, - VCFConstants.DOWNSAMPLED_KEY, - VCFConstants.MLE_ALLELE_COUNT_KEY, - VCFConstants.MLE_ALLELE_FREQUENCY_KEY); + headerInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.DOWNSAMPLED_KEY)); + headerInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.MLE_ALLELE_COUNT_KEY)); + headerInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.MLE_ALLELE_FREQUENCY_KEY)); // also, check to see whether comp rods were included if ( dbsnp != null && dbsnp.dbsnp.isBound() ) @@ -364,7 +365,7 @@ public class UnifiedGenotyper extends LocusWalker, Unif // FILTER fields are added unconditionally as it's not always 100% certain the circumstances // where the filters are used. For example, in emitting all sites the lowQual field is used - headerInfo.add(new VCFFilterHeaderLine(UnifiedGenotypingEngine.LOW_QUAL_FILTER_NAME, "Low quality")); + headerInfo.add(GATKVCFHeaderLines.getFilterLine(GATKVCFConstants.LOW_QUAL_FILTER_NAME)); return headerInfo; } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotypingEngine.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotypingEngine.java index 1753bb294..b51f96735 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotypingEngine.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/UnifiedGenotypingEngine.java @@ -83,8 +83,6 @@ import java.util.*; */ public class UnifiedGenotypingEngine extends GenotypingEngine { - public static final String PL_FOR_ALL_SNP_ALLELES_KEY = "APL"; - private static final int SNP_MODEL = 0; private static final int INDEL_MODEL = 1; diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/afcalc/ExactAFCalculator.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/afcalc/ExactAFCalculator.java index fe5f0c2e0..3437c6da3 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/afcalc/ExactAFCalculator.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/afcalc/ExactAFCalculator.java @@ -52,6 +52,7 @@ package org.broadinstitute.gatk.tools.walkers.genotyper.afcalc; import org.broadinstitute.gatk.utils.MathUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import htsjdk.variant.variantcontext.*; @@ -80,9 +81,9 @@ abstract class ExactAFCalculator extends AFCalculator { protected static final Comparator LIKELIHOOD_NON_REF_THEN_SUM_COMPARATOR = new Comparator() { @Override public int compare(final LikelihoodSum o1, final LikelihoodSum o2) { - if (o1.allele == GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE) + if (o1.allele == GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE) return 1; - else if (o2.allele == GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE) + else if (o2.allele == GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE) return -1; else return o1.compareTo(o2); @@ -182,7 +183,7 @@ abstract class ExactAFCalculator extends AFCalculator { final int numOriginalAltAlleles = vc.getAlternateAlleles().size(); final int nonRefAltAlleleIndex = GATKVariantContextUtils.indexOfAltAllele(vc, - GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE, false); + GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE, false); final boolean nonRefAltAllelePresent = nonRefAltAlleleIndex >= 0; // should not be considered in the downsizing, so we need to count it out when diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/afcalc/IndependentAllelesDiploidExactAFCalculator.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/afcalc/IndependentAllelesDiploidExactAFCalculator.java index 5dda21ebc..4ca9d7a56 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/afcalc/IndependentAllelesDiploidExactAFCalculator.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/genotyper/afcalc/IndependentAllelesDiploidExactAFCalculator.java @@ -56,7 +56,7 @@ import com.google.java.contract.Requires; import htsjdk.variant.variantcontext.*; import org.broadinstitute.gatk.tools.walkers.genotyper.GenotypeLikelihoodCalculators; import org.broadinstitute.gatk.utils.MathUtils; -import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import java.util.*; @@ -195,7 +195,7 @@ import java.util.*; else { final VariantContextBuilder vcb = new VariantContextBuilder(vc); final Allele reference = vcb.getAlleles().get(0); - vcb.alleles(Arrays.asList(reference, GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE)); + vcb.alleles(Arrays.asList(reference, GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE)); final int genotypeCount = GenotypeLikelihoodCalculators.genotypeCount(2, vc.getNAlleles()); final double[] hetLikelihoods = new double[vc.getNAlleles() - 1]; final double[] homAltLikelihoods = new double[genotypeCount - hetLikelihoods.length - 1]; @@ -213,7 +213,7 @@ import java.util.*; else if (oldAllele.isNoCall()) newAlleles.add(Allele.NO_CALL); else - newAlleles.add(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + newAlleles.add(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); } gb.alleles(newAlleles); } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCaller.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCaller.java index 24037760e..8af31a22c 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCaller.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCaller.java @@ -101,9 +101,7 @@ import org.broadinstitute.gatk.utils.pairhmm.PairHMM; import org.broadinstitute.gatk.utils.sam.AlignmentUtils; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; import org.broadinstitute.gatk.utils.sam.ReadUtils; -import org.broadinstitute.gatk.utils.variant.GATKVCFIndexType; -import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; -import org.broadinstitute.gatk.utils.variant.HomoSapiensConstants; +import org.broadinstitute.gatk.utils.variant.*; import java.io.FileNotFoundException; import java.io.PrintStream; @@ -557,9 +555,6 @@ public class HaplotypeCaller extends ActiveRegionWalker, In @Argument(fullName="doNotRunPhysicalPhasing", shortName="doNotRunPhysicalPhasing", doc="Disable physical phasing", required = false) protected boolean doNotRunPhysicalPhasing = false; - public static final String HAPLOTYPE_CALLER_PHASING_ID_KEY = "PID"; - public static final String HAPLOTYPE_CALLER_PHASING_GT_KEY = "PGT"; - // ----------------------------------------------------------------------------------------------- // arguments for debugging / developing the haplotype caller // ----------------------------------------------------------------------------------------------- @@ -812,10 +807,9 @@ public class HaplotypeCaller extends ActiveRegionWalker, In // all annotation fields from VariantAnnotatorEngine headerInfo.addAll(annotationEngine.getVCFAnnotationDescriptions()); // all callers need to add these standard annotation header lines - VCFStandardHeaderLines.addStandardInfoLines(headerInfo, true, - VCFConstants.DOWNSAMPLED_KEY, - VCFConstants.MLE_ALLELE_COUNT_KEY, - VCFConstants.MLE_ALLELE_FREQUENCY_KEY); + headerInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.DOWNSAMPLED_KEY)); + headerInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.MLE_ALLELE_COUNT_KEY)); + headerInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.MLE_ALLELE_FREQUENCY_KEY)); // all callers need to add these standard FORMAT field header lines VCFStandardHeaderLines.addStandardFormatLines(headerInfo, true, VCFConstants.GENOTYPE_KEY, @@ -824,13 +818,13 @@ public class HaplotypeCaller extends ActiveRegionWalker, In VCFConstants.GENOTYPE_PL_KEY); if ( ! doNotRunPhysicalPhasing ) { - headerInfo.add(new VCFFormatHeaderLine(HAPLOTYPE_CALLER_PHASING_ID_KEY, 1, VCFHeaderLineType.String, "Physical phasing ID information, where each unique ID within a given sample (but not across samples) connects records within a phasing group")); - headerInfo.add(new VCFFormatHeaderLine(HAPLOTYPE_CALLER_PHASING_GT_KEY, 1, VCFHeaderLineType.String, "Physical phasing haplotype information, describing how the alternate alleles are phased in relation to one another")); + headerInfo.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.HAPLOTYPE_CALLER_PHASING_ID_KEY)); + headerInfo.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.HAPLOTYPE_CALLER_PHASING_GT_KEY)); } // FILTER fields are added unconditionally as it's not always 100% certain the circumstances // where the filters are used. For example, in emitting all sites the lowQual field is used - headerInfo.add(new VCFFilterHeaderLine(UnifiedGenotypingEngine.LOW_QUAL_FILTER_NAME, "Low quality")); + headerInfo.add(GATKVCFHeaderLines.getFilterLine(GATKVCFConstants.LOW_QUAL_FILTER_NAME)); initializeReferenceConfidenceModel(samplesList, headerInfo); diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerGenotypingEngine.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerGenotypingEngine.java index 2f9dfa288..7d439428b 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerGenotypingEngine.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerGenotypingEngine.java @@ -68,6 +68,7 @@ import org.broadinstitute.gatk.utils.genotyper.ReadLikelihoods; import org.broadinstitute.gatk.utils.haplotype.EventMap; import org.broadinstitute.gatk.utils.haplotype.Haplotype; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import java.util.*; @@ -121,7 +122,7 @@ public class HaplotypeCallerGenotypingEngine extends GenotypingEngine phasedGenotypes = new ArrayList<>(); for ( final Genotype g : vc.getGenotypes() ) - phasedGenotypes.add(new GenotypeBuilder(g).attribute(HaplotypeCaller.HAPLOTYPE_CALLER_PHASING_ID_KEY, ID).attribute(HaplotypeCaller.HAPLOTYPE_CALLER_PHASING_GT_KEY, phaseGT).make()); + phasedGenotypes.add(new GenotypeBuilder(g).attribute(GATKVCFConstants.HAPLOTYPE_CALLER_PHASING_ID_KEY, ID).attribute(GATKVCFConstants.HAPLOTYPE_CALLER_PHASING_GT_KEY, phaseGT).make()); return new VariantContextBuilder(vc).genotypes(phasedGenotypes).make(); } @@ -523,7 +524,7 @@ public class HaplotypeCallerGenotypingEngine extends GenotypingEngine originalList = mergedVC.getAlleles(); final List alleleList = new ArrayList<>(originalList.size() + 1); alleleList.addAll(mergedVC.getAlleles()); - alleleList.add(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + alleleList.add(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); vcb.alleles(alleleList); return vcb.make(); } @@ -552,7 +553,7 @@ public class HaplotypeCallerGenotypingEngine extends GenotypingEngine getVCFHeaderLines() { final Set 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 VCFSimpleHeaderLine(ALTERNATE_ALLELE_STRING, GATKVCFConstants.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; } @@ -215,7 +216,7 @@ public class ReferenceConfidenceModel { homRefCalc.capByHomRefLikelihood(); final Allele refAllele = Allele.create(refBase, true); - final List refSiteAlleles = Arrays.asList(refAllele, GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + final List refSiteAlleles = Arrays.asList(refAllele, GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); final VariantContextBuilder vcb = new VariantContextBuilder("HC", curPos.getContig(), curPos.getStart(), curPos.getStart(), refSiteAlleles); final GenotypeBuilder gb = new GenotypeBuilder(sampleName, GATKVariantContextUtils.homozygousAlleleList(refAllele, ploidy)); gb.AD(homRefCalc.AD_Ref_Any); @@ -320,7 +321,7 @@ public class ReferenceConfidenceModel { public RefVsAnyResult calcGenotypeLikelihoodsOfRefVsAny(final String sampleName, final int ploidy, final GenotypingModel genotypingModel, final ReadBackedPileup pileup, final byte refBase, final byte minBaseQual, final MathUtils.RunningAverage hqSoftClips) { - final AlleleList alleleList = new IndexedAlleleList<>(Allele.create(refBase,true),GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + final AlleleList alleleList = new IndexedAlleleList<>(Allele.create(refBase,true), GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); // Notice that the sample name is rather irrelevant as this information is never used, just need to be the same in both lines bellow. final int maximumReadCount = pileup.getReads().size(); diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/PhaseByTransmission.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/PhaseByTransmission.java index c01bb9cce..a2bd36ad3 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/PhaseByTransmission.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/PhaseByTransmission.java @@ -65,6 +65,8 @@ import org.broadinstitute.gatk.utils.QualityUtils; import org.broadinstitute.gatk.engine.SampleUtils; import org.broadinstitute.gatk.utils.help.HelpConstants; import org.broadinstitute.gatk.engine.GATKVCFUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import htsjdk.variant.vcf.*; import org.broadinstitute.gatk.utils.help.DocumentedGATKFeature; @@ -146,7 +148,6 @@ public class PhaseByTransmission extends RodWalker, HashMa @Output protected VariantContextWriter vcfWriter = null; - private final String TRANSMISSION_PROBABILITY_TAG_NAME = "TP"; private final String SOURCE_NAME = "PhaseByTransmission"; public final double NO_TRANSMISSION_PROB = -1.0; @@ -414,7 +415,7 @@ public class PhaseByTransmission extends RodWalker, HashMa Map genotypeAttributes = new HashMap(); genotypeAttributes.putAll(genotype.getExtendedAttributes()); if(transmissionProb>NO_TRANSMISSION_PROB) - genotypeAttributes.put(TRANSMISSION_PROBABILITY_TAG_NAME, phredScoreTransmission); + genotypeAttributes.put(GATKVCFConstants.TRANSMISSION_PROBABILITY_KEY, phredScoreTransmission); ArrayList phasedAlleles = new ArrayList(2); for(Allele allele : phasedGenotype.getAlleles()){ @@ -461,7 +462,7 @@ public class PhaseByTransmission extends RodWalker, HashMa Set headerLines = new HashSet(); headerLines.addAll(GATKVCFUtils.getHeaderFields(this.getToolkit())); - headerLines.add(new VCFFormatHeaderLine(TRANSMISSION_PROBABILITY_TAG_NAME, 1, VCFHeaderLineType.Integer, "Phred score of the genotype combination and phase given that the genotypes are correct")); + headerLines.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.TRANSMISSION_PROBABILITY_KEY)); headerLines.add(new VCFHeaderLine("source", SOURCE_NAME)); vcfWriter.writeHeader(new VCFHeader(headerLines, vcfSamples)); @@ -879,7 +880,7 @@ public class PhaseByTransmission extends RodWalker, HashMa updateTrioMetricsCounters(phasedMother,phasedFather,phasedChild,mvCount,metricsCounters); mvfLine = String.format("%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s", vc.getChr(),vc.getStart(),vc.getAttribute(VCFConstants.ALLELE_COUNT_KEY),sample.getFamilyID(), - phasedMother.getExtendedAttribute(TRANSMISSION_PROBABILITY_TAG_NAME),phasedMother.getGenotypeString(),phasedMother.getDP(),printAD(phasedMother.getAD()), + phasedMother.getExtendedAttribute(GATKVCFConstants.TRANSMISSION_PROBABILITY_KEY),phasedMother.getGenotypeString(),phasedMother.getDP(),printAD(phasedMother.getAD()), phasedMother.getLikelihoodsString(), phasedFather.getGenotypeString(),phasedFather.getDP(),printAD(phasedFather.getAD()),phasedFather.getLikelihoodsString(), phasedChild.getGenotypeString(),phasedChild.getDP(),printAD(phasedChild.getAD()),phasedChild.getLikelihoodsString()); if(!(phasedMother.getType()==mother.getType() && phasedFather.getType()==father.getType() && phasedChild.getType()==child.getType())) @@ -891,7 +892,7 @@ public class PhaseByTransmission extends RodWalker, HashMa metricsCounters.put(NUM_GENOTYPES_MODIFIED,metricsCounters.get(NUM_GENOTYPES_MODIFIED)+1); mvfLine = String.format("%s\t%d\t%s\t%s\t%s\t%s:%s:%s:%s\t.\t.\t.\t.\t%s\t%s\t%s\t%s", vc.getChr(),vc.getStart(),vc.getAttribute(VCFConstants.ALLELE_COUNT_KEY),sample.getFamilyID(), - phasedMother.getExtendedAttribute(TRANSMISSION_PROBABILITY_TAG_NAME),phasedMother.getGenotypeString(),phasedMother.getDP(),printAD(phasedMother.getAD()),phasedMother.getLikelihoodsString(), + phasedMother.getExtendedAttribute(GATKVCFConstants.TRANSMISSION_PROBABILITY_KEY),phasedMother.getGenotypeString(),phasedMother.getDP(),printAD(phasedMother.getAD()),phasedMother.getLikelihoodsString(), phasedChild.getGenotypeString(),phasedChild.getDP(),printAD(phasedChild.getAD()),phasedChild.getLikelihoodsString()); } } @@ -902,7 +903,7 @@ public class PhaseByTransmission extends RodWalker, HashMa metricsCounters.put(NUM_GENOTYPES_MODIFIED,metricsCounters.get(NUM_GENOTYPES_MODIFIED)+1); mvfLine = String.format("%s\t%d\t%s\t%s\t%s\t.\t.\t.\t.\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s", vc.getChr(),vc.getStart(),vc.getAttribute(VCFConstants.ALLELE_COUNT_KEY),sample.getFamilyID(), - phasedFather.getExtendedAttribute(TRANSMISSION_PROBABILITY_TAG_NAME),phasedFather.getGenotypeString(),phasedFather.getDP(),printAD(phasedFather.getAD()),phasedFather.getLikelihoodsString(), + phasedFather.getExtendedAttribute(GATKVCFConstants.TRANSMISSION_PROBABILITY_KEY),phasedFather.getGenotypeString(),phasedFather.getDP(),printAD(phasedFather.getAD()),phasedFather.getLikelihoodsString(), phasedChild.getGenotypeString(),phasedChild.getDP(),printAD(phasedChild.getAD()),phasedChild.getLikelihoodsString()); } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/PhasingUtils.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/PhasingUtils.java index df70f8458..686cd6d87 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/PhasingUtils.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/PhasingUtils.java @@ -56,6 +56,7 @@ import htsjdk.samtools.util.StringUtil; import org.broadinstitute.gatk.utils.GenomeLoc; import org.broadinstitute.gatk.utils.GenomeLocParser; import org.broadinstitute.gatk.utils.Utils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import htsjdk.variant.vcf.VCFConstants; import htsjdk.variant.variantcontext.*; @@ -116,11 +117,9 @@ class PhasingUtils { // locations of the same HP attribute in gt2 to gt2 final int[] site1ToSite2Inds = new int[numAlleles]; - // If both genotypes have read-backed phasing haplotype identifiers (HP) - // Find the gt1 and gt2 alleles with the same haplotpe - if (gt1.hasAnyAttribute(ReadBackedPhasing.HP_KEY) && gt2.hasAnyAttribute(ReadBackedPhasing.HP_KEY)) { - final String[] hp1 = (String[]) gt1.getAnyAttribute(ReadBackedPhasing.HP_KEY); - final String[] hp2 = (String[]) gt2.getAnyAttribute(ReadBackedPhasing.HP_KEY); + if (gt1.hasAnyAttribute(GATKVCFConstants.RBP_HAPLOTYPE_KEY) && gt2.hasAnyAttribute(GATKVCFConstants.RBP_HAPLOTYPE_KEY)) { + final String[] hp1 = (String[]) gt1.getAnyAttribute(GATKVCFConstants.RBP_HAPLOTYPE_KEY); + final String[] hp2 = (String[]) gt2.getAnyAttribute(GATKVCFConstants.RBP_HAPLOTYPE_KEY); // Map of HP attribute to it's array index final HashMap hpNameToSite1Inds = new HashMap(); @@ -204,21 +203,20 @@ class PhasingUtils { // get the min read backed phasing quality double PQ = Double.MAX_VALUE; - if (gt1.hasAnyAttribute(ReadBackedPhasing.PQ_KEY)) { - PQ = Math.min(PQ, (double) gt1.getAnyAttribute(ReadBackedPhasing.PQ_KEY)); + if (gt1.hasAnyAttribute(VCFConstants.PHASE_QUALITY_KEY)) { + PQ = Math.min(PQ, (double) gt1.getAnyAttribute(VCFConstants.PHASE_QUALITY_KEY)); } - if (gt2.hasAnyAttribute(ReadBackedPhasing.PQ_KEY)) { - PQ = Math.min(PQ, (double) gt2.getAnyAttribute(ReadBackedPhasing.PQ_KEY)); + if (gt2.hasAnyAttribute(VCFConstants.PHASE_QUALITY_KEY)) { + PQ = Math.min(PQ, (double) gt2.getAnyAttribute(VCFConstants.PHASE_QUALITY_KEY)); } if (PQ != Double.MAX_VALUE) - mergedGtAttribs.put(ReadBackedPhasing.PQ_KEY, PQ); + mergedGtAttribs.put(VCFConstants.PHASE_QUALITY_KEY, PQ); - // get the read backed phasing phasing haplotype identifier - if (gt1.hasAnyAttribute(ReadBackedPhasing.HP_KEY)) { - mergedGtAttribs.put(ReadBackedPhasing.HP_KEY, gt1.getAnyAttribute(ReadBackedPhasing.HP_KEY)); + if (gt1.hasAnyAttribute(GATKVCFConstants.RBP_HAPLOTYPE_KEY)) { + mergedGtAttribs.put(GATKVCFConstants.RBP_HAPLOTYPE_KEY, gt1.getAnyAttribute(GATKVCFConstants.RBP_HAPLOTYPE_KEY)); } - else if (gt2.hasAnyAttribute(ReadBackedPhasing.HP_KEY)) { // gt1 doesn't have, but merged (so gt1 is hom and can take gt2's haplotype names): - mergedGtAttribs.put(ReadBackedPhasing.HP_KEY, gt2.getAnyAttribute(ReadBackedPhasing.HP_KEY)); + else if (gt2.hasAnyAttribute(GATKVCFConstants.RBP_HAPLOTYPE_KEY)) { // gt1 doesn't have, but merged (so gt1 is hom and can take gt2's haplotype names): + mergedGtAttribs.put(GATKVCFConstants.RBP_HAPLOTYPE_KEY, gt2.getAnyAttribute(GATKVCFConstants.RBP_HAPLOTYPE_KEY)); } // make the merged genotype @@ -378,12 +376,12 @@ class PhasingUtils { return true; // If gt1 or gt2 do not have a read backed phasing haplotype, then can not be merged - if (!gt1.hasAnyAttribute(ReadBackedPhasing.HP_KEY) || !gt2.hasAnyAttribute(ReadBackedPhasing.HP_KEY)) + if (!gt1.hasAnyAttribute(GATKVCFConstants.RBP_HAPLOTYPE_KEY) || !gt2.hasAnyAttribute(GATKVCFConstants.RBP_HAPLOTYPE_KEY)) return false; // If gt1 or gt2 do not same number of HP attributes as chromosomes, then can not be merged. - final String[] hp1 = (String[]) gt1.getAnyAttribute(ReadBackedPhasing.HP_KEY); - final String[] hp2 = (String[]) gt2.getAnyAttribute(ReadBackedPhasing.HP_KEY); + final String[] hp1 = (String[]) gt1.getAnyAttribute(GATKVCFConstants.RBP_HAPLOTYPE_KEY); + final String[] hp2 = (String[]) gt2.getAnyAttribute(GATKVCFConstants.RBP_HAPLOTYPE_KEY); if (hp1.length != gt1.getPloidy() || hp2.length != gt2.getPloidy()) return false; diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/ReadBackedPhasing.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/ReadBackedPhasing.java index e8ccaf842..c501d842a 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/ReadBackedPhasing.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/ReadBackedPhasing.java @@ -65,6 +65,8 @@ import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker; import org.broadinstitute.gatk.utils.help.HelpConstants; import org.broadinstitute.gatk.utils.sam.ReadUtils; import org.broadinstitute.gatk.engine.GATKVCFUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import org.broadinstitute.gatk.utils.BaseUtils; import org.broadinstitute.gatk.utils.GenomeLoc; @@ -179,15 +181,10 @@ public class ReadBackedPhasing extends RodWalker KEYS_TO_KEEP_IN_REDUCED_VCF = new HashSet(Arrays.asList(PQ_KEY)); + private static final Set KEYS_TO_KEEP_IN_REDUCED_VCF = new HashSet<>(Arrays.asList(VCFConstants.PHASE_QUALITY_KEY)); private VariantContext reduceVCToSamples(VariantContext vc, Set samplesToPhase) { // for ( String sample : samplesToPhase ) @@ -445,15 +442,15 @@ public class ReadBackedPhasing extends RodWalker headerLines = VCFUtils.smartMergeHeaders(header.values(), true); headerLines.add(new VCFHeaderLine("source", "GenotypeAndValidate")); - headerLines.add(new VCFInfoHeaderLine("callStatus", 1, VCFHeaderLineType.String, "Value from the validation VCF")); + headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.GENOTYPE_AND_VALIDATE_STATUS_KEY)); vcfWriter.writeHeader(new VCFHeader(headerLines, samples)); } @@ -496,8 +498,8 @@ public class GenotypeAndValidate extends RodWalker implements T public static void addVQSRStandardHeaderLines(final Set hInfo) { hInfo.add(VCFStandardHeaderLines.getInfoLine(VCFConstants.END_KEY)); - hInfo.add(new VCFInfoHeaderLine(VariantRecalibrator.VQS_LOD_KEY, 1, VCFHeaderLineType.Float, "Log odds ratio of being a true variant versus being false under the trained gaussian mixture model")); - hInfo.add(new VCFInfoHeaderLine(VariantRecalibrator.CULPRIT_KEY, 1, VCFHeaderLineType.String, "The annotation which was the worst performing in the Gaussian mixture model, likely the reason why the variant was filtered out")); - hInfo.add(new VCFInfoHeaderLine(VariantRecalibrator.POSITIVE_LABEL_KEY, 1, VCFHeaderLineType.Flag, "This variant was used to build the positive training set of good variants")); - hInfo.add(new VCFInfoHeaderLine(VariantRecalibrator.NEGATIVE_LABEL_KEY, 1, VCFHeaderLineType.Flag, "This variant was used to build the negative training set of bad variants")); + hInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.VQS_LOD_KEY)); + hInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.CULPRIT_KEY)); + hInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.POSITIVE_LABEL_KEY)); + hInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.NEGATIVE_LABEL_KEY)); } //--------------------------------------------------------------------------------------------------------------- @@ -285,7 +287,7 @@ public class ApplyRecalibration extends RodWalker implements T throw new UserException("Encountered input variant which isn't found in the input recal file. Please make sure VariantRecalibrator and ApplyRecalibration were run on the same set of input variants. First seen at: " + vc ); } - final String lodString = recalDatum.getAttributeAsString(VariantRecalibrator.VQS_LOD_KEY, null); + final String lodString = recalDatum.getAttributeAsString(GATKVCFConstants.VQS_LOD_KEY, null); if( lodString == null ) { throw new UserException("Encountered a malformed record in the input recal file. There is no lod for the record at: " + vc ); } @@ -299,12 +301,12 @@ public class ApplyRecalibration extends RodWalker implements T VariantContextBuilder builder = new VariantContextBuilder(vc); // Annotate the new record with its VQSLOD and the worst performing annotation - builder.attribute(VariantRecalibrator.VQS_LOD_KEY, lod); - builder.attribute(VariantRecalibrator.CULPRIT_KEY, recalDatum.getAttribute(VariantRecalibrator.CULPRIT_KEY)); - if ( recalDatum.hasAttribute(VariantRecalibrator.POSITIVE_LABEL_KEY)) - builder.attribute(VariantRecalibrator.POSITIVE_LABEL_KEY, true); - if ( recalDatum.hasAttribute(VariantRecalibrator.NEGATIVE_LABEL_KEY)) - builder.attribute(VariantRecalibrator.NEGATIVE_LABEL_KEY, true); + builder.attribute(GATKVCFConstants.VQS_LOD_KEY, lod); + builder.attribute(GATKVCFConstants.CULPRIT_KEY, recalDatum.getAttribute(GATKVCFConstants.CULPRIT_KEY)); + if ( recalDatum.hasAttribute(GATKVCFConstants.POSITIVE_LABEL_KEY)) + builder.attribute(GATKVCFConstants.POSITIVE_LABEL_KEY, true); + if ( recalDatum.hasAttribute(GATKVCFConstants.NEGATIVE_LABEL_KEY)) + builder.attribute(GATKVCFConstants.NEGATIVE_LABEL_KEY, true); final String filterString = generateFilterString(lod); diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantrecalibration/VariantDataManager.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantrecalibration/VariantDataManager.java index 2be4ec01d..febef6138 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantrecalibration/VariantDataManager.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantrecalibration/VariantDataManager.java @@ -66,6 +66,7 @@ import org.broadinstitute.gatk.utils.exceptions.UserException; import htsjdk.variant.variantcontext.Allele; import htsjdk.variant.variantcontext.VariantContext; import htsjdk.variant.variantcontext.VariantContextBuilder; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import java.util.*; @@ -428,11 +429,11 @@ public class VariantDataManager { for( final VariantDatum datum : data ) { VariantContextBuilder builder = new VariantContextBuilder("VQSR", datum.loc.getContig(), datum.loc.getStart(), datum.loc.getStop(), alleles); builder.attribute(VCFConstants.END_KEY, datum.loc.getStop()); - builder.attribute(VariantRecalibrator.VQS_LOD_KEY, String.format("%.4f", datum.lod)); - builder.attribute(VariantRecalibrator.CULPRIT_KEY, (datum.worstAnnotation != -1 ? annotationKeys.get(datum.worstAnnotation) : "NULL")); + builder.attribute(GATKVCFConstants.VQS_LOD_KEY, String.format("%.4f", datum.lod)); + builder.attribute(GATKVCFConstants.CULPRIT_KEY, (datum.worstAnnotation != -1 ? annotationKeys.get(datum.worstAnnotation) : "NULL")); - if ( datum.atTrainingSite ) builder.attribute(VariantRecalibrator.POSITIVE_LABEL_KEY, true); - if ( datum.atAntiTrainingSite ) builder.attribute(VariantRecalibrator.NEGATIVE_LABEL_KEY, true); + if ( datum.atTrainingSite ) builder.attribute(GATKVCFConstants.POSITIVE_LABEL_KEY, true); + if ( datum.atAntiTrainingSite ) builder.attribute(GATKVCFConstants.NEGATIVE_LABEL_KEY, true); recalWriter.add(builder.make()); } diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantrecalibration/VariantRecalibrator.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantrecalibration/VariantRecalibrator.java index 0d7127ede..dd0a4acff 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantrecalibration/VariantRecalibrator.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantrecalibration/VariantRecalibrator.java @@ -156,10 +156,6 @@ import java.util.*; @PartitionBy(PartitionType.NONE) public class VariantRecalibrator extends RodWalker, ExpandingArrayList> implements TreeReducible> { - public static final String VQS_LOD_KEY = "VQSLOD"; // Log odds ratio of being a true variant versus being false under the trained gaussian mixture model - public static final String CULPRIT_KEY = "culprit"; // The annotation which was the worst performing in the Gaussian mixture model, likely the reason why the variant was filtered out - public static final String NEGATIVE_LABEL_KEY = "NEGATIVE_TRAIN_SITE"; // this variant was used in the negative training set - public static final String POSITIVE_LABEL_KEY = "POSITIVE_TRAIN_SITE"; // this variant was used in the positive training set private static final String PLOT_TRANCHES_RSCRIPT = "plot_Tranches.R"; @ArgumentCollection private VariantRecalibratorArgumentCollection VRAC = new VariantRecalibratorArgumentCollection(); diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CalculateGenotypePosteriors.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CalculateGenotypePosteriors.java index 99e1b21a0..421cb8386 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CalculateGenotypePosteriors.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CalculateGenotypePosteriors.java @@ -66,6 +66,8 @@ import org.broadinstitute.gatk.utils.exceptions.UserException; import org.broadinstitute.gatk.utils.help.DocumentedGATKFeature; import org.broadinstitute.gatk.utils.help.HelpConstants; import org.broadinstitute.gatk.engine.GATKVCFUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import org.broadinstitute.gatk.utils.variant.HomoSapiensConstants; import htsjdk.variant.variantcontext.*; @@ -195,7 +197,7 @@ public class CalculateGenotypePosteriors extends RodWalker { * be used to inform the frequency distribution underying the genotype priors. */ @Input(fullName="supporting", shortName = "supporting", doc="Other callsets to use in generating genotype posteriors", required=false) - public List> supportVariants = new ArrayList>(); + public List> supportVariants = new ArrayList<>(); /** * The global prior of a variant site -- i.e. the expected allele frequency distribution knowing only that N alleles @@ -262,10 +264,6 @@ public class CalculateGenotypePosteriors extends RodWalker { @Output(doc="File to which variants should be written") protected VariantContextWriter vcfWriter = null; - private final String JOINT_LIKELIHOOD_TAG_NAME = "JL"; - private final String JOINT_POSTERIOR_TAG_NAME = "JP"; - private final String PHRED_SCALED_POSTERIORS_KEY = "PP"; - private FamilyLikelihoodsUtils famUtils = new FamilyLikelihoodsUtils(); public void initialize() { @@ -294,8 +292,8 @@ public class CalculateGenotypePosteriors extends RodWalker { throw new UserException("VCF has no genotypes"); } - if ( header.hasInfoLine(VCFConstants.MLE_ALLELE_COUNT_KEY) ) { - final VCFInfoHeaderLine mleLine = header.getInfoHeaderLine(VCFConstants.MLE_ALLELE_COUNT_KEY); + if ( header.hasInfoLine(GATKVCFConstants.MLE_ALLELE_COUNT_KEY) ) { + final VCFInfoHeaderLine mleLine = header.getInfoHeaderLine(GATKVCFConstants.MLE_ALLELE_COUNT_KEY); if ( mleLine.getCountType() != VCFHeaderLineCount.A ) { throw new UserException("VCF does not have a properly formatted MLEAC field: the count type should be \"A\""); } @@ -307,11 +305,11 @@ public class CalculateGenotypePosteriors extends RodWalker { // Initialize VCF header final Set headerLines = VCFUtils.smartMergeHeaders(vcfRods.values(), true); - headerLines.add(new VCFFormatHeaderLine(PHRED_SCALED_POSTERIORS_KEY, VCFHeaderLineCount.G, VCFHeaderLineType.Integer, "Phred-scaled Posterior Genotype Probabilities")); - headerLines.add(new VCFInfoHeaderLine("PG", VCFHeaderLineCount.G, VCFHeaderLineType.Integer, "Genotype Likelihood Prior")); + headerLines.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY)); + headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.GENOTYPE_PRIOR_KEY)); if (!skipFamilyPriors) { - headerLines.add(new VCFFormatHeaderLine(JOINT_LIKELIHOOD_TAG_NAME, 1, VCFHeaderLineType.Integer, "Phred-scaled joint likelihood of the genotype combination (before applying family priors)")); - headerLines.add(new VCFFormatHeaderLine(JOINT_POSTERIOR_TAG_NAME, 1, VCFHeaderLineType.Integer, "Phred-scaled joint posterior probability of the genotype combination (after applying family priors)")); + headerLines.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.JOINT_LIKELIHOOD_TAG_NAME)); + headerLines.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.JOINT_POSTERIOR_TAG_NAME)); } headerLines.add(new VCFHeaderLine("source", "CalculateGenotypePosteriors")); diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CombineGVCFs.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CombineGVCFs.java index a428b6ab8..60d88739d 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CombineGVCFs.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CombineGVCFs.java @@ -65,6 +65,7 @@ import org.broadinstitute.gatk.engine.SampleUtils; import org.broadinstitute.gatk.utils.help.DocumentedGATKFeature; import org.broadinstitute.gatk.utils.help.HelpConstants; import org.broadinstitute.gatk.engine.GATKVCFUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import htsjdk.variant.variantcontext.*; import htsjdk.variant.variantcontext.writer.VariantContextWriter; @@ -338,7 +339,7 @@ public class CombineGVCFs extends RodWalker>> mvCountMatrix = - new EnumMap>>(GenotypeType.class); + new EnumMap<>(GenotypeType.class); final int NUM_CALLED_GENOTYPETYPES = 3; //HOM_REF, HET, and HOM_VAR double[] configurationLikelihoodsMatrix = new double[NUM_CALLED_GENOTYPETYPES*NUM_CALLED_GENOTYPETYPES*NUM_CALLED_GENOTYPETYPES]; - ArrayList trios = new ArrayList(); - - private final String JOINT_LIKELIHOOD_TAG_NAME = "JL"; - private final String JOINT_POSTERIOR_TAG_NAME = "JP"; - private final String PHRED_SCALED_POSTERIORS_KEY = "PP"; + ArrayList trios = new ArrayList<>(); public final double NO_JOINT_VALUE = -1.0; @@ -158,10 +155,10 @@ public class FamilyLikelihoodsUtils { } //Add the joint trio calculations - final Map genotypeAttributes = new HashMap(); + final Map genotypeAttributes = new HashMap<>(); genotypeAttributes.putAll(genotype.getExtendedAttributes()); - genotypeAttributes.put(JOINT_LIKELIHOOD_TAG_NAME, phredScaledJL); - genotypeAttributes.put(JOINT_POSTERIOR_TAG_NAME, phredScaledJP); + genotypeAttributes.put(GATKVCFConstants.JOINT_LIKELIHOOD_TAG_NAME, phredScaledJL); + genotypeAttributes.put(GATKVCFConstants.JOINT_POSTERIOR_TAG_NAME, phredScaledJP); final GenotypeBuilder builder = new GenotypeBuilder(genotype); @@ -171,7 +168,7 @@ public class FamilyLikelihoodsUtils { GATKVariantContextUtils.updateGenotypeAfterSubsetting(vc.getAlleles(), builder, GATKVariantContextUtils.GenotypeAssignmentMethod.USE_PLS_TO_ASSIGN, log10Posteriors, vc.getAlleles()); - builder.attribute(PHRED_SCALED_POSTERIORS_KEY, + builder.attribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY, Utils.listFromPrimitives(GenotypeLikelihoods.fromLog10Likelihoods(log10Posteriors).getAsPLs())); builder.attributes(genotypeAttributes); return builder.make(); @@ -231,7 +228,7 @@ public class FamilyLikelihoodsUtils { } break; default: - throw new UserException(String.format("%d does not indicate a valid trio FamilyMember -- use 0 for mother, 1 for father, 2 for child",recalcInd)); + throw new UserException(String.format("%d does not indicate a valid trio FamilyMember -- use 0 for mother, 1 for father, 2 for child",recalcInd.ordinal())); } recalcPosteriors[0] = MathUtils.log10sumLog10(marginalOverChangedHR,0); @@ -262,7 +259,7 @@ public class FamilyLikelihoodsUtils { continue; } - final ArrayList trioGenotypes = new ArrayList(3); + final ArrayList trioGenotypes = new ArrayList<>(3); updateFamilyGenotypes(vc, mother, father, child, trioGenotypes); //replace uses sample names to match genotypes, so order doesn't matter @@ -282,12 +279,12 @@ public class FamilyLikelihoodsUtils { private ArrayList setTrios(Set vcfSamples, Map> families){ Set family; ArrayList parents; - final ArrayList trios = new ArrayList(); + final ArrayList trios = new ArrayList<>(); for(final Map.Entry> familyEntry : families.entrySet()){ family = familyEntry.getValue(); // Since getFamilies(vcfSamples) above still returns parents of samples in the VCF even if those parents are not in the VCF, need to subset down here: - final Set familyMembersInVCF = new TreeSet(); + final Set familyMembersInVCF = new TreeSet<>(); for(final Sample familyMember : family){ if (vcfSamples.contains(familyMember.getID())) { familyMembersInVCF.add(familyMember); @@ -331,7 +328,7 @@ public class FamilyLikelihoodsUtils { if(child == GenotypeType.NO_CALL || child == GenotypeType.UNAVAILABLE) return 0; //Add parents with genotypes for the evaluation - final ArrayList parents = new ArrayList(); + final ArrayList parents = new ArrayList<>(); if (!(mother == GenotypeType.NO_CALL || mother == GenotypeType.UNAVAILABLE)) parents.add(mother); if (!(father == GenotypeType.NO_CALL || father == GenotypeType.UNAVAILABLE)) @@ -426,11 +423,11 @@ public class FamilyLikelihoodsUtils { //Get a Map of genotype (log10)likelihoods private EnumMap getLikelihoodsAsMapSafeNull(Genotype genotype){ - final EnumMap likelihoodsMap = new EnumMap(GenotypeType.class); + final EnumMap likelihoodsMap = new EnumMap<>(GenotypeType.class); double[] likelihoods; - if (genotype != null && hasCalledGT(genotype.getType()) && genotype.hasExtendedAttribute(PHRED_SCALED_POSTERIORS_KEY)) { - Object GPfromVCF = genotype.getExtendedAttribute(PHRED_SCALED_POSTERIORS_KEY); + if (genotype != null && hasCalledGT(genotype.getType()) && genotype.hasExtendedAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY)) { + Object GPfromVCF = genotype.getExtendedAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY); //parse the GPs into a vector of probabilities final String[] likelihoodsAsStringVector = ((String)GPfromVCF).split(","); final double[] likelihoodsAsVector = new double[likelihoodsAsStringVector.length]; diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/GenotypeGVCFs.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/GenotypeGVCFs.java index 7f29882fb..2c8af249e 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/GenotypeGVCFs.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/GenotypeGVCFs.java @@ -72,13 +72,14 @@ import org.broadinstitute.gatk.tools.walkers.annotator.VariantAnnotatorEngine; import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.AnnotatorCompatible; import org.broadinstitute.gatk.tools.walkers.genotyper.*; import org.broadinstitute.gatk.tools.walkers.genotyper.afcalc.GeneralPloidyFailOverAFCalculatorProvider; -import org.broadinstitute.gatk.tools.walkers.haplotypecaller.HaplotypeCaller; import org.broadinstitute.gatk.utils.GenomeLoc; import org.broadinstitute.gatk.engine.SampleUtils; import org.broadinstitute.gatk.utils.commandline.*; import org.broadinstitute.gatk.utils.help.DocumentedGATKFeature; import org.broadinstitute.gatk.utils.help.HelpConstants; import org.broadinstitute.gatk.engine.GATKVCFUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import java.util.*; @@ -183,7 +184,8 @@ public class GenotypeGVCFs extends RodWalker originalAttributes, final VariantContext newVC) { // we want to carry forward the attributes from the original VC but make sure to add the MLE-based annotations final Map attrs = new HashMap<>(originalAttributes); - attrs.put(VCFConstants.MLE_ALLELE_COUNT_KEY, newVC.getAttribute(VCFConstants.MLE_ALLELE_COUNT_KEY)); - attrs.put(VCFConstants.MLE_ALLELE_FREQUENCY_KEY, newVC.getAttribute(VCFConstants.MLE_ALLELE_FREQUENCY_KEY)); - if (newVC.hasAttribute(GenotypingEngine.NUMBER_OF_DISCOVERED_ALLELES_KEY)) - attrs.put(GenotypingEngine.NUMBER_OF_DISCOVERED_ALLELES_KEY, newVC.getAttribute(GenotypingEngine.NUMBER_OF_DISCOVERED_ALLELES_KEY)); + attrs.put(GATKVCFConstants.MLE_ALLELE_COUNT_KEY, newVC.getAttribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY)); + attrs.put(GATKVCFConstants.MLE_ALLELE_FREQUENCY_KEY, newVC.getAttribute(GATKVCFConstants.MLE_ALLELE_FREQUENCY_KEY)); + if (newVC.hasAttribute(GATKVCFConstants.NUMBER_OF_DISCOVERED_ALLELES_KEY)) + attrs.put(GATKVCFConstants.NUMBER_OF_DISCOVERED_ALLELES_KEY, newVC.getAttribute(GATKVCFConstants.NUMBER_OF_DISCOVERED_ALLELES_KEY)); return new VariantContextBuilder(newVC).attributes(attrs).make(); } @@ -305,8 +307,8 @@ public class GenotypeGVCFs extends RodWalker resources, final int numRefSamplesFromMissingResources, @@ -109,12 +108,12 @@ public class PosteriorLikelihoodsUtils { //parse the likelihoods for each sample's genotype final List likelihoods = new ArrayList<>(vc1.getNSamples()); for ( final Genotype genotype : vc1.getGenotypes() ) { - if (!genotype.hasExtendedAttribute(PHRED_SCALED_POSTERIORS_KEY)){ + if (!genotype.hasExtendedAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY)){ likelihoods.add(genotype.hasLikelihoods() ? genotype.getLikelihoods().getAsVector() : null ); } else { - Object PPfromVCF = genotype.getExtendedAttribute(PHRED_SCALED_POSTERIORS_KEY); + Object PPfromVCF = genotype.getExtendedAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY); //parse the PPs into a vector of probabilities if (PPfromVCF instanceof String) { final String PPstring = (String)PPfromVCF; @@ -153,7 +152,7 @@ public class PosteriorLikelihoodsUtils { if ( posteriors.get(genoIdx) != null ) { GATKVariantContextUtils.updateGenotypeAfterSubsetting(vc1.getAlleles(), builder, GATKVariantContextUtils.GenotypeAssignmentMethod.USE_PLS_TO_ASSIGN, posteriors.get(genoIdx), vc1.getAlleles()); - builder.attribute(PHRED_SCALED_POSTERIORS_KEY, + builder.attribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY, Utils.listFromPrimitives(GenotypeLikelihoods.fromLog10Likelihoods(posteriors.get(genoIdx)).getAsPLs())); } newContext.add(builder.make()); @@ -162,7 +161,7 @@ public class PosteriorLikelihoodsUtils { final List priors = Utils.listFromPrimitives( GenotypeLikelihoods.fromLog10Likelihoods(getDirichletPrior(alleleCounts, vc1.getMaxPloidy(2),useFlatPriors)).getAsPLs()); - final VariantContextBuilder builder = new VariantContextBuilder(vc1).genotypes(newContext).attribute("PG", priors); + final VariantContextBuilder builder = new VariantContextBuilder(vc1).genotypes(newContext).attribute(GATKVCFConstants.GENOTYPE_PRIOR_KEY, priors); // add in the AC, AF, and AN attributes VariantContextUtils.calculateChromosomeCounts(builder, true); return builder.make(); @@ -266,8 +265,8 @@ public class PosteriorLikelihoodsUtils { private static void addAlleleCounts(final Map counts, final VariantContext context, final boolean useAC) { final int[] ac; //use MLEAC value... - if ( context.hasAttribute(VCFConstants.MLE_ALLELE_COUNT_KEY) && ! useAC ) { - ac = getAlleleCounts(VCFConstants.MLE_ALLELE_COUNT_KEY, context); + if ( context.hasAttribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY) && ! useAC ) { + ac = getAlleleCounts(GATKVCFConstants.MLE_ALLELE_COUNT_KEY, context); } //...unless specified by the user in useAC or unless MLEAC is absent else if ( context.hasAttribute(VCFConstants.ALLELE_COUNT_KEY) ) { @@ -346,7 +345,7 @@ public class PosteriorLikelihoodsUtils { } if ( mleList == null ) throw new IllegalArgumentException(String.format("VCF does not have properly formatted "+ - VCFConstants.MLE_ALLELE_COUNT_KEY+" or "+VCFConstants.ALLELE_COUNT_KEY)); + GATKVCFConstants.MLE_ALLELE_COUNT_KEY+" or "+VCFConstants.ALLELE_COUNT_KEY)); final int[] mle = new int[mleList.size()]; diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/ReferenceConfidenceVariantContextMerger.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/ReferenceConfidenceVariantContextMerger.java index 3c532bda2..8a8e4927f 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/ReferenceConfidenceVariantContextMerger.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/ReferenceConfidenceVariantContextMerger.java @@ -48,6 +48,7 @@ * 8.6 Binding Effect; Headings. This Agreement shall be binding upon and inure to the benefit of the parties and their respective permitted successors and assigns. All headings are for convenience only and shall not affect the meaning of any provision of this Agreement. * 8.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles. */ + package org.broadinstitute.gatk.tools.walkers.variantutils; import htsjdk.variant.variantcontext.*; @@ -58,6 +59,7 @@ import org.broadinstitute.gatk.utils.MathUtils; import org.broadinstitute.gatk.utils.Utils; import org.broadinstitute.gatk.utils.collections.Pair; import org.broadinstitute.gatk.utils.exceptions.UserException; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import java.util.*; @@ -123,7 +125,7 @@ public class ReferenceConfidenceVariantContextMerger { } // Add to the end if at all required in in the output. - if (!removeNonRefSymbolicAllele) finalAlleleSet.add(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + if (!removeNonRefSymbolicAllele) finalAlleleSet.add(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); final List allelesList = new ArrayList<>(finalAlleleSet); @@ -138,7 +140,7 @@ public class ReferenceConfidenceVariantContextMerger { depth += vc.getAttributeAsInt(VCFConstants.DEPTH_KEY, 0); } else { // handle the gVCF case from the HaplotypeCaller for( final Genotype gt : vc.getGenotypes() ) { - depth += (gt.hasExtendedAttribute("MIN_DP") ? Integer.parseInt((String)gt.getAnyAttribute("MIN_DP")) : (gt.hasDP() ? gt.getDP() : 0)); + depth += (gt.hasExtendedAttribute(GATKVCFConstants.MIN_DP_FORMAT_KEY) ? Integer.parseInt((String)gt.getAnyAttribute(GATKVCFConstants.MIN_DP_FORMAT_KEY)) : (gt.hasDP() ? gt.getDP() : 0)); } } @@ -198,8 +200,8 @@ public class ReferenceConfidenceVariantContextMerger { attributes.remove(VCFConstants.ALLELE_COUNT_KEY); attributes.remove(VCFConstants.ALLELE_FREQUENCY_KEY); attributes.remove(VCFConstants.ALLELE_NUMBER_KEY); - attributes.remove(VCFConstants.MLE_ALLELE_COUNT_KEY); - attributes.remove(VCFConstants.MLE_ALLELE_FREQUENCY_KEY); + attributes.remove(GATKVCFConstants.MLE_ALLELE_COUNT_KEY); + attributes.remove(GATKVCFConstants.MLE_ALLELE_FREQUENCY_KEY); attributes.remove(VCFConstants.END_KEY); } @@ -262,7 +264,7 @@ public class ReferenceConfidenceVariantContextMerger { } else if (a.isSymbolic()) { result.add(a); // we always skip when adding to finalAlleles this is done outside if applies. - if (!a.equals(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE)) + if (!a.equals(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE)) finalAlleles.add(a); } else if (a.isCalled()) { final Allele newAllele; @@ -293,7 +295,7 @@ public class ReferenceConfidenceVariantContextMerger { final List result = new ArrayList<>(alleles.size()); for ( final Allele allele : alleles ) - result.add(allele.equals(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE) ? allele : Allele.NO_CALL); + result.add(allele.equals(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE) ? allele : Allele.NO_CALL); return result; } @@ -374,10 +376,10 @@ public class ReferenceConfidenceVariantContextMerger { if ( remappedAlleles == null || remappedAlleles.size() == 0 ) throw new IllegalArgumentException("The list of input alleles must not be null or empty"); if ( targetAlleles == null || targetAlleles.size() == 0 ) throw new IllegalArgumentException("The list of target alleles must not be null or empty"); - if ( !remappedAlleles.contains(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE) ) - throw new UserException("The list of input alleles must contain " + GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE + " as an allele but that is not the case at position " + position + "; please use the Haplotype Caller with gVCF output to generate appropriate records"); + if ( !remappedAlleles.contains(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE) ) + throw new UserException("The list of input alleles must contain " + GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE + " as an allele but that is not the case at position " + position + "; please use the Haplotype Caller with gVCF output to generate appropriate records"); - final int indexOfNonRef = remappedAlleles.indexOf(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + final int indexOfNonRef = remappedAlleles.indexOf(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); //if the refs don't match then let the non-ref allele be the most likely of the alts //TODO: eventually it would be nice to be able to trim alleles for spanning events to see if they really do have the same ref @@ -399,7 +401,7 @@ public class ReferenceConfidenceVariantContextMerger { indexMapping[0] = 0; // create the index mapping, using the allele whenever such a mapping doesn't exist - final int targetNonRef = targetAlleles.indexOf(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + final int targetNonRef = targetAlleles.indexOf(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); final boolean targetHasNonRef = targetNonRef != -1; final int lastConcreteAlt = targetHasNonRef ? targetAlleles.size()-2 : targetAlleles.size()-1; for ( int i = 1; i <= lastConcreteAlt; i++ ) { diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/utils/gvcf/GVCFWriter.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/utils/gvcf/GVCFWriter.java index 7ab6c088b..fd8a98775 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/utils/gvcf/GVCFWriter.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/utils/gvcf/GVCFWriter.java @@ -57,6 +57,8 @@ import htsjdk.variant.variantcontext.VariantContext; import htsjdk.variant.variantcontext.VariantContextBuilder; import htsjdk.variant.variantcontext.writer.VariantContextWriter; import htsjdk.variant.vcf.*; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import java.util.HashMap; @@ -71,10 +73,6 @@ import java.util.List; * Time: 2:51 PM */ public class GVCFWriter implements VariantContextWriter { - // - // static VCF field names - // - protected final static String MIN_DP_FORMAT_FIELD = "MIN_DP"; // // Final fields initialized in constructor @@ -151,7 +149,7 @@ public class GVCFWriter implements VariantContextWriter { public void writeHeader(VCFHeader header) { if ( header == null ) throw new IllegalArgumentException("header cannot be null"); header.addMetaDataLine(VCFStandardHeaderLines.getInfoLine(VCFConstants.END_KEY)); - header.addMetaDataLine(new VCFFormatHeaderLine(MIN_DP_FORMAT_FIELD, 1, VCFHeaderLineType.Integer, "Minimum DP observed within the GVCF block")); + header.addMetaDataLine(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.MIN_DP_FORMAT_KEY)); for ( final HomRefBlock partition : GQPartitions ) { header.addMetaDataLine(partition.toVCFHeaderLine()); @@ -251,7 +249,7 @@ public class GVCFWriter implements VariantContextWriter { final int gq = genotypeQualityFromPLs(minPLs); gb.GQ(gq); gb.DP(block.getMedianDP()); - gb.attribute(MIN_DP_FORMAT_FIELD, block.getMinDP()); + gb.attribute(GATKVCFConstants.MIN_DP_FORMAT_KEY, block.getMinDP()); // This annotation is no longer standard //gb.attribute(MIN_GQ_FORMAT_FIELD, block.getMinGQ()); @@ -330,7 +328,7 @@ public class GVCFWriter implements VariantContextWriter { } final Genotype g = vc.getGenotype(0); - if ( g.isHomRef() && vc.hasAlternateAllele(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE) && vc.isBiallelic() ) { + if ( g.isHomRef() && vc.hasAlternateAllele(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE) && vc.isBiallelic() ) { // create bands final VariantContext maybeCompletedBand = addHomRefSite(vc, g); if ( maybeCompletedBand != null ) underlyingWriter.add(maybeCompletedBand); diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/annotator/GenotypeSummariesUnitTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/annotator/GenotypeSummariesUnitTest.java index 6adc55352..dd18b9d08 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/annotator/GenotypeSummariesUnitTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/annotator/GenotypeSummariesUnitTest.java @@ -52,6 +52,7 @@ package org.broadinstitute.gatk.tools.walkers.annotator; import htsjdk.variant.variantcontext.*; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.testng.Assert; import org.testng.annotations.Test; @@ -82,8 +83,8 @@ public class GenotypeSummariesUnitTest { final GenotypeSummaries GS = new GenotypeSummaries(); final Map resultMap = GS.annotate(null, null, null, null, testVC, null); - Assert.assertEquals(1, resultMap.get(GenotypeSummaries.NCC)); // 1 no-called called sample - Assert.assertEquals(30.0, Double.parseDouble((String)resultMap.get(GenotypeSummaries.GQ_MEAN)), 1E-4); // mean GQ is 30 - Assert.assertFalse(resultMap.containsKey(GenotypeSummaries.GQ_STDDEV)); // no stddev with only one data point + Assert.assertEquals(1, resultMap.get(GATKVCFConstants.NOCALL_CHROM_KEY)); // 1 no-called called sample + Assert.assertEquals(30.0, Double.parseDouble((String)resultMap.get(GATKVCFConstants.GQ_MEAN_KEY)), 1E-4); // mean GQ is 30 + Assert.assertFalse(resultMap.containsKey(GATKVCFConstants.GQ_STDEV_KEY)); // no stddev with only one data point } } diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/diagnostics/diagnosetargets/DiagnoseTargetsIntegrationTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/diagnostics/diagnosetargets/DiagnoseTargetsIntegrationTest.java index 9c3168401..8b5e42109 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/diagnostics/diagnosetargets/DiagnoseTargetsIntegrationTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/diagnostics/diagnosetargets/DiagnoseTargetsIntegrationTest.java @@ -71,11 +71,11 @@ public class DiagnoseTargetsIntegrationTest extends WalkerTest { @Test(enabled = true) public void testSingleSample() { - DTTest("testSingleSample ", "-I " + singleSample + " -max 75", "6ca3d3917a7b65eaa877aa3658d80912"); + DTTest("testSingleSample ", "-I " + singleSample + " -max 75", "5cad1b8e3bf5582842bbeadbc173e8aa"); } @Test(enabled = true) public void testMultiSample() { - DTTest("testMultiSample ", "-I " + multiSample, "f50c6b9bef9f63f0a8b32ae9a9bdd51a"); + DTTest("testMultiSample ", "-I " + multiSample, "c2a11ad34104fd5e4e65bdf049abe5e7"); } } diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/genotyper/ReadLikelihoodsUnitTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/genotyper/ReadLikelihoodsUnitTest.java index f329692ff..32ad71f4b 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/genotyper/ReadLikelihoodsUnitTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/genotyper/ReadLikelihoodsUnitTest.java @@ -60,7 +60,7 @@ import org.broadinstitute.gatk.utils.MathUtils; import org.broadinstitute.gatk.utils.Utils; import org.broadinstitute.gatk.utils.sam.ArtificialSAMUtils; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; -import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.testng.Assert; import org.testng.SkipException; import org.testng.annotations.DataProvider; @@ -451,9 +451,9 @@ public class ReadLikelihoodsUnitTest final ReadLikelihoods original = new ReadLikelihoods<>(new IndexedSampleList(samples), new IndexedAlleleList<>(alleles), reads); final double[][][] originalLikelihoods = fillWithRandomLikelihoods(samples,alleles,original); final ReadLikelihoods result = original.clone(); - result.addNonReferenceAllele(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + result.addNonReferenceAllele(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); Assert.assertEquals(result.alleleCount(),original.alleleCount() + 1); - Assert.assertEquals(result.alleleIndex(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE),result.alleleCount() - 1); + Assert.assertEquals(result.alleleIndex(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE),result.alleleCount() - 1); final double[][][] newLikelihoods = new double[originalLikelihoods.length][][]; for (int s = 0; s < samples.length; s++) { newLikelihoods[s] = Arrays.copyOf(originalLikelihoods[s],originalLikelihoods[s].length + 1); diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerGenotypingEngineUnitTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerGenotypingEngineUnitTest.java index 352ef867a..b9c005554 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerGenotypingEngineUnitTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerGenotypingEngineUnitTest.java @@ -71,7 +71,7 @@ import org.broadinstitute.gatk.utils.sam.ArtificialSAMUtils; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; import org.broadinstitute.gatk.utils.smithwaterman.Parameters; import org.broadinstitute.gatk.utils.smithwaterman.SWPairwiseAlignment; -import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; @@ -230,7 +230,7 @@ public class HaplotypeCallerGenotypingEngineUnitTest extends BaseTest { } Allele altAllele = null; for (final Allele allele : updatedVc.getAlleles()) - if (allele.isSymbolic() && allele.getBaseString().equals(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE_NAME)) + if (allele.isSymbolic() && allele.getBaseString().equals(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE_NAME)) altAllele = allele; Assert.assertNotNull(altAllele); } @@ -521,8 +521,8 @@ public class HaplotypeCallerGenotypingEngineUnitTest extends BaseTest { int counter = 0; for ( final VariantContext call : actualPhasedCalls ) { for ( final Genotype g : call.getGenotypes() ) { - if ( g.hasExtendedAttribute(HaplotypeCaller.HAPLOTYPE_CALLER_PHASING_ID_KEY) ) { - uniqueGroups.add(g.getExtendedAttribute(HaplotypeCaller.HAPLOTYPE_CALLER_PHASING_ID_KEY).toString()); + if ( g.hasExtendedAttribute(GATKVCFConstants.HAPLOTYPE_CALLER_PHASING_ID_KEY) ) { + uniqueGroups.add(g.getExtendedAttribute(GATKVCFConstants.HAPLOTYPE_CALLER_PHASING_ID_KEY).toString()); counter++; } } diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/LDMergerUnitTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/LDMergerUnitTest.java index 68c6bea73..826666d43 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/LDMergerUnitTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/LDMergerUnitTest.java @@ -269,8 +269,8 @@ public class LDMergerUnitTest extends BaseTest { @Test(dataProvider = "R2MergerData") public void testR2Merger(final String refS, final String hapS, int nEvents, final String cigar, final String expectedMergedRef, final String expectedMergedAlt, final double r2, final boolean expectMerge) { - final Haplotype ref = new Haplotype(refS.getBytes(), true, 0, TextCigarCodec.getSingleton().decode(refS.length() + "M")); - final Haplotype hap = new Haplotype(hapS.getBytes(), false, 0, TextCigarCodec.getSingleton().decode(cigar)); + final Haplotype ref = new Haplotype(refS.getBytes(), true, 0, TextCigarCodec.decode(refS.length() + "M")); + final Haplotype hap = new Haplotype(hapS.getBytes(), false, 0, TextCigarCodec.decode(cigar)); final GenomeLoc loc = new UnvalidatingGenomeLoc("1", 0, 1, ref.length()); final List haplotypes = Arrays.asList(ref, hap); @@ -294,9 +294,9 @@ public class LDMergerUnitTest extends BaseTest { final String refS = "ACGT"; final String hapS = "CCGA"; final String cigar = "4M"; - final Haplotype ref = new Haplotype(refS.getBytes(), true, 0, TextCigarCodec.getSingleton().decode(refS.length() + "M")); - final Haplotype hap1 = new Haplotype(hapS.getBytes(), false, 0, TextCigarCodec.getSingleton().decode(cigar)); - final Haplotype hap2 = new Haplotype("ACGA".getBytes(), false, 0, TextCigarCodec.getSingleton().decode(cigar)); + final Haplotype ref = new Haplotype(refS.getBytes(), true, 0, TextCigarCodec.decode(refS.length() + "M")); + final Haplotype hap1 = new Haplotype(hapS.getBytes(), false, 0, TextCigarCodec.decode(cigar)); + final Haplotype hap2 = new Haplotype("ACGA".getBytes(), false, 0, TextCigarCodec.decode(cigar)); final GenomeLoc loc = new UnvalidatingGenomeLoc("1", 0, 1, ref.length()); final List haplotypes = Arrays.asList(ref, hap1, hap2); @@ -321,12 +321,12 @@ public class LDMergerUnitTest extends BaseTest { final String refS = "ACGT"; final String hapS = "TCGA"; final String cigar = "4M"; - final Haplotype ref = new Haplotype(refS.getBytes(), true, 0, TextCigarCodec.getSingleton().decode(refS.length() + "M")); - final Haplotype hap1 = new Haplotype(hapS.getBytes(), false, 0, TextCigarCodec.getSingleton().decode(cigar)); + final Haplotype ref = new Haplotype(refS.getBytes(), true, 0, TextCigarCodec.decode(refS.length() + "M")); + final Haplotype hap1 = new Haplotype(hapS.getBytes(), false, 0, TextCigarCodec.decode(cigar)); final GenomeLoc loc = new UnvalidatingGenomeLoc("1", 0, 1, ref.length()); for (final String hap2S : Arrays.asList("GCGA", "TCGG")) { - final Haplotype hap2 = new Haplotype(hap2S.getBytes(), false, 0, TextCigarCodec.getSingleton().decode(cigar)); + final Haplotype hap2 = new Haplotype(hap2S.getBytes(), false, 0, TextCigarCodec.decode(cigar)); final List haplotypes = Arrays.asList(ref, hap1, hap2); final TreeSet vcStarts = EventMap.buildEventMapsForHaplotypes(haplotypes, ref.getBases(), loc, false); diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/ReferenceConfidenceModelUnitTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/ReferenceConfidenceModelUnitTest.java index f7a4059e0..078177f4a 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/ReferenceConfidenceModelUnitTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/ReferenceConfidenceModelUnitTest.java @@ -68,6 +68,7 @@ import org.broadinstitute.gatk.utils.pileup.ReadBackedPileupImpl; import org.broadinstitute.gatk.utils.sam.ArtificialSAMUtils; import org.broadinstitute.gatk.utils.sam.GATKSAMReadGroupRecord; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import org.broadinstitute.gatk.utils.variant.HomoSapiensConstants; import org.testng.Assert; @@ -392,7 +393,7 @@ public class ReferenceConfidenceModelUnitTest extends BaseTest { refModel.getStart() - call.getStart() + 1), refModel.getReference().getBaseString(), "" + data.getRefHap()); // the reference must be the same. Assert.assertTrue(refModel.getGenotype(0).getGQ() <= 0); // No confidence in the reference hom-ref call across the deletion Assert.assertEquals(refModel.getAlleles().size(),2); // the reference and the lonelly - Assert.assertEquals(refModel.getAlleles().get(1),GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + Assert.assertEquals(refModel.getAlleles().get(1), GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); } else { Assert.assertEquals(refModel, call, "Should have found call " + call + " but found " + refModel + " instead"); } @@ -403,7 +404,7 @@ public class ReferenceConfidenceModelUnitTest extends BaseTest { Assert.assertEquals(refModel.getEnd(), loc.getStart() + i); Assert.assertFalse(refModel.hasLog10PError()); Assert.assertEquals(refModel.getAlternateAlleles().size(), 1); - Assert.assertEquals(refModel.getAlternateAllele(0), GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + Assert.assertEquals(refModel.getAlternateAllele(0), GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); Assert.assertTrue(refModel.hasGenotype(sample)); final Genotype g = refModel.getGenotype(sample); diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/graphs/KBestHaplotypeFinderUnitTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/graphs/KBestHaplotypeFinderUnitTest.java index b1bc1e22c..33d091953 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/graphs/KBestHaplotypeFinderUnitTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/graphs/KBestHaplotypeFinderUnitTest.java @@ -452,7 +452,7 @@ public class KBestHaplotypeFinderUnitTest extends BaseTest { Cigar expected = new Cigar(); expected.add(new CigarElement(padSize, CigarOperator.M)); if ( ! prefix.equals("") ) expected.add(new CigarElement(prefix.length(), CigarOperator.M)); - for ( final CigarElement elt : TextCigarCodec.getSingleton().decode(midCigar).getCigarElements() ) expected.add(elt); + for ( final CigarElement elt : TextCigarCodec.decode(midCigar).getCigarElements() ) expected.add(elt); if ( ! end.equals("") ) expected.add(new CigarElement(end.length(), CigarOperator.M)); expected.add(new CigarElement(padSize, CigarOperator.M)); expected = AlignmentUtils.consolidateCigar(expected); @@ -513,7 +513,7 @@ public class KBestHaplotypeFinderUnitTest extends BaseTest { public void testLeftAlignCigarSequentiallyAdjacentID() { final String ref = "GTCTCTCTCTCTCTCTCTATATATATATATATATTT"; final String hap = "GTCTCTCTCTCTCTCTCTCTCTATATATATATATTT"; - final Cigar originalCigar = TextCigarCodec.getSingleton().decode("18M4I12M4D2M"); + final Cigar originalCigar = TextCigarCodec.decode("18M4I12M4D2M"); final Cigar result = CigarUtils.leftAlignCigarSequentially(originalCigar, ref.getBytes(), hap.getBytes(), 0, 0); logger.warn("Result is " + result); diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/variantutils/GenotypeGVCFsIntegrationTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/variantutils/GenotypeGVCFsIntegrationTest.java index d4ebc3bc7..027f3eb1f 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/variantutils/GenotypeGVCFsIntegrationTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/variantutils/GenotypeGVCFsIntegrationTest.java @@ -71,7 +71,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { WalkerTestSpec spec = new WalkerTestSpec( baseTestString(" -V " + privateTestDir + "testUpdatePGT.vcf", b37KGReference), 1, - Arrays.asList("27bc40f7cc46bdc347284d7522b2aa6c")); + Arrays.asList("6483df1dfa3a5290ba2dc10cc8e15370")); executeTest("testUpdatePGT", spec); } @@ -83,7 +83,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { " -V:sample3 " + privateTestDir + "combine.single.sample.pipeline.3.vcf" + " -L 20:10,000,000-20,000,000", b37KGReference), 1, - Arrays.asList("bb7775a555ee9859e18a28cbc044a160")); + Arrays.asList("d873327b474fa341cee7823a35efda89")); executeTest("combineSingleSamplePipelineGVCF", spec); } @@ -95,7 +95,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { " -V:sample3 " + privateTestDir + "tetraploid-gvcf-3.vcf" + " -L " + privateTestDir + "tetraploid-gvcfs.intervals", b37KGReference), 1, - Arrays.asList("a2e482cddbc987b0ba004e13044f6e81")); + Arrays.asList("f5b3c4b4b45f7d3bc4a38ff5ac7076f0")); executeTest("combineSingleSamplePipelineGVCF", spec); } @@ -107,7 +107,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { " -V:sample3 " + privateTestDir + "diploid-gvcf-3.vcf" + " -L " + privateTestDir + "tetraploid-gvcfs.intervals", b37KGReference), 1, - Arrays.asList("0ad7d784a15ad7f8b386ec7ca34032af")); + Arrays.asList("1f4632023ac646d7d04f65d797109f91")); executeTest("combineSingleSamplePipelineGVCF", spec); } @@ -119,7 +119,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { " -V:sample3 " + privateTestDir + "combine.single.sample.pipeline.3.vcf" + " --includeNonVariantSites -L 20:10,030,000-10,033,000 -L 20:10,386,000-10,386,500", b37KGReference), 1, - Arrays.asList("fdd06679c8a14ef2010d075cbae76519")); + Arrays.asList("70376c02babc75c15a1e9a6be47e34fa")); executeTest("combineSingleSamplePipelineGVCF_includeNonVariants", spec); } @@ -132,7 +132,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { " -V:sample3 " + privateTestDir + "combine.single.sample.pipeline.3.vcf" + " -L 20:10,000,000-20,000,000", b37KGReference), 1, - Arrays.asList("9b7f2ba1bde2e0a0eb3ebc0afb6bc513")); + Arrays.asList("8c814998059fda80cf5a18242db13c19")); executeTest("combineSingleSamplePipelineGVCFHierarchical", spec); } @@ -144,7 +144,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { " -V:sample3 " + privateTestDir + "combine.single.sample.pipeline.3.vcf" + " -L 20:10,000,000-11,000,000 --dbsnp " + b37dbSNP132, b37KGReference), 1, - Arrays.asList("8201cee7120dfdb3fdeace0ec511c7b1")); + Arrays.asList("114a75003083cbe1a9966cc489d441af")); executeTest("combineSingleSamplePipelineGVCF_addDbsnp", spec); } @@ -154,7 +154,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { "-T GenotypeGVCFs --no_cmdline_in_header -L 1:69485-69791 -o %s -R " + b37KGReference + " -V " + privateTestDir + "gvcfExample1.vcf", 1, - Arrays.asList("b4bb1d21c7a3d793a98b0857c7c5d52b")); + Arrays.asList("364043ee77d4c6dfe1403a90b4938a65")); executeTest("testJustOneSample", spec); } @@ -165,7 +165,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { " -V " + privateTestDir + "gvcfExample1.vcf" + " -V " + privateTestDir + "gvcfExample2.vcf", 1, - Arrays.asList("ec63a629cc707554d3dd2ba7254b3b8d")); + Arrays.asList("3fc58414196213bc3a85237b055b7883")); executeTest("testSamplesWithDifferentLs", spec); } @@ -176,12 +176,12 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { "-T GenotypeGVCFs --no_cmdline_in_header -L 1:1115550-1115551 -o %s -R " + hg19Reference + " --variant " + privateTestDir + "combined_genotype_gvcf_exception.vcf", 1, - Arrays.asList("9626a7108d616d63a2a8069b306c1fe0")); + Arrays.asList("08e4b839dede1b91ce6bd89c66ff063c")); WalkerTestSpec spec2 = new WalkerTestSpec( "-T GenotypeGVCFs --no_cmdline_in_header -L 1:1115550-1115551 -o %s -R " + hg19Reference + " --variant " + privateTestDir + "combined_genotype_gvcf_exception.nocall.vcf", 1, - Arrays.asList("9626a7108d616d63a2a8069b306c1fe0")); + Arrays.asList("08e4b839dede1b91ce6bd89c66ff063c")); executeTest("testNoPLsException.1", spec1); executeTest("testNoPLsException.2", spec2); } @@ -191,7 +191,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { WalkerTestSpec spec = new WalkerTestSpec( baseBPResolutionString("-nda"), 1, - Arrays.asList("d50e5035488f63c574dcb8485ff61fcb")); + Arrays.asList("6bfc0d58eed9fc98642f36a09b1a235d")); executeTest("testNDA", spec); } @@ -200,7 +200,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { WalkerTestSpec spec = new WalkerTestSpec( baseBPResolutionString("-maxAltAlleles 1"), 1, - Arrays.asList("8fa78191298b4d8c9b40fba2c705ad56")); + Arrays.asList("1e238c736e3f43e3693327a89455faaa")); executeTest("testMaxAltAlleles", spec); } @@ -209,7 +209,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { WalkerTestSpec spec = new WalkerTestSpec( baseBPResolutionString("-stand_call_conf 300 -stand_emit_conf 100"), 1, - Arrays.asList("bd58c026e9c8df4d4166f22cd0f0ce65")); + Arrays.asList("9c192402a005216649ff44a36cc7c45c")); executeTest("testStandardConf", spec); } } \ No newline at end of file diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/variantutils/PosteriorLikelihoodsUtilsUnitTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/variantutils/PosteriorLikelihoodsUtilsUnitTest.java index 9cfd9ae1d..e24623998 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/variantutils/PosteriorLikelihoodsUtilsUnitTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/variantutils/PosteriorLikelihoodsUtilsUnitTest.java @@ -62,6 +62,7 @@ import org.broadinstitute.gatk.utils.BaseTest; import org.broadinstitute.gatk.utils.MathUtils; import htsjdk.variant.variantcontext.*; import htsjdk.variant.vcf.VCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.testng.Assert; import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test; @@ -74,7 +75,6 @@ import java.util.List; public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { Allele Aref, T, C, G, Cref, ATC, ATCATC; - private final String PHRED_SCALED_POSTERIORS_KEY = "PP"; @BeforeSuite public void setup() { @@ -151,16 +151,16 @@ public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { makeG("s10",Aref,T,20,0,10), makeG("s11",T,T,60,40,0), makeG("s12",Aref,Aref,0,30,90)); - test1 = new VariantContextBuilder(test1).attribute(VCFConstants.MLE_ALLELE_COUNT_KEY,12).make(); + test1 = new VariantContextBuilder(test1).attribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY,12).make(); VariantContext test1result = PosteriorLikelihoodsUtils.calculatePosteriorGLs(test1, new ArrayList(), 0, 0.001, true, false, false); Genotype test1exp1 = makeGwithPLs("s1",Aref,T,new double[]{-2.26110257, -0.02700903, -1.26110257}); Assert.assertTrue(test1exp1.hasPL()); Genotype test1exp2 = makeGwithPLs("s2",T,T,new double[]{-6.000075e+00, -3.765981e+00, -7.488009e-05}); Genotype test1exp3 = makeGwithPLs("s3",Aref,Aref,new double[]{-0.0007438855, -2.7666503408, -9.0007438855}); - Assert.assertEquals("java.util.ArrayList",test1result.getGenotype(0).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY).getClass().getCanonicalName()); - Assert.assertEquals(arraysEq(test1exp1.getPL(), _mleparse((List)test1result.getGenotype(0).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY))), ""); - Assert.assertEquals(arraysEq(test1exp2.getPL(),_mleparse((List)test1result.getGenotype(1).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY))), ""); - Assert.assertEquals(arraysEq(test1exp3.getPL(),_mleparse((List)test1result.getGenotype(2).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY))), ""); + Assert.assertEquals("java.util.ArrayList",test1result.getGenotype(0).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY).getClass().getCanonicalName()); + Assert.assertEquals(arraysEq(test1exp1.getPL(), _mleparse((List)test1result.getGenotype(0).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY))), ""); + Assert.assertEquals(arraysEq(test1exp2.getPL(),_mleparse((List)test1result.getGenotype(1).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY))), ""); + Assert.assertEquals(arraysEq(test1exp3.getPL(),_mleparse((List)test1result.getGenotype(2).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY))), ""); // AA AB BB AC BC CC // AA AC CC AT CT TT @@ -177,16 +177,16 @@ public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { makeG("s10",Aref,C,40,0,10,30,40,80), makeG("s11",Aref,Aref,0,5,8,15,20,40), makeG("s12",C,T,80,40,12,20,0,10)); - test2 = new VariantContextBuilder(test2).attribute(VCFConstants.MLE_ALLELE_COUNT_KEY,new ArrayList(Arrays.asList(6,6))).make(); + test2 = new VariantContextBuilder(test2).attribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY,new ArrayList(Arrays.asList(6,6))).make(); VariantContext test2result = PosteriorLikelihoodsUtils.calculatePosteriorGLs(test2,new ArrayList(),5,0.001,true,false, false); Genotype test2exp1 = makeGwithPLs("s1",Aref,T,new double[]{-2.823957, -1.000000, -6.686344, 0.000000, -1.952251, -9.686344}); Genotype test2exp2 = makeGwithPLs("s2",Aref,C,new double[]{-3.823957, 0.000000, -1.686344, -3.000000, -4.452251, -8.686344}); Genotype test2exp3 = makeGwithPLs("s3",Aref,Aref,new double[] {0.000000, -0.676043, -1.662387, -1.676043, -2.628294, -4.862387}); Genotype test2exp4 = makeGwithPLs("s4",C,T,new double[]{-7.371706, -3.547749, -1.434094, -1.547749, 0.000000, -1.234094}); - Assert.assertEquals(arraysEq(test2exp1.getPL(),(int[]) _mleparse((List)test2result.getGenotype(0).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY))), ""); - Assert.assertEquals(arraysEq(test2exp2.getPL(),(int[]) _mleparse((List)test2result.getGenotype(1).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY))), ""); - Assert.assertEquals(arraysEq(test2exp3.getPL(),(int[]) _mleparse((List)test2result.getGenotype(2).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY))), ""); - Assert.assertEquals(arraysEq(test2exp4.getPL(),(int[]) _mleparse((List)test2result.getGenotype(3).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY))), ""); + Assert.assertEquals(arraysEq(test2exp1.getPL(),(int[]) _mleparse((List)test2result.getGenotype(0).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY))), ""); + Assert.assertEquals(arraysEq(test2exp2.getPL(),(int[]) _mleparse((List)test2result.getGenotype(1).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY))), ""); + Assert.assertEquals(arraysEq(test2exp3.getPL(),(int[]) _mleparse((List)test2result.getGenotype(2).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY))), ""); + Assert.assertEquals(arraysEq(test2exp4.getPL(),(int[]) _mleparse((List)test2result.getGenotype(3).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY))), ""); } @Test @@ -195,7 +195,7 @@ public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { makeG("s2",Aref,T,18,0,24), makeG("s3",Aref,T,22,0,12)); List supplTest1 = new ArrayList<>(3); - supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T))).attribute(VCFConstants.MLE_ALLELE_COUNT_KEY,2).attribute(VCFConstants.ALLELE_NUMBER_KEY,10).make()); + supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T))).attribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY,2).attribute(VCFConstants.ALLELE_NUMBER_KEY,10).make()); supplTest1.add(new VariantContextBuilder(makeVC("3",Arrays.asList(Aref,T))).attribute(VCFConstants.ALLELE_COUNT_KEY,4).attribute(VCFConstants.ALLELE_NUMBER_KEY,22).make()); supplTest1.add(makeVC("4",Arrays.asList(Aref,T), makeG("s_1",T,T), @@ -205,25 +205,25 @@ public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { Genotype test1exp1 = makeGwithPLs("t1",T,T,new double[]{-3.370985, -1.415172, -0.01721766}); Genotype test1exp2 = makeGwithPLs("t2",Aref,T,new double[]{-1.763792, -0.007978791, -3.010024}); Genotype test1exp3 = makeGwithPLs("t3",Aref,T,new double[]{-2.165587, -0.009773643, -1.811819}); - Assert.assertEquals(arraysEq(test1exp1.getPL(),_mleparse((List) test1result.getGenotype(0).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY))), ""); - Assert.assertEquals(arraysEq(test1exp2.getPL(),_mleparse((List) test1result.getGenotype(1).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY))), ""); - Assert.assertEquals(arraysEq(test1exp3.getPL(),_mleparse((List) test1result.getGenotype(2).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY))), ""); + Assert.assertEquals(arraysEq(test1exp1.getPL(),_mleparse((List) test1result.getGenotype(0).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY))), ""); + Assert.assertEquals(arraysEq(test1exp2.getPL(),_mleparse((List) test1result.getGenotype(1).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY))), ""); + Assert.assertEquals(arraysEq(test1exp3.getPL(),_mleparse((List) test1result.getGenotype(2).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY))), ""); VariantContext testNonOverlapping = makeVC("1", Arrays.asList(Aref,T), makeG("s1",T,T,3,1,0)); List other = Arrays.asList(makeVC("2",Arrays.asList(Aref,C),makeG("s2",C,C,10,2,0))); VariantContext test2result = PosteriorLikelihoodsUtils.calculatePosteriorGLs(testNonOverlapping,other,0,0.001,true,false,false); Genotype test2exp1 = makeGwithPLs("SGV",T,T,new double[]{-4.078345, -3.276502, -0.0002661066}); - Assert.assertEquals(arraysEq(test2exp1.getPL(),_mleparse((List) test2result.getGenotype(0).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY))), ""); + Assert.assertEquals(arraysEq(test2exp1.getPL(),_mleparse((List) test2result.getGenotype(0).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY))), ""); } @Test private void testCalculatePosteriorHOM_VARtoHET() { VariantContext testOverlappingBase = makeVC("1", Arrays.asList(Aref,T), makeG("s1",T,T,40,1,0)); List supplTest1 = new ArrayList<>(1); - supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T))).attribute(VCFConstants.MLE_ALLELE_COUNT_KEY,500).attribute(VCFConstants.ALLELE_NUMBER_KEY,1000).make()); + supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T))).attribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY,500).attribute(VCFConstants.ALLELE_NUMBER_KEY,1000).make()); VariantContext test1result = PosteriorLikelihoodsUtils.calculatePosteriorGLs(testOverlappingBase,supplTest1,0,0.001,true,false,false); - int[] GP = _mleparse( (List)test1result.getGenotype(0).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY)); + int[] GP = _mleparse( (List)test1result.getGenotype(0).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY)); Assert.assertTrue(GP[2] > GP[1]); } @@ -231,10 +231,10 @@ public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { private void testCalculatePosteriorHETtoHOM_VAR() { VariantContext testOverlappingBase = makeVC("1", Arrays.asList(Aref,T), makeG("s1",T,T,40,0,1)); List supplTest1 = new ArrayList<>(1); - supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T))).attribute(VCFConstants.MLE_ALLELE_COUNT_KEY,900).attribute(VCFConstants.ALLELE_NUMBER_KEY,1000).make()); + supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T))).attribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY,900).attribute(VCFConstants.ALLELE_NUMBER_KEY,1000).make()); VariantContext test1result = PosteriorLikelihoodsUtils.calculatePosteriorGLs(testOverlappingBase,supplTest1,0,0.001,true,false,false); - int[] GP = _mleparse( (List)test1result.getGenotype(0).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY)); + int[] GP = _mleparse( (List)test1result.getGenotype(0).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY)); Assert.assertTrue(GP[2] < GP[1]); } @@ -242,10 +242,10 @@ public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { private void testCalculatePosteriorHOM_REFtoHET() { VariantContext testOverlappingBase = makeVC("1", Arrays.asList(Aref,T), makeG("s1",T,T,0,1,40)); List supplTest1 = new ArrayList<>(1); - supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T))).attribute(VCFConstants.MLE_ALLELE_COUNT_KEY,500).attribute(VCFConstants.ALLELE_NUMBER_KEY,1000).make()); + supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T))).attribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY,500).attribute(VCFConstants.ALLELE_NUMBER_KEY,1000).make()); VariantContext test1result = PosteriorLikelihoodsUtils.calculatePosteriorGLs(testOverlappingBase,supplTest1,0,0.001,true,false,false); - int[] GP = _mleparse( (List)test1result.getGenotype(0).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY)); + int[] GP = _mleparse( (List)test1result.getGenotype(0).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY)); Assert.assertTrue(GP[0] > GP[1]); } @@ -253,10 +253,10 @@ public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { private void testCalculatePosteriorHETtoHOM_REF() { VariantContext testOverlappingBase = makeVC("1", Arrays.asList(Aref,T), makeG("s1",T,T,1,0,40)); List supplTest1 = new ArrayList<>(1); - supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T))).attribute(VCFConstants.MLE_ALLELE_COUNT_KEY,100).attribute(VCFConstants.ALLELE_NUMBER_KEY,1000).make()); + supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T))).attribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY,100).attribute(VCFConstants.ALLELE_NUMBER_KEY,1000).make()); VariantContext test1result = PosteriorLikelihoodsUtils.calculatePosteriorGLs(testOverlappingBase,supplTest1,0,0.001,true,false,false); - int[] GP = _mleparse( (List)test1result.getGenotype(0).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY)); + int[] GP = _mleparse( (List)test1result.getGenotype(0).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY)); Assert.assertTrue(GP[0] < GP[1]); } @@ -266,7 +266,7 @@ public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { makeG("s2",Aref,T,18,0,24), makeG("s3",Aref,T,22,0,12)); List supplTest1 = new ArrayList<>(1); - supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T))).attribute(VCFConstants.MLE_ALLELE_COUNT_KEY,11).attribute(VCFConstants.ALLELE_NUMBER_KEY,10).make()); + supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T))).attribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY,11).attribute(VCFConstants.ALLELE_NUMBER_KEY,10).make()); VariantContext test1result = PosteriorLikelihoodsUtils.calculatePosteriorGLs(testOverlappingBase,supplTest1,0,0.001,true,false,false); } @@ -287,7 +287,7 @@ public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { makeG("s2",Aref,T,18,0,24), makeG("s3",Aref,T,22,0,12)); List supplTest1 = new ArrayList<>(1); - supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T,C))).attribute(VCFConstants.MLE_ALLELE_COUNT_KEY,5).attribute(VCFConstants.ALLELE_NUMBER_KEY,10).make()); + supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T,C))).attribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY,5).attribute(VCFConstants.ALLELE_NUMBER_KEY,10).make()); VariantContext test1result = PosteriorLikelihoodsUtils.calculatePosteriorGLs(testOverlappingBase,supplTest1,0,0.001,true,false,false); } @@ -307,7 +307,7 @@ public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { makeG("s2",Aref,T,18,0,24), makeG("s3",Aref,T,22,0,12)); List supplTest1 = new ArrayList<>(1); - supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T,C))).attribute(VCFConstants.MLE_ALLELE_COUNT_KEY,Arrays.asList(5,4)).attribute(VCFConstants.ALLELE_NUMBER_KEY,10).make()); + supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T,C))).attribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY,Arrays.asList(5,4)).attribute(VCFConstants.ALLELE_NUMBER_KEY,10).make()); VariantContext test1result = PosteriorLikelihoodsUtils.calculatePosteriorGLs(testOverlappingBase,supplTest1,0,0.001,true,false,false); } @@ -317,11 +317,11 @@ public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { makeG("s2",Aref,ATC,18,0,24), makeG("s3",Aref,ATC,22,0,12)); List supplTest1 = new ArrayList<>(1); - supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T,C))).attribute(VCFConstants.MLE_ALLELE_COUNT_KEY,Arrays.asList(5,4)).attribute(VCFConstants.ALLELE_NUMBER_KEY,10).make()); + supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,T,C))).attribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY,Arrays.asList(5,4)).attribute(VCFConstants.ALLELE_NUMBER_KEY,10).make()); VariantContext test1result = PosteriorLikelihoodsUtils.calculatePosteriorGLs(inputIndel,supplTest1,0,0.001,true,false,false); System.out.println(test1result); - int[] GPs = _mleparse( (List)test1result.getGenotype(0).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY)); + int[] GPs = _mleparse( (List)test1result.getGenotype(0).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY)); int[] PLs = test1result.getGenotype(0).getPL(); Assert.assertEquals(PLs,GPs); } @@ -332,12 +332,12 @@ public class PosteriorLikelihoodsUtilsUnitTest extends BaseTest { makeG("s2",Aref,T,18,0,24), makeG("s3",Aref,T,22,0,12)); List supplTest1 = new ArrayList<>(1); - supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,ATC,ATCATC))).attribute(VCFConstants.MLE_ALLELE_COUNT_KEY,Arrays.asList(5,4)).attribute(VCFConstants.ALLELE_NUMBER_KEY,10).make()); + supplTest1.add(new VariantContextBuilder(makeVC("2",Arrays.asList(Aref,ATC,ATCATC))).attribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY,Arrays.asList(5,4)).attribute(VCFConstants.ALLELE_NUMBER_KEY,10).make()); VariantContext test1result = PosteriorLikelihoodsUtils.calculatePosteriorGLs(inputIndel,supplTest1,0,0.001,true,false,false); System.out.println(test1result); - int[] GPs = _mleparse( (List)test1result.getGenotype(0).getAnyAttribute(PHRED_SCALED_POSTERIORS_KEY)); + int[] GPs = _mleparse( (List)test1result.getGenotype(0).getAnyAttribute(GATKVCFConstants.PHRED_SCALED_POSTERIORS_KEY)); int[] PLs = test1result.getGenotype(0).getPL(); Assert.assertEquals(PLs,GPs); } diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/variantutils/VariantContextMergerUnitTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/variantutils/VariantContextMergerUnitTest.java index f30bbae4a..9c75bcb68 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/variantutils/VariantContextMergerUnitTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/variantutils/VariantContextMergerUnitTest.java @@ -55,7 +55,7 @@ import htsjdk.variant.variantcontext.*; import org.broadinstitute.gatk.utils.*; import org.broadinstitute.gatk.utils.exceptions.UserException; import org.broadinstitute.gatk.utils.fasta.CachingIndexedFastaSequenceFile; -import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.testng.Assert; import org.testng.annotations.BeforeSuite; import org.testng.annotations.DataProvider; @@ -143,7 +143,7 @@ public class VariantContextMergerUnitTest extends BaseTest { // always add the reference and alleles myAlleles.add(allAlleles.get(0)); - myAlleles.add(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + myAlleles.add(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); // optionally add another alternate allele if ( allelesIndex > 0 ) myAlleles.add(allAlleles.get(allelesIndex)); @@ -180,31 +180,31 @@ public class VariantContextMergerUnitTest extends BaseTest { noCalls.add(Allele.NO_CALL); noCalls.add(Allele.NO_CALL); - final List A_ALT = Arrays.asList(Aref, GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + final List A_ALT = Arrays.asList(Aref, GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); final Genotype gA_ALT = new GenotypeBuilder("A").PL(new int[]{0, 100, 1000}).alleles(noCalls).make(); final VariantContext vcA_ALT = new VariantContextBuilder(VCbase).alleles(A_ALT).genotypes(gA_ALT).make(); final Allele AAref = Allele.create("AA", true); - final List AA_ALT = Arrays.asList(AAref, GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + final List AA_ALT = Arrays.asList(AAref, GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); final Genotype gAA_ALT = new GenotypeBuilder("AA").PL(new int[]{0, 80, 800}).alleles(noCalls).make(); final VariantContext vcAA_ALT = new VariantContextBuilder(VCprevBase).alleles(AA_ALT).genotypes(gAA_ALT).make(); final List A_C = Arrays.asList(Aref, C); final Genotype gA_C = new GenotypeBuilder("A_C").PL(new int[]{30, 20, 10}).alleles(noCalls).make(); - final List A_C_ALT = Arrays.asList(Aref, C, GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + final List A_C_ALT = Arrays.asList(Aref, C, GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); final Genotype gA_C_ALT = new GenotypeBuilder("A_C").PL(standardPLs).alleles(noCalls).make(); final VariantContext vcA_C_ALT = new VariantContextBuilder(VCbase).alleles(A_C_ALT).genotypes(gA_C_ALT).make(); - final List A_G_ALT = Arrays.asList(Aref, G, GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + final List A_G_ALT = Arrays.asList(Aref, G, GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); final Genotype gA_G_ALT = new GenotypeBuilder("A_G").PL(standardPLs).alleles(noCalls).make(); final VariantContext vcA_G_ALT = new VariantContextBuilder(VCbase).alleles(A_G_ALT).genotypes(gA_G_ALT).make(); final List A_C_G = Arrays.asList(Aref, C, G); final Genotype gA_C_G = new GenotypeBuilder("A_C_G").PL(new int[]{40, 20, 30, 20, 10, 30}).alleles(noCalls).make(); - final List A_C_G_ALT = Arrays.asList(Aref, C, G, GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + final List A_C_G_ALT = Arrays.asList(Aref, C, G, GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); final Genotype gA_C_G_ALT = new GenotypeBuilder("A_C_G").PL(new int[]{40, 20, 30, 20, 10, 30, 71, 72, 73, 74}).alleles(noCalls).make(); final VariantContext vcA_C_G_ALT = new VariantContextBuilder(VCbase).alleles(A_C_G_ALT).genotypes(gA_C_G_ALT).make(); - final List A_ATC_ALT = Arrays.asList(Aref, ATC, GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + final List A_ATC_ALT = Arrays.asList(Aref, ATC, GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); final Genotype gA_ATC_ALT = new GenotypeBuilder("A_ATC").PL(standardPLs).alleles(noCalls).make(); final VariantContext vcA_ATC_ALT = new VariantContextBuilder(VCbase).alleles(A_ATC_ALT).genotypes(gA_ATC_ALT).make(); final Allele A = Allele.create("A", false); - final List AA_A_ALT = Arrays.asList(AAref, A, GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + final List AA_A_ALT = Arrays.asList(AAref, A, GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); final Genotype gAA_A_ALT = new GenotypeBuilder("AA_A").PL(standardPLs).alleles(noCalls).make(); final VariantContext vcAA_A_ALT = new VariantContextBuilder(VCprevBase).alleles(AA_A_ALT).genotypes(gAA_A_ALT).make(); diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/utils/gvcf/GVCFWriterUnitTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/utils/gvcf/GVCFWriterUnitTest.java index 5ca1373bf..28fe83d6c 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/utils/gvcf/GVCFWriterUnitTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/utils/gvcf/GVCFWriterUnitTest.java @@ -57,6 +57,7 @@ import htsjdk.variant.vcf.VCFConstants; import htsjdk.variant.vcf.VCFHeader; import org.broadinstitute.gatk.utils.BaseTest; import org.broadinstitute.gatk.utils.Utils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import org.broadinstitute.gatk.utils.variant.HomoSapiensConstants; import org.testng.Assert; @@ -95,7 +96,7 @@ public class GVCFWriterUnitTest extends BaseTest { private List standardPartition = Arrays.asList(1, 10, 20); private Allele REF = Allele.create("N", true); private Allele ALT = Allele.create("A"); - private List ALLELES = Arrays.asList(REF, GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + private List ALLELES = Arrays.asList(REF, GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); private final String SAMPLE_NAME = "XXYYZZ"; @BeforeMethod @@ -268,10 +269,10 @@ public class GVCFWriterUnitTest extends BaseTest { Assert.assertEquals(vc.getStart(), start); Assert.assertEquals(vc.getEnd(), stop); if ( nonRef ) { - Assert.assertNotEquals(vc.getAlternateAllele(0), GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + Assert.assertNotEquals(vc.getAlternateAllele(0), GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); } else { Assert.assertEquals(vc.getNAlleles(), 2); - Assert.assertEquals(vc.getAlternateAllele(0), GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE); + Assert.assertEquals(vc.getAlternateAllele(0), GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE); Assert.assertEquals(vc.getAttributeAsInt(VCFConstants.END_KEY, -1), stop); Assert.assertTrue(vc.hasGenotypes()); Assert.assertTrue(vc.hasGenotype(SAMPLE_NAME)); diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/utils/haplotypeBAMWriter/HaplotypeBAMWriterUnitTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/utils/haplotypeBAMWriter/HaplotypeBAMWriterUnitTest.java index b09efb939..e2f703e01 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/utils/haplotypeBAMWriter/HaplotypeBAMWriterUnitTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/utils/haplotypeBAMWriter/HaplotypeBAMWriterUnitTest.java @@ -82,7 +82,7 @@ public class HaplotypeBAMWriterUnitTest extends BaseTest { private Haplotype makeHaplotype(final String bases, final String cigar) { final Haplotype hap = new Haplotype(bases.getBytes()); - hap.setCigar(TextCigarCodec.getSingleton().decode(cigar)); + hap.setCigar(TextCigarCodec.decode(cigar)); return hap; } @@ -160,7 +160,7 @@ public class HaplotypeBAMWriterUnitTest extends BaseTest { final String badCigar = "31M6D211M"; final String goodCigar = "28M6D214M"; final Haplotype badHap = new Haplotype(hap.getBytes()); - badHap.setCigar(TextCigarCodec.getSingleton().decode(hapCigar)); + badHap.setCigar(TextCigarCodec.decode(hapCigar)); badHap.setAlignmentStartHapwrtRef(hapStart); final int expectedPos = 10130740; @@ -179,7 +179,7 @@ public class HaplotypeBAMWriterUnitTest extends BaseTest { if ( expectedReadCigar == null ) { Assert.assertNull(AlignmentUtils.createReadAlignedToRef(read, haplotype, haplotype, refStart, true)); } else { - final Cigar expectedCigar = TextCigarCodec.getSingleton().decode(expectedReadCigar); + final Cigar expectedCigar = TextCigarCodec.decode(expectedReadCigar); final GATKSAMRecord alignedRead = AlignmentUtils.createReadAlignedToRef(read, haplotype, haplotype, refStart, true); Assert.assertEquals(alignedRead.getReadName(), originalReadCopy.getReadName()); diff --git a/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/datasources/reads/GATKBAMIndex.java b/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/datasources/reads/GATKBAMIndex.java index 17afd5894..3b94e438a 100644 --- a/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/datasources/reads/GATKBAMIndex.java +++ b/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/datasources/reads/GATKBAMIndex.java @@ -363,6 +363,8 @@ public class GATKBAMIndex { private void read(final ByteBuffer buffer) { final int bytesRequested = buffer.limit(); + if (bytesRequested == 0) + return; try { @@ -379,25 +381,19 @@ public class GATKBAMIndex { mFile)); } - int totalBytesRead = 0; - // This while loop must terminate since we demand that we read at least one byte from the file at each iteration - while (totalBytesRead < bytesRequested) { - // bufferedStream.read may return less than the requested amount of byte despite - // not reaching the end of the file, hence the loop. - int bytesRead = bufferedStream.read(byteArray, totalBytesRead, bytesRequested-totalBytesRead); + int bytesRead = bufferedStream.read(byteArray, 0, bytesRequested); - // We have a rigid expectation here to read in exactly the number of bytes we've limited - // our buffer to -- if we encounter EOF (-1), the index - // must be truncated or otherwise corrupt: - if (bytesRead <= 0) { - throw new UserException.MalformedFile(mFile, String.format("Premature end-of-file while reading BAM index file %s. " + - "It's likely that this file is truncated or corrupt -- " + - "Please try re-indexing the corresponding BAM file.", - mFile)); - } - totalBytesRead += bytesRead; + // We have a rigid expectation here to read in exactly the number of bytes we've limited + // our buffer to -- if we encounter EOF (-1), the index + // must be truncated or otherwise corrupt: + if (bytesRead <= 0) { + throw new UserException.MalformedFile(mFile, String.format("Premature end-of-file while reading BAM index file %s. " + + "It's likely that this file is truncated or corrupt -- " + + "Please try re-indexing the corresponding BAM file.", + mFile)); } - if(totalBytesRead != bytesRequested) + + if(bytesRead != bytesRequested) throw new RuntimeException("Read amount different from requested amount. This should not happen."); buffer.put(byteArray, 0, bytesRequested); @@ -435,7 +431,7 @@ public class GATKBAMIndex { long skipped = bufferedStream.skip(count); if( skipped != count ) { //if not managed to skip the requested amount - throw new ReviewedGATKException("Index: unable to reposition file channel of index file " + mFile); + throw new ReviewedGATKException("Index: unable to reposition file channel of index file " + mFile); } } catch(IOException ex) { diff --git a/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/datasources/reads/SAMDataSource.java b/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/datasources/reads/SAMDataSource.java index 4c4759b26..9933a6152 100644 --- a/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/datasources/reads/SAMDataSource.java +++ b/public/gatk-engine/src/main/java/org/broadinstitute/gatk/engine/datasources/reads/SAMDataSource.java @@ -564,7 +564,7 @@ public class SAMDataSource { */ private GATKSAMIterator getIterator(SAMReaders readers, Shard shard, boolean enableVerification) { // Set up merging to dynamically merge together multiple BAMs. - Map> iteratorMap = new HashMap>(); + Map> iteratorMap = new HashMap<>(); for(SAMReaderID id: getReaderIDs()) { CloseableIterator iterator = null; @@ -1000,7 +1000,7 @@ public class SAMDataSource { * @param iteratorMap A map of readers to iterators. * @return An iterator which will merge those individual iterators. */ - public MergingSamRecordIterator createMergingIterator(final Map> iteratorMap) { + public MergingSamRecordIterator createMergingIterator(final Map> iteratorMap) { return new MergingSamRecordIterator(headerMerger,iteratorMap,true); } diff --git a/public/gatk-engine/src/test/java/org/broadinstitute/gatk/engine/datasources/reads/SeekableBufferedStreamUnitTest.java b/public/gatk-engine/src/test/java/org/broadinstitute/gatk/engine/datasources/reads/SeekableBufferedStreamUnitTest.java index c24a21a63..c67cadb8d 100644 --- a/public/gatk-engine/src/test/java/org/broadinstitute/gatk/engine/datasources/reads/SeekableBufferedStreamUnitTest.java +++ b/public/gatk-engine/src/test/java/org/broadinstitute/gatk/engine/datasources/reads/SeekableBufferedStreamUnitTest.java @@ -28,7 +28,6 @@ package org.broadinstitute.gatk.engine.datasources.reads; import htsjdk.samtools.seekablestream.SeekableBufferedStream; import htsjdk.samtools.seekablestream.SeekableFileStream; import org.broadinstitute.gatk.utils.BaseTest; -import org.broadinstitute.gatk.utils.exceptions.GATKException; import org.testng.Assert; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -77,9 +76,13 @@ public class SeekableBufferedStreamUnitTest extends BaseTest { // These tests fail because SeekableBuffered stream may return _less_ than the amount you are asking for. // make sure that you wrap reads with while-loops. If these test start failing (meaning that the reads work properly, // the layer of protection built into GATKBamIndex can be removed. + // + // pdexheimer, Jan 2015 - SeekableBufferedStream no longer returns less than the expected amount. + // Renaming testIndivisableSmallReadsFAIL to testIndivisableSmallReadsPASS and removing the expected exception + // If this bug regresses, the while loop will need to be re-introduced into GATKBamIndex.read() - @Test(dataProvider = "BasicArgumentsIndivisibleAndSmall", enabled = true, expectedExceptions = java.lang.AssertionError.class) - public void testIndivisableSmallReadsFAIL(Integer readLength) throws IOException { + @Test(dataProvider = "BasicArgumentsIndivisibleAndSmall", enabled = true) + public void testIndivisableSmallReadsPASS(Integer readLength) throws IOException { testReadsLength(readLength); } diff --git a/public/gatk-engine/src/test/java/org/broadinstitute/gatk/engine/filters/MalformedReadFilterUnitTest.java b/public/gatk-engine/src/test/java/org/broadinstitute/gatk/engine/filters/MalformedReadFilterUnitTest.java index 20566f510..405610011 100644 --- a/public/gatk-engine/src/test/java/org/broadinstitute/gatk/engine/filters/MalformedReadFilterUnitTest.java +++ b/public/gatk-engine/src/test/java/org/broadinstitute/gatk/engine/filters/MalformedReadFilterUnitTest.java @@ -117,7 +117,7 @@ public class MalformedReadFilterUnitTest extends ReadFilterTest { } protected SAMRecord buildSAMRecord(final String cigarString) { - final Cigar nContainingCigar = TextCigarCodec.getSingleton().decode(cigarString); + final Cigar nContainingCigar = TextCigarCodec.decode(cigarString); return this.createRead(nContainingCigar, 1, 0, 10); } diff --git a/public/gatk-engine/src/test/java/org/broadinstitute/gatk/engine/iterators/ReadFormattingIteratorUnitTest.java b/public/gatk-engine/src/test/java/org/broadinstitute/gatk/engine/iterators/ReadFormattingIteratorUnitTest.java index d6f4be97a..c12bb1551 100644 --- a/public/gatk-engine/src/test/java/org/broadinstitute/gatk/engine/iterators/ReadFormattingIteratorUnitTest.java +++ b/public/gatk-engine/src/test/java/org/broadinstitute/gatk/engine/iterators/ReadFormattingIteratorUnitTest.java @@ -40,7 +40,7 @@ public class ReadFormattingIteratorUnitTest extends BaseTest { @Test public void testIteratorConsolidatesCigars() { - final Cigar unconsolidatedCigar = TextCigarCodec.getSingleton().decode("3M0M5M0M"); + final Cigar unconsolidatedCigar = TextCigarCodec.decode("3M0M5M0M"); final SAMRecord unconsolidatedRead = ArtificialSAMUtils.createArtificialRead(unconsolidatedCigar); final GATKSAMIterator readIterator = GATKSAMIteratorAdapter.adapt(Arrays.asList(unconsolidatedRead).iterator()); diff --git a/public/gatk-root/pom.xml b/public/gatk-root/pom.xml index 928b9d162..09011c46d 100644 --- a/public/gatk-root/pom.xml +++ b/public/gatk-root/pom.xml @@ -44,8 +44,8 @@ org.testng.reporters.FailedReporter,org.testng.reporters.JUnitXMLReporter,org.broadinstitute.gatk.utils.TestNGTestTransformer,org.broadinstitute.gatk.utils.GATKTextReporter,org.uncommons.reportng.HTMLReporter - 1.123.1658 - 1.123.1620 + 1.127.1690 + 1.127.1667 diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/AlleleBalance.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/AlleleBalance.java index 20240897c..5de5d6656 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/AlleleBalance.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/AlleleBalance.java @@ -30,8 +30,6 @@ import htsjdk.variant.variantcontext.Allele; import htsjdk.variant.variantcontext.Genotype; import htsjdk.variant.variantcontext.GenotypesContext; import htsjdk.variant.variantcontext.VariantContext; -import htsjdk.variant.vcf.VCFHeaderLineType; -import htsjdk.variant.vcf.VCFInfoHeaderLine; import org.broadinstitute.gatk.utils.contexts.AlignmentContext; import org.broadinstitute.gatk.utils.contexts.ReferenceContext; import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker; @@ -40,6 +38,7 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.InfoFieldAnnot import org.broadinstitute.gatk.utils.MathUtils; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.pileup.ReadBackedPileup; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import java.util.Arrays; import java.util.HashMap; @@ -144,15 +143,15 @@ public class AlleleBalance extends InfoFieldAnnotation { Map map = new HashMap<>(); if ( weightHet > 0.0 ) { - map.put("ABHet",ratioHet/weightHet); + map.put(GATKVCFConstants.ALLELE_BALANCE_HET_KEY,ratioHet/weightHet); } if ( weightHom > 0.0 ) { - map.put("ABHom",ratioHom/weightHom); + map.put(GATKVCFConstants.ALLELE_BALANCE_HOM_KEY,ratioHom/weightHom); } if ( overallNonDiploid > 0.0 ) { - map.put("OND",overallNonDiploid); + map.put(GATKVCFConstants.NON_DIPLOID_RATIO_KEY,overallNonDiploid); } return map; } @@ -210,9 +209,10 @@ public class AlleleBalance extends InfoFieldAnnotation { } - public List getKeyNames() { return Arrays.asList("ABHet","ABHom","OND"); } - - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("ABHet", 1, VCFHeaderLineType.Float, "Allele Balance for heterozygous calls (ref/(ref+alt))"), - new VCFInfoHeaderLine("ABHom", 1, VCFHeaderLineType.Float, "Allele Balance for homozygous calls (A/(A+O)) where A is the allele (ref or alt) and O is anything other"), - new VCFInfoHeaderLine("OND", 1, VCFHeaderLineType.Float, "Overall non-diploid ratio (alleles/(alleles+non-alleles))")); } + @Override + public List getKeyNames() { + return Arrays.asList(GATKVCFConstants.ALLELE_BALANCE_HET_KEY, + GATKVCFConstants.ALLELE_BALANCE_HOM_KEY, + GATKVCFConstants.NON_DIPLOID_RATIO_KEY); + } } \ No newline at end of file diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/AlleleBalanceBySample.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/AlleleBalanceBySample.java index c5670068d..19c0d2697 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/AlleleBalanceBySample.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/AlleleBalanceBySample.java @@ -43,6 +43,8 @@ import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.pileup.PileupElement; import org.broadinstitute.gatk.utils.pileup.ReadBackedPileup; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.Arrays; import java.util.HashMap; @@ -92,7 +94,7 @@ public class AlleleBalanceBySample extends GenotypeAnnotation implements Experim // and isBiallelic() while ignoring the allele boolean biallelicSNP = vc.isSNP() && vc.isBiallelic(); - if(vc.hasAllele(GVCF_NONREF)){ + if(vc.hasAllele(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE)){ // If we have the GVCF allele, then the SNP is biallelic // iff there are 3 alleles and both the reference and first alt // allele are length 1. @@ -118,8 +120,6 @@ public class AlleleBalanceBySample extends GenotypeAnnotation implements Experim gb.attribute(getKeyNames().get(0), Double.valueOf(String.format("%.2f", ratio))); } - private static final Allele GVCF_NONREF = Allele.create("", false); - private Double annotateWithPileup(final AlignmentContext stratifiedContext, final VariantContext vc) { final HashMap alleleCounts = new HashMap<>(); @@ -175,7 +175,7 @@ public class AlleleBalanceBySample extends GenotypeAnnotation implements Experim } - public List getKeyNames() { return Arrays.asList("AB"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.ALLELE_BALANCE_KEY); } - public List getDescriptions() { return Arrays.asList(new VCFFormatHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Float, "Allele balance for each het genotype")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getFormatLine(getKeyNames().get(0))); } } \ No newline at end of file diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/BaseCounts.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/BaseCounts.java index 0fefa4350..a01c945ac 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/BaseCounts.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/BaseCounts.java @@ -32,9 +32,10 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.AnnotatorCompa import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.BaseUtils; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.Arrays; import java.util.HashMap; @@ -80,12 +81,12 @@ import java.util.Map; counts[index]++; } } - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(getKeyNames().get(0), counts); return map; } - public List getKeyNames() { return Arrays.asList("BaseCounts"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.BASE_COUNTS_KEY); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("BaseCounts", 4, VCFHeaderLineType.Integer, "Counts of each base")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } } \ No newline at end of file diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/LowMQ.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/LowMQ.java index c76b2917d..995279927 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/LowMQ.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/LowMQ.java @@ -31,10 +31,11 @@ import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker; import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.AnnotatorCompatible; import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import org.broadinstitute.gatk.utils.pileup.PileupElement; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.Arrays; import java.util.HashMap; @@ -80,12 +81,12 @@ public class LowMQ extends InfoFieldAnnotation { total += 1; } } - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(getKeyNames().get(0), String.format("%.04f,%.04f,%.00f", mq0/total, mq10/total, total)); return map; } - public List getKeyNames() { return Arrays.asList("LowMQ"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.LOW_MQ_KEY); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 3, VCFHeaderLineType.Float, "3-tuple: ,,")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } } diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/MappingQualityZeroBySample.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/MappingQualityZeroBySample.java index 2fdfdfe6d..5e632dc7c 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/MappingQualityZeroBySample.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/MappingQualityZeroBySample.java @@ -33,12 +33,13 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.GenotypeAnnota import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import htsjdk.variant.vcf.VCFConstants; import htsjdk.variant.vcf.VCFFormatHeaderLine; -import htsjdk.variant.vcf.VCFHeaderLineType; import org.broadinstitute.gatk.utils.pileup.PileupElement; import org.broadinstitute.gatk.utils.pileup.ReadBackedPileup; import htsjdk.variant.variantcontext.Genotype; import htsjdk.variant.variantcontext.GenotypeBuilder; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.Arrays; import java.util.List; @@ -76,11 +77,9 @@ public class MappingQualityZeroBySample extends GenotypeAnnotation { gb.attribute(getKeyNames().get(0), mq0); } - public List getKeyNames() { return Arrays.asList(VCFConstants.MAPPING_QUALITY_ZERO_KEY); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.MAPPING_QUALITY_ZERO_BY_SAMPLE_KEY); } - public List getDescriptions() { return Arrays.asList( - new VCFFormatHeaderLine(getKeyNames().get(0), 1, - VCFHeaderLineType.Integer, "Number of Mapping Quality Zero Reads per sample")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getFormatLine(getKeyNames().get(0))); } } diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/NBaseCount.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/NBaseCount.java index 9cb6eeeaa..5ec474119 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/NBaseCount.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/NBaseCount.java @@ -32,10 +32,11 @@ import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.AnnotatorCompa import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.gatk.utils.BaseUtils; -import htsjdk.variant.vcf.VCFHeaderLineType; import htsjdk.variant.vcf.VCFInfoHeaderLine; import org.broadinstitute.gatk.utils.pileup.PileupElement; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.Arrays; import java.util.HashMap; @@ -70,7 +71,6 @@ public class NBaseCount extends InfoFieldAnnotation { for( final AlignmentContext context : stratifiedContexts.values() ) { for( final PileupElement p : context.getBasePileup()) { - final String platform = p.getRead().getReadGroup().getPlatform(); if( BaseUtils.isNBase( p.getBase() ) ) { countNBase++; } else if( BaseUtils.isRegularBase( p.getBase() ) ) { @@ -78,12 +78,12 @@ public class NBaseCount extends InfoFieldAnnotation { } } } - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put(getKeyNames().get(0), String.format("%.4f", (double)countNBase / (double)(countNBase + countRegularBase + 1))); return map; } - public List getKeyNames() { return Arrays.asList("PercentNBase"); } + public List getKeyNames() { return Arrays.asList(GATKVCFConstants.N_BASE_COUNT_KEY); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("PercentNBase", 1, VCFHeaderLineType.Float, "Percentage of N bases in the pileup")); } + public List getDescriptions() { return Arrays.asList(GATKVCFHeaderLines.getInfoLine(getKeyNames().get(0))); } } diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/interfaces/InfoFieldAnnotation.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/interfaces/InfoFieldAnnotation.java index 571055524..d1fb3f015 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/interfaces/InfoFieldAnnotation.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/interfaces/InfoFieldAnnotation.java @@ -31,7 +31,9 @@ import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker; import org.broadinstitute.gatk.utils.genotyper.PerReadAlleleLikelihoodMap; import htsjdk.variant.vcf.VCFInfoHeaderLine; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -58,5 +60,11 @@ public abstract class InfoFieldAnnotation extends VariantAnnotatorAnnotation { final Map stratifiedPerReadAlleleLikelihoodMap); // return the descriptions used for the VCF INFO meta field - public abstract List getDescriptions(); + public List getDescriptions() { + final List lines = new ArrayList<>(5); + for (final String key : getKeyNames()) { + lines.add(GATKVCFHeaderLines.getInfoLine(key)); + } + return lines; + } } \ No newline at end of file diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/beagle/BeagleOutputToVCF.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/beagle/BeagleOutputToVCF.java index 1c59dc51d..2656e1ef0 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/beagle/BeagleOutputToVCF.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/beagle/BeagleOutputToVCF.java @@ -41,6 +41,8 @@ import htsjdk.variant.vcf.*; import org.broadinstitute.gatk.utils.help.DocumentedGATKFeature; import htsjdk.variant.variantcontext.*; import htsjdk.variant.variantcontext.writer.VariantContextWriter; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import java.util.*; @@ -129,25 +131,22 @@ public class BeagleOutputToVCF extends RodWalker { private final double MIN_PROB_ERROR = 0.000001; private final double MAX_GENOTYPE_QUALITY = -6.0; - private final static String BEAGLE_MONO_FILTER_STRING = "BGL_SET_TO_MONOMORPHIC"; - private final static String ORIGINAL_ALT_ALLELE_INFO_KEY = "OriginalAltAllele"; - public void initialize() { // setup the header fields - final Set hInfo = new HashSet(); + final Set hInfo = new HashSet<>(); hInfo.addAll(GATKVCFUtils.getHeaderFields(getToolkit())); - hInfo.add(new VCFFormatHeaderLine("OG",1, VCFHeaderLineType.String, "Original Genotype input to Beagle")); - hInfo.add(new VCFInfoHeaderLine("R2", 1, VCFHeaderLineType.Float, "r2 Value reported by Beagle on each site")); - hInfo.add(new VCFInfoHeaderLine("NumGenotypesChanged", 1, VCFHeaderLineType.Integer, "The number of genotypes changed by Beagle")); - hInfo.add(new VCFInfoHeaderLine(ORIGINAL_ALT_ALLELE_INFO_KEY, 1, VCFHeaderLineType.String, "The original alt allele for a site set to monomorphic by Beagle")); - hInfo.add(new VCFFilterHeaderLine(BEAGLE_MONO_FILTER_STRING, "This site was set to monomorphic by Beagle")); + hInfo.add(GATKVCFHeaderLines.getFormatLine(GATKVCFConstants.ORIGINAL_GENOTYPE_KEY)); + hInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.BEAGLE_R2_KEY)); + hInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.NUM_GENOTYPES_CHANGED_KEY)); + hInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.ORIGINAL_ALT_ALLELE_INFO_KEY)); + hInfo.add(GATKVCFHeaderLines.getFilterLine(GATKVCFConstants.BEAGLE_MONO_FILTER_NAME)); if ( comp.isBound() ) { - hInfo.add(new VCFInfoHeaderLine("ACH", 1, VCFHeaderLineType.Integer, "Allele Count from Comparison ROD at this site")); - hInfo.add(new VCFInfoHeaderLine("ANH", 1, VCFHeaderLineType.Integer, "Allele Frequency from Comparison ROD at this site")); - hInfo.add(new VCFInfoHeaderLine("AFH", 1, VCFHeaderLineType.Float, "Allele Number from Comparison ROD at this site")); + hInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.BEAGLE_AC_COMP_KEY)); + hInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.BEAGLE_AF_COMP_KEY)); + hInfo.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.BEAGLE_AN_COMP_KEY)); } Set samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(variantCollection.variants.getName())); @@ -237,7 +236,7 @@ public class BeagleOutputToVCF extends RodWalker { // We have phased genotype in hp. Need to set the isRef field in the allele. - List alleles = new ArrayList(); + List alleles = new ArrayList<>(); String alleleA = beagleGenotypePairs.get(0); String alleleB = beagleGenotypePairs.get(1); @@ -298,7 +297,7 @@ public class BeagleOutputToVCF extends RodWalker { else genotypeQuality = log10(probWrongGenotype); - HashMap originalAttributes = new HashMap(g.getExtendedAttributes()); + HashMap originalAttributes = new HashMap<>(g.getExtendedAttributes()); // get original encoding and add to keynotype attributes String a1, a2, og; @@ -320,11 +319,11 @@ public class BeagleOutputToVCF extends RodWalker { // See if Beagle switched genotypes if (! originalAlleleA.equals(Allele.NO_CALL) && beagleSwitchedGenotypes(bglAlleleA,originalAlleleA,bglAlleleB,originalAlleleB)){ - originalAttributes.put("OG",og); + originalAttributes.put(GATKVCFConstants.ORIGINAL_GENOTYPE_KEY, og); numGenotypesChangedByBeagle++; } else { - originalAttributes.put("OG","."); + originalAttributes.put(GATKVCFConstants.ORIGINAL_GENOTYPE_KEY, "."); } Genotype imputedGenotype = new GenotypeBuilder(g).alleles(alleles).log10PError(genotypeQuality).attributes(originalAttributes).phased(genotypeIsPhased).make(); if ( imputedGenotype.isHet() || imputedGenotype.isHomVar() ) { @@ -336,8 +335,8 @@ public class BeagleOutputToVCF extends RodWalker { final VariantContextBuilder builder = new VariantContextBuilder(vc_input).source("outputvcf").genotypes(genotypes); if ( ! ( beagleVarCounts > 0 || DONT_FILTER_MONOMORPHIC_SITES ) ) { - builder.attribute(ORIGINAL_ALT_ALLELE_INFO_KEY, vc_input.getAlternateAllele(0)); - builder.alleles(Collections.singleton(vc_input.getReference())).filter(BEAGLE_MONO_FILTER_STRING); + builder.attribute(GATKVCFConstants.ORIGINAL_ALT_ALLELE_INFO_KEY, vc_input.getAlternateAllele(0)); + builder.alleles(Collections.singleton(vc_input.getReference())).filter(GATKVCFConstants.BEAGLE_MONO_FILTER_NAME); } // re-compute chromosome counts @@ -345,15 +344,15 @@ public class BeagleOutputToVCF extends RodWalker { // Get Hapmap AC and AF if (vc_comp != null) { - builder.attribute("ACH", alleleCountH.toString() ); - builder.attribute("ANH", chrCountH.toString() ); - builder.attribute("AFH", String.format("%4.2f", (double)alleleCountH/chrCountH) ); + builder.attribute(GATKVCFConstants.BEAGLE_AC_COMP_KEY, alleleCountH.toString() ); + builder.attribute(GATKVCFConstants.BEAGLE_AN_COMP_KEY, chrCountH.toString() ); + builder.attribute(GATKVCFConstants.BEAGLE_AF_COMP_KEY, String.format("%4.2f", (double)alleleCountH/chrCountH) ); } - builder.attribute("NumGenotypesChanged", numGenotypesChangedByBeagle ); + builder.attribute(GATKVCFConstants.NUM_GENOTYPES_CHANGED_KEY, numGenotypesChangedByBeagle ); if( !beagleR2Feature.getR2value().equals(Double.NaN) ) { - builder.attribute("R2", beagleR2Feature.getR2value().toString() ); + builder.attribute(GATKVCFConstants.BEAGLE_R2_KEY, beagleR2Feature.getR2value().toString() ); } vcfWriter.add(builder.make()); diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/varianteval/stratifications/AlleleCount.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/varianteval/stratifications/AlleleCount.java index d7173d921..54cc06cfb 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/varianteval/stratifications/AlleleCount.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/varianteval/stratifications/AlleleCount.java @@ -33,6 +33,7 @@ import htsjdk.variant.vcf.VCFConstants; import org.broadinstitute.gatk.utils.exceptions.UserException; import htsjdk.variant.variantcontext.Allele; import htsjdk.variant.variantcontext.VariantContext; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import java.util.*; @@ -72,9 +73,9 @@ public class AlleleCount extends VariantStratifier { try { if ( eval.isBiallelic() ) { - if ( eval.hasAttribute(VCFConstants.MLE_ALLELE_COUNT_KEY) ) { + if ( eval.hasAttribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY) ) { // the MLEAC is allowed to be larger than the AN (e.g. in the case of all PLs being 0, the GT is ./. but the exact model may arbitrarily choose an AC>1) - AC = Math.min(eval.getAttributeAsInt(VCFConstants.MLE_ALLELE_COUNT_KEY, 0), nchrom); + AC = Math.min(eval.getAttributeAsInt(GATKVCFConstants.MLE_ALLELE_COUNT_KEY, 0), nchrom); } else if ( eval.hasAttribute(VCFConstants.ALLELE_COUNT_KEY) ) { AC = eval.getAttributeAsInt(VCFConstants.ALLELE_COUNT_KEY, 0); } diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CombineVariants.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CombineVariants.java index d4aa7afbf..7783b5b31 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CombineVariants.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CombineVariants.java @@ -39,6 +39,7 @@ import org.broadinstitute.gatk.utils.variant.ChromosomeCountConstants; import org.broadinstitute.gatk.engine.SampleUtils; import org.broadinstitute.gatk.utils.help.HelpConstants; import org.broadinstitute.gatk.engine.GATKVCFUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import htsjdk.variant.vcf.*; import org.broadinstitute.gatk.utils.exceptions.UserException; @@ -337,7 +338,7 @@ public class CombineVariants extends RodWalker implements Tree if ( mergedVC == null ) continue; - if ( mergedVC.hasAllele(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE) ) + if ( mergedVC.hasAllele(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE) ) throw new UserException("CombineVariants should not be used to merge gVCFs produced by the HaplotypeCaller; use CombineGVCFs instead"); final VariantContextBuilder builder = new VariantContextBuilder(mergedVC); diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/LiftoverVariants.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/LiftoverVariants.java index 4448226fc..f66daf254 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/LiftoverVariants.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/LiftoverVariants.java @@ -29,6 +29,8 @@ import htsjdk.samtools.liftover.LiftOver; import htsjdk.samtools.util.Interval; import htsjdk.samtools.SAMFileHeader; import htsjdk.samtools.SAMFileReader; +import htsjdk.variant.vcf.VCFHeader; +import htsjdk.variant.vcf.VCFHeaderLine; import org.broadinstitute.gatk.utils.commandline.Argument; import org.broadinstitute.gatk.utils.commandline.ArgumentCollection; import org.broadinstitute.gatk.utils.commandline.Output; @@ -41,9 +43,10 @@ import org.broadinstitute.gatk.engine.walkers.RodWalker; import org.broadinstitute.gatk.engine.SampleUtils; import org.broadinstitute.gatk.utils.help.HelpConstants; import org.broadinstitute.gatk.engine.GATKVCFUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import htsjdk.variant.variantcontext.writer.Options; -import htsjdk.variant.vcf.*; import org.broadinstitute.gatk.utils.exceptions.UserException; import org.broadinstitute.gatk.utils.help.DocumentedGATKFeature; import htsjdk.variant.variantcontext.VariantContext; @@ -109,12 +112,12 @@ public class LiftoverVariants extends RodWalker { Set samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(trackName)); Map vcfHeaders = GATKVCFUtils.getVCFHeadersFromRods(getToolkit(), Arrays.asList(trackName)); - Set metaData = new HashSet(); + Set metaData = new HashSet<>(); if ( vcfHeaders.containsKey(trackName) ) metaData.addAll(vcfHeaders.get(trackName).getMetaDataInSortedOrder()); if ( RECORD_ORIGINAL_LOCATION ) { - metaData.add(new VCFInfoHeaderLine("OriginalChr", 1, VCFHeaderLineType.String, "Original contig name for the record")); - metaData.add(new VCFInfoHeaderLine("OriginalStart", 1, VCFHeaderLineType.Integer, "Original start position for the record")); + metaData.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.ORIGINAL_CONTIG_KEY)); + metaData.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.ORIGINAL_START_KEY)); } @@ -140,8 +143,8 @@ public class LiftoverVariants extends RodWalker { if ( RECORD_ORIGINAL_LOCATION ) { vc = new VariantContextBuilder(vc) - .attribute("OriginalChr", fromInterval.getSequence()) - .attribute("OriginalStart", fromInterval.getStart()).make(); + .attribute(GATKVCFConstants.ORIGINAL_CONTIG_KEY, fromInterval.getSequence()) + .attribute(GATKVCFConstants.ORIGINAL_START_KEY, fromInterval.getStart()).make(); } if ( originalVC.isSNP() && originalVC.isBiallelic() && GATKVariantContextUtils.getSNPSubstitutionType(originalVC) != GATKVariantContextUtils.getSNPSubstitutionType(vc) ) { diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/SelectVariants.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/SelectVariants.java index 50c8ca61f..3da616632 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/SelectVariants.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/SelectVariants.java @@ -39,6 +39,8 @@ import org.broadinstitute.gatk.engine.SampleUtils; import org.broadinstitute.gatk.utils.Utils; import org.broadinstitute.gatk.utils.help.HelpConstants; import org.broadinstitute.gatk.engine.GATKVCFUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; +import org.broadinstitute.gatk.utils.variant.GATKVCFHeaderLines; import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; import htsjdk.variant.vcf.*; import org.broadinstitute.gatk.utils.exceptions.UserException; @@ -422,9 +424,9 @@ public class SelectVariants extends RodWalker implements TreeR headerLines.add(new VCFHeaderLine("source", "SelectVariants")); if (KEEP_ORIGINAL_CHR_COUNTS) { - headerLines.add(new VCFInfoHeaderLine("AC_Orig", VCFHeaderLineCount.A, VCFHeaderLineType.Integer, "Original AC")); - headerLines.add(new VCFInfoHeaderLine("AF_Orig", VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Original AF")); - headerLines.add(new VCFInfoHeaderLine("AN_Orig", 1, VCFHeaderLineType.Integer, "Original AN")); + headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.ORIGINAL_AC_KEY)); + headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.ORIGINAL_AF_KEY)); + headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.ORIGINAL_AN_KEY)); } headerLines.addAll(Arrays.asList(ChromosomeCountConstants.descriptions)); headerLines.add(VCFStandardHeaderLines.getInfoLine(VCFConstants.DEPTH_KEY)); @@ -695,8 +697,8 @@ public class SelectVariants extends RodWalker implements TreeR // if we have fewer samples in the selected VC than in the original VC, we need to strip out the MLE tags if ( vc.getNSamples() != sub.getNSamples() ) { - builder.rmAttribute(VCFConstants.MLE_ALLELE_COUNT_KEY); - builder.rmAttribute(VCFConstants.MLE_ALLELE_FREQUENCY_KEY); + builder.rmAttribute(GATKVCFConstants.MLE_ALLELE_COUNT_KEY); + builder.rmAttribute(GATKVCFConstants.MLE_ALLELE_FREQUENCY_KEY); } // Remove a fraction of the genotypes if needed @@ -763,11 +765,11 @@ public class SelectVariants extends RodWalker implements TreeR } if ( originalVC.hasAttribute(VCFConstants.ALLELE_COUNT_KEY) ) - builder.attribute("AC_Orig", getReorderedAttributes(originalVC.getAttribute(VCFConstants.ALLELE_COUNT_KEY), indexOfOriginalAlleleForNewAllele)); + builder.attribute(GATKVCFConstants.ORIGINAL_AC_KEY, getReorderedAttributes(originalVC.getAttribute(VCFConstants.ALLELE_COUNT_KEY), indexOfOriginalAlleleForNewAllele)); if ( originalVC.hasAttribute(VCFConstants.ALLELE_FREQUENCY_KEY) ) - builder.attribute("AF_Orig", getReorderedAttributes(originalVC.getAttribute(VCFConstants.ALLELE_FREQUENCY_KEY), indexOfOriginalAlleleForNewAllele)); + builder.attribute(GATKVCFConstants.ORIGINAL_AF_KEY, getReorderedAttributes(originalVC.getAttribute(VCFConstants.ALLELE_FREQUENCY_KEY), indexOfOriginalAlleleForNewAllele)); if ( originalVC.hasAttribute(VCFConstants.ALLELE_NUMBER_KEY) ) - builder.attribute("AN_Orig", originalVC.getAttribute(VCFConstants.ALLELE_NUMBER_KEY)); + builder.attribute(GATKVCFConstants.ORIGINAL_AN_KEY, originalVC.getAttribute(VCFConstants.ALLELE_NUMBER_KEY)); } VariantContextUtils.calculateChromosomeCounts(builder, false); @@ -786,7 +788,7 @@ public class SelectVariants extends RodWalker implements TreeR } if ( sawDP ) - builder.attribute("DP", depth); + builder.attribute(VCFConstants.DEPTH_KEY, depth); } /** diff --git a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/codecs/samread/SAMReadCodec.java b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/codecs/samread/SAMReadCodec.java index d83ce6d8d..d0e69db9f 100644 --- a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/codecs/samread/SAMReadCodec.java +++ b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/codecs/samread/SAMReadCodec.java @@ -95,7 +95,7 @@ public class SAMReadCodec extends AsciiFeatureCodec { final byte[] qualities = StringUtil.stringToBytes(tokens[10]); // Infer the alignment end. - Cigar cigar = TextCigarCodec.getSingleton().decode(cigarString); + Cigar cigar = TextCigarCodec.decode(cigarString); int alignmentEnd = alignmentStart + cigar.getReferenceLength() - 1; // Remove printable character conversion from the qualities. diff --git a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/genotyper/ReadLikelihoods.java b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/genotyper/ReadLikelihoods.java index a792386e2..e35eeb26d 100644 --- a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/genotyper/ReadLikelihoods.java +++ b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/genotyper/ReadLikelihoods.java @@ -33,7 +33,7 @@ import org.broadinstitute.gatk.utils.downsampling.AlleleBiasedDownsamplingUtils; import org.broadinstitute.gatk.utils.GenomeLoc; import org.broadinstitute.gatk.utils.Utils; import org.broadinstitute.gatk.utils.sam.GATKSAMRecord; -import org.broadinstitute.gatk.utils.variant.GATKVariantContextUtils; +import org.broadinstitute.gatk.utils.variant.GATKVCFConstants; import java.util.*; @@ -1081,13 +1081,13 @@ public class ReadLikelihoods implements SampleList, AlleleList * @param nonRefAllele the non-ref allele. * * @throws IllegalArgumentException if {@code nonRefAllele} is anything but the designated <NON_REF> - * symbolic allele {@link GATKVariantContextUtils#NON_REF_SYMBOLIC_ALLELE}. + * symbolic allele {@link org.broadinstitute.gatk.utils.variant.GATKVCFConstants#NON_REF_SYMBOLIC_ALLELE}. */ public void addNonReferenceAllele(final A nonRefAllele) { if (nonRefAllele == null) throw new IllegalArgumentException("non-ref allele cannot be null"); - if (!nonRefAllele.equals(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE)) + if (!nonRefAllele.equals(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE)) throw new IllegalArgumentException("the non-ref allele is not valid"); // Already present? if (alleles.alleleIndex(nonRefAllele) != -1) diff --git a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/sam/ArtificialMultiSampleReadStream.java b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/sam/ArtificialMultiSampleReadStream.java index a468dc06b..010759ecf 100644 --- a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/sam/ArtificialMultiSampleReadStream.java +++ b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/sam/ArtificialMultiSampleReadStream.java @@ -28,7 +28,7 @@ package org.broadinstitute.gatk.utils.sam; import htsjdk.samtools.MergingSamRecordIterator; import htsjdk.samtools.SamFileHeaderMerger; import htsjdk.samtools.SAMFileHeader; -import htsjdk.samtools.SAMFileReader; +import htsjdk.samtools.SamReader; import htsjdk.samtools.SAMRecord; import org.broadinstitute.gatk.utils.iterators.GATKSAMIterator; import org.broadinstitute.gatk.utils.iterators.GATKSAMIteratorAdapter; @@ -69,13 +69,13 @@ public class ArtificialMultiSampleReadStream implements Iterable { } private void initialize() { - Collection perSampleSAMReaders = new ArrayList(perSampleArtificialReadStreams.size()); - Collection headers = new ArrayList(perSampleArtificialReadStreams.size()); + Collection perSampleSAMReaders = new ArrayList<>(perSampleArtificialReadStreams.size()); + Collection headers = new ArrayList<>(perSampleArtificialReadStreams.size()); for ( ArtificialSingleSampleReadStream readStream : perSampleArtificialReadStreams ) { Collection thisStreamReads = readStream.makeReads(); - SAMFileReader reader = new ArtificialSAMFileReader(readStream.getHeader(), + ArtificialSAMFileReader reader = new ArtificialSAMFileReader(readStream.getHeader(), thisStreamReads.toArray(new SAMRecord[thisStreamReads.size()])); perSampleSAMReaders.add(reader); headers.add(reader.getFileHeader()); diff --git a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/sam/CigarUtils.java b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/sam/CigarUtils.java index cd492fec9..06e0653f5 100644 --- a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/sam/CigarUtils.java +++ b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/sam/CigarUtils.java @@ -104,7 +104,7 @@ public class CigarUtils { } public static Cigar cigarFromString(String cigarString) { - return TextCigarCodec.getSingleton().decode(cigarString); + return TextCigarCodec.decode(cigarString); } /** diff --git a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/variant/GATKVCFConstants.java b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/variant/GATKVCFConstants.java new file mode 100644 index 000000000..1fe6aa208 --- /dev/null +++ b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/variant/GATKVCFConstants.java @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2012 The Broad Institute +* +* Permission is hereby granted, free of charge, to any person +* obtaining a copy of this software and associated documentation +* files (the "Software"), to deal in the Software without +* restriction, including without limitation the rights to use, +* copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following +* conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR +* THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +package org.broadinstitute.gatk.utils.variant; + +import htsjdk.variant.variantcontext.Allele; + +/** + * This class contains any constants (primarily FORMAT/INFO keys) in VCF files used by the GATK. + * Note that VCF-standard constants are in VCFConstants, in htsjdk. Keys in header lines should + * have matching entries in GATKVCFHeaderLines + */ +public final class GATKVCFConstants { + + //INFO keys + public static final String ALLELE_BALANCE_HET_KEY = "ABHet"; + public static final String ALLELE_BALANCE_HOM_KEY = "ABHom"; + public static final String ORIGINAL_AC_KEY = "AC_Orig"; //SelectVariants + public static final String BEAGLE_AC_COMP_KEY = "ACH"; //BeagleOutputToVCF + public static final String ORIGINAL_AF_KEY = "AF_Orig"; //SelectVariants + public static final String BEAGLE_AF_COMP_KEY = "AFH"; //BeagleOutputToVCF + public static final String ORIGINAL_AN_KEY = "AN_Orig"; //SelectVariants + public static final String BEAGLE_AN_COMP_KEY = "ANH"; //BeagleOutputToVCF + public static final String BASE_COUNTS_KEY = "BaseCounts"; + public static final String BASE_QUAL_RANK_SUM_KEY = "BaseQRankSum"; + public static final String GENOTYPE_AND_VALIDATE_STATUS_KEY = "callStatus"; + public static final String CLIPPING_RANK_SUM_KEY = "ClippingRankSum"; + public static final String CULPRIT_KEY = "culprit"; + public static final String SPANNING_DELETIONS_KEY = "Dels"; + public static final String DOWNSAMPLED_KEY = "DS"; + public static final String FISHER_STRAND_KEY = "FS"; + public static final String GC_CONTENT_KEY = "GC"; + public static final String GQ_MEAN_KEY = "GQ_MEAN"; + public static final String GQ_STDEV_KEY = "GQ_STDDEV"; + public static final String HAPLOTYPE_SCORE_KEY = "HaplotypeScore"; + public static final String HI_CONF_DENOVO_KEY = "hiConfDeNovo"; + public static final String HOMOPOLYMER_RUN_KEY = "HRun"; + public static final String HARDY_WEINBERG_KEY = "HW"; + public static final String AVG_INTERVAL_DP_KEY = "IDP"; //DiagnoseTargets + public static final String INTERVAL_GC_CONTENT_KEY = "IGC"; + public static final String INBREEDING_COEFFICIENT_KEY = "InbreedingCoeff"; + public static final String LIKELIHOOD_RANK_SUM_KEY = "LikelihoodRankSum"; + public static final String LO_CONF_DENOVO_KEY = "loConfDeNovo"; + public static final String LOW_MQ_KEY = "LowMQ"; + public static final String MLE_ALLELE_COUNT_KEY = "MLEAC"; + public static final String MLE_ALLELE_FREQUENCY_KEY = "MLEAF"; + public static final String MLE_PER_SAMPLE_ALLELE_COUNT_KEY = "MLPSAC"; + public static final String MLE_PER_SAMPLE_ALLELE_FRACTION_KEY = "MLPSAF"; + public static final String MAP_QUAL_RANK_SUM_KEY = "MQRankSum"; + public static final String MENDEL_VIOLATION_LR_KEY = "MVLR"; + public static final String NOCALL_CHROM_KEY = "NCC"; + public static final String NUMBER_OF_DISCOVERED_ALLELES_KEY = "NDA"; + public static final String NEGATIVE_LABEL_KEY = "NEGATIVE_TRAIN_SITE"; + public static final String NUM_GENOTYPES_CHANGED_KEY = "NumGenotypesChanged"; //BeagleOutputToVCF + public static final String NON_DIPLOID_RATIO_KEY = "OND"; + public static final String ORIGINAL_ALT_ALLELE_INFO_KEY = "OriginalAltAllele"; //BeagleOutputToVCF + public static final String ORIGINAL_CONTIG_KEY = "OriginalChr"; //LiftoverVariants + public static final String ORIGINAL_START_KEY = "OriginalStart"; //LiftoverVariants + public static final String N_BASE_COUNT_KEY = "PercentNBase"; + public static final String RBP_INCONSISTENT_KEY = "PhasingInconsistent"; //ReadBackedPhasing + public static final String GENOTYPE_PRIOR_KEY = "PG"; + public static final String POSITIVE_LABEL_KEY = "POSITIVE_TRAIN_SITE"; + public static final String QUAL_BY_DEPTH_KEY = "QD"; + public static final String BEAGLE_R2_KEY = "R2"; //BeagleOutputToVCF + public static final String READ_POS_RANK_SUM_KEY = "ReadPosRankSum"; + public static final String REFSAMPLE_DEPTH_KEY = "REFDEPTH"; + public static final String REPEATS_PER_ALLELE_KEY = "RPA"; + public static final String REPEAT_UNIT_KEY = "RU"; + public static final String SAMPLE_LIST_KEY = "Samples"; + public static final String STRAND_ODDS_RATIO_KEY = "SOR"; + public static final String STR_PRESENT_KEY = "STR"; + public static final String TRANSMISSION_DISEQUILIBRIUM_KEY = "TDT"; + public static final String VARIANT_TYPE_KEY = "VariantType"; + public static final String VQS_LOD_KEY = "VQSLOD"; + + //FORMAT keys + public static final String ALLELE_BALANCE_KEY = "AB"; + public static final String PL_FOR_ALL_SNP_ALLELES_KEY = "APL"; + public static final String RBP_HAPLOTYPE_KEY = "HP"; //ReadBackedPhasing + public static final String AVG_INTERVAL_DP_BY_SAMPLE_KEY = "IDP"; //DiagnoseTargets + public static final String JOINT_LIKELIHOOD_TAG_NAME = "JL"; //FamilyLikelihoodsUtils + public static final String JOINT_POSTERIOR_TAG_NAME = "JP"; //FamilyLikelihoodsUtils + public static final String LOW_COVERAGE_LOCI = "LL"; //DiagnoseTargets + public final static String MIN_DP_FORMAT_KEY = "MIN_DP"; + public static final String MAPPING_QUALITY_ZERO_BY_SAMPLE_KEY = "MQ0"; + public static final String ORIGINAL_GENOTYPE_KEY = "OG"; //BeagleOutputToVCF + public static final String HAPLOTYPE_CALLER_PHASING_GT_KEY = "PGT"; + public static final String HAPLOTYPE_CALLER_PHASING_ID_KEY = "PID"; + public static final String PHRED_SCALED_POSTERIORS_KEY = "PP"; //FamilyLikelihoodsUtils / PosteriorLikelihoodsUtils + public static final String STRAND_COUNT_BY_SAMPLE_KEY = "SAC"; + public static final String STRAND_BIAS_BY_SAMPLE_KEY = "SB"; + public final static String TRANSMISSION_PROBABILITY_KEY = "TP"; //PhaseByTransmission + public static final String ZERO_COVERAGE_LOCI = "ZL"; //DiagnoseTargets + + //FILTERS + /* Note that many filters used throughout GATK (most notably in VariantRecalibration) are dynamic, + their names (or descriptions) depend on some threshold. Those filters are not included here + */ + public static final String BEAGLE_MONO_FILTER_NAME = "BGL_SET_TO_MONOMORPHIC"; + public static final String LOW_QUAL_FILTER_NAME = "LowQual"; + + //Alleles + public final static String NON_REF_SYMBOLIC_ALLELE_NAME = "NON_REF"; + public final static Allele NON_REF_SYMBOLIC_ALLELE = Allele.create("<"+NON_REF_SYMBOLIC_ALLELE_NAME+">", false); // represents any possible non-ref allele at this site +} diff --git a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/variant/GATKVCFHeaderLines.java b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/variant/GATKVCFHeaderLines.java new file mode 100644 index 000000000..c4a63130b --- /dev/null +++ b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/variant/GATKVCFHeaderLines.java @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2012 The Broad Institute +* +* Permission is hereby granted, free of charge, to any person +* obtaining a copy of this software and associated documentation +* files (the "Software"), to deal in the Software without +* restriction, including without limitation the rights to use, +* copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following +* conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR +* THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +package org.broadinstitute.gatk.utils.variant; + +import htsjdk.variant.vcf.VCFFilterHeaderLine; +import htsjdk.variant.vcf.VCFFormatHeaderLine; +import htsjdk.variant.vcf.VCFHeaderLineCount; +import htsjdk.variant.vcf.VCFHeaderLineType; +import htsjdk.variant.vcf.VCFInfoHeaderLine; + +import static org.broadinstitute.gatk.utils.variant.GATKVCFConstants.*; + +import java.util.HashMap; +import java.util.Map; + +/** + * This class contains the VCFHeaderLine definitions for the annotation keys in GATKVCFConstants. + * VCF-standard header lines are in VCFStandardHeaderLines, in htsjdk + */ +public class GATKVCFHeaderLines { + + public static VCFInfoHeaderLine getInfoLine(final String id) { return infoLines.get(id); } + public static VCFFormatHeaderLine getFormatLine(final String id) { return formatLines.get(id); } + public static VCFFilterHeaderLine getFilterLine(final String id) { return filterLines.get(id); } + + private static Map infoLines = new HashMap<>(60); + private static Map formatLines = new HashMap<>(25); + private static Map filterLines = new HashMap<>(2); + + private static void addFormatLine(final VCFFormatHeaderLine line) { + formatLines.put(line.getID(), line); + } + + private static void addInfoLine(final VCFInfoHeaderLine line) { + infoLines.put(line.getID(), line); + } + + private static void addFilterLine(final VCFFilterHeaderLine line) { + filterLines.put(line.getID(), line); + } + + static { + addFilterLine(new VCFFilterHeaderLine(LOW_QUAL_FILTER_NAME, "Low quality")); + addFilterLine(new VCFFilterHeaderLine(BEAGLE_MONO_FILTER_NAME, "This site was set to monomorphic by Beagle")); + + addFormatLine(new VCFFormatHeaderLine(ALLELE_BALANCE_KEY, 1, VCFHeaderLineType.Float, "Allele balance for each het genotype")); + addFormatLine(new VCFFormatHeaderLine(MAPPING_QUALITY_ZERO_BY_SAMPLE_KEY, 1, VCFHeaderLineType.Integer, "Number of Mapping Quality Zero Reads per sample")); + addFormatLine(new VCFFormatHeaderLine(MLE_PER_SAMPLE_ALLELE_COUNT_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Integer, "Maximum likelihood expectation (MLE) for the alternate allele count, in the same order as listed, for each individual sample")); + addFormatLine(new VCFFormatHeaderLine(MLE_PER_SAMPLE_ALLELE_FRACTION_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Maximum likelihood expectation (MLE) for the alternate allele fraction, in the same order as listed, for each individual sample")); + addFormatLine(new VCFFormatHeaderLine(STRAND_COUNT_BY_SAMPLE_KEY, VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.Integer, "Number of reads on the forward and reverse strand supporting each allele (including reference)")); + addFormatLine(new VCFFormatHeaderLine(STRAND_BIAS_BY_SAMPLE_KEY, 4, VCFHeaderLineType.Integer, "Per-sample component statistics which comprise the Fisher's Exact Test to detect strand bias.")); + addFormatLine(new VCFFormatHeaderLine(MLE_PER_SAMPLE_ALLELE_COUNT_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Integer, "Maximum likelihood expectation (MLE) for the alternate allele count, in the same order as listed, for each individual sample")); + addFormatLine(new VCFFormatHeaderLine(MLE_PER_SAMPLE_ALLELE_FRACTION_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Maximum likelihood expectation (MLE) for the alternate allele fraction, in the same order as listed, for each individual sample")); + addFormatLine(new VCFFormatHeaderLine(PL_FOR_ALL_SNP_ALLELES_KEY, 10, VCFHeaderLineType.Integer, "Phred-scaled genotype likelihoods for all 4 possible bases regardless of whether there is statistical evidence for them. Ordering is always PL for AA AC CC GA GC GG TA TC TG TT.")); + addFormatLine(new VCFFormatHeaderLine(HAPLOTYPE_CALLER_PHASING_ID_KEY, 1, VCFHeaderLineType.String, "Physical phasing ID information, where each unique ID within a given sample (but not across samples) connects records within a phasing group")); + addFormatLine(new VCFFormatHeaderLine(HAPLOTYPE_CALLER_PHASING_GT_KEY, 1, VCFHeaderLineType.String, "Physical phasing haplotype information, describing how the alternate alleles are phased in relation to one another")); + addFormatLine(new VCFFormatHeaderLine(MIN_DP_FORMAT_KEY, 1, VCFHeaderLineType.Integer, "Minimum DP observed within the GVCF block")); + addFormatLine(new VCFFormatHeaderLine(TRANSMISSION_PROBABILITY_KEY, 1, VCFHeaderLineType.Integer, "Phred score of the genotype combination and phase given that the genotypes are correct")); + addFormatLine(new VCFFormatHeaderLine(RBP_HAPLOTYPE_KEY, VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.String, "Read-backed phasing haplotype identifiers")); + addFormatLine(new VCFFormatHeaderLine(AVG_INTERVAL_DP_BY_SAMPLE_KEY, 1, VCFHeaderLineType.Float, "Average sample depth across the interval. Sum of the sample specific depth in all loci divided by interval size.")); + addFormatLine(new VCFFormatHeaderLine(LOW_COVERAGE_LOCI, 1, VCFHeaderLineType.Integer, "Number of loci for this sample, in this interval with low coverage (below the minimum coverage) but not zero.")); + addFormatLine(new VCFFormatHeaderLine(ZERO_COVERAGE_LOCI, 1, VCFHeaderLineType.Integer, "Number of loci for this sample, in this interval with zero coverage.")); + addFormatLine(new VCFFormatHeaderLine(PHRED_SCALED_POSTERIORS_KEY, VCFHeaderLineCount.G, VCFHeaderLineType.Integer, "Phred-scaled Posterior Genotype Probabilities")); + addFormatLine(new VCFFormatHeaderLine(JOINT_LIKELIHOOD_TAG_NAME, 1, VCFHeaderLineType.Integer, "Phred-scaled joint likelihood of the genotype combination (before applying family priors)")); + addFormatLine(new VCFFormatHeaderLine(JOINT_POSTERIOR_TAG_NAME, 1, VCFHeaderLineType.Integer, "Phred-scaled joint posterior probability of the genotype combination (after applying family priors)")); + addFormatLine(new VCFFormatHeaderLine(ORIGINAL_GENOTYPE_KEY, 1, VCFHeaderLineType.String, "Original Genotype input to Beagle")); + + addInfoLine(new VCFInfoHeaderLine(MLE_ALLELE_COUNT_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Integer, "Maximum likelihood expectation (MLE) for the allele counts (not necessarily the same as the AC), for each ALT allele, in the same order as listed")); + addInfoLine(new VCFInfoHeaderLine(MLE_ALLELE_FREQUENCY_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Maximum likelihood expectation (MLE) for the allele frequency (not necessarily the same as the AF), for each ALT allele, in the same order as listed")); + addInfoLine(new VCFInfoHeaderLine(DOWNSAMPLED_KEY, 0, VCFHeaderLineType.Flag, "Were any of the samples downsampled?")); + addInfoLine(new VCFInfoHeaderLine(ALLELE_BALANCE_HET_KEY, 1, VCFHeaderLineType.Float, "Allele Balance for heterozygous calls (ref/(ref+alt))")); + addInfoLine(new VCFInfoHeaderLine(ALLELE_BALANCE_HOM_KEY, 1, VCFHeaderLineType.Float, "Allele Balance for homozygous calls (A/(A+O)) where A is the allele (ref or alt) and O is anything other")); + addInfoLine(new VCFInfoHeaderLine(NON_DIPLOID_RATIO_KEY, 1, VCFHeaderLineType.Float, "Overall non-diploid ratio (alleles/(alleles+non-alleles))")); + addInfoLine(new VCFInfoHeaderLine(BASE_COUNTS_KEY, 4, VCFHeaderLineType.Integer, "Counts of each base")); + addInfoLine(new VCFInfoHeaderLine(LOW_MQ_KEY, 3, VCFHeaderLineType.Float, "3-tuple: ,,")); + addInfoLine(new VCFInfoHeaderLine(N_BASE_COUNT_KEY, 1, VCFHeaderLineType.Float, "Percentage of N bases in the pileup")); + addInfoLine(new VCFInfoHeaderLine(BASE_QUAL_RANK_SUM_KEY, 1, VCFHeaderLineType.Float, "Z-score from Wilcoxon rank sum test of Alt Vs. Ref base qualities")); + addInfoLine(new VCFInfoHeaderLine(CLIPPING_RANK_SUM_KEY, 1, VCFHeaderLineType.Float, "Z-score From Wilcoxon rank sum test of Alt vs. Ref number of hard clipped bases")); + addInfoLine(new VCFInfoHeaderLine(FISHER_STRAND_KEY, 1, VCFHeaderLineType.Float, "Phred-scaled p-value using Fisher's exact test to detect strand bias")); + addInfoLine(new VCFInfoHeaderLine(GC_CONTENT_KEY, 1, VCFHeaderLineType.Integer, "GC content around the variant (see docs for window size details)")); + addInfoLine(new VCFInfoHeaderLine(NOCALL_CHROM_KEY, 1, VCFHeaderLineType.Integer, "Number of no-called samples")); + addInfoLine(new VCFInfoHeaderLine(GQ_MEAN_KEY, 1, VCFHeaderLineType.Float, "Mean of all GQ values")); + addInfoLine(new VCFInfoHeaderLine(GQ_STDEV_KEY, 1, VCFHeaderLineType.Float, "Standard deviation of all GQ values")); + addInfoLine(new VCFInfoHeaderLine(HAPLOTYPE_SCORE_KEY, 1, VCFHeaderLineType.Float, "Consistency of the site with at most two segregating haplotypes")); + addInfoLine(new VCFInfoHeaderLine(HARDY_WEINBERG_KEY, 1, VCFHeaderLineType.Float, "Phred-scaled p-value for Hardy-Weinberg violation")); + addInfoLine(new VCFInfoHeaderLine(HOMOPOLYMER_RUN_KEY, 1, VCFHeaderLineType.Integer, "Largest Contiguous Homopolymer Run of Variant Allele In Either Direction")); + addInfoLine(new VCFInfoHeaderLine(INBREEDING_COEFFICIENT_KEY, 1, VCFHeaderLineType.Float, "Inbreeding coefficient as estimated from the genotype likelihoods per-sample when compared against the Hardy-Weinberg expectation")); + addInfoLine(new VCFInfoHeaderLine(LIKELIHOOD_RANK_SUM_KEY, 1, VCFHeaderLineType.Float, "Z-score from Wilcoxon rank sum test of Alt Vs. Ref haplotype likelihoods")); + addInfoLine(new VCFInfoHeaderLine(MAP_QUAL_RANK_SUM_KEY, 1, VCFHeaderLineType.Float, "Z-score From Wilcoxon rank sum test of Alt vs. Ref read mapping qualities")); + addInfoLine(new VCFInfoHeaderLine(MENDEL_VIOLATION_LR_KEY, 1, VCFHeaderLineType.Float, "Mendelian violation likelihood ratio: L[MV] - L[No MV]")); + addInfoLine(new VCFInfoHeaderLine(HI_CONF_DENOVO_KEY, 1, VCFHeaderLineType.String, "High confidence possible de novo mutation (GQ >= 20 for all trio members)=[comma-delimited list of child samples]")); + addInfoLine(new VCFInfoHeaderLine(LO_CONF_DENOVO_KEY, 1, VCFHeaderLineType.String, "Low confidence possible de novo mutation (GQ >= 10 for child, GQ > 0 for parents)=[comma-delimited list of child samples]")); + addInfoLine(new VCFInfoHeaderLine(QUAL_BY_DEPTH_KEY, 1, VCFHeaderLineType.Float, "Variant Confidence/Quality by Depth")); + addInfoLine(new VCFInfoHeaderLine(READ_POS_RANK_SUM_KEY, 1, VCFHeaderLineType.Float, "Z-score from Wilcoxon rank sum test of Alt vs. Ref read position bias")); + addInfoLine(new VCFInfoHeaderLine(SAMPLE_LIST_KEY, VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.String, "List of polymorphic samples")); + addInfoLine(new VCFInfoHeaderLine(SPANNING_DELETIONS_KEY, 1, VCFHeaderLineType.Float, "Fraction of Reads Containing Spanning Deletions")); + addInfoLine(new VCFInfoHeaderLine(STRAND_ODDS_RATIO_KEY, 1, VCFHeaderLineType.Float, "Symmetric Odds Ratio of 2x2 contingency table to detect strand bias")); + addInfoLine(new VCFInfoHeaderLine(STR_PRESENT_KEY, 0, VCFHeaderLineType.Flag, "Variant is a short tandem repeat")); + addInfoLine(new VCFInfoHeaderLine(REPEAT_UNIT_KEY, 1, VCFHeaderLineType.String, "Tandem repeat unit (bases)")); + addInfoLine(new VCFInfoHeaderLine(REPEATS_PER_ALLELE_KEY, VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.Integer, "Number of times tandem repeat unit is repeated, for each allele (including reference)")); + addInfoLine(new VCFInfoHeaderLine(TRANSMISSION_DISEQUILIBRIUM_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Test statistic from Wittkowski transmission disequilibrium test.")); + addInfoLine(new VCFInfoHeaderLine(VARIANT_TYPE_KEY, 1, VCFHeaderLineType.String, "Variant type description")); + addInfoLine(new VCFInfoHeaderLine(NUMBER_OF_DISCOVERED_ALLELES_KEY, 1, VCFHeaderLineType.Integer, "Number of alternate alleles discovered (but not necessarily genotyped) at this site")); + addInfoLine(new VCFInfoHeaderLine(REFSAMPLE_DEPTH_KEY, 1, VCFHeaderLineType.Integer, "Total reference sample depth")); + addInfoLine(new VCFInfoHeaderLine(ORIGINAL_AC_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Integer, "Original AC")); + addInfoLine(new VCFInfoHeaderLine(ORIGINAL_AF_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Original AF")); + addInfoLine(new VCFInfoHeaderLine(ORIGINAL_AN_KEY, 1, VCFHeaderLineType.Integer, "Original AN")); + addInfoLine(new VCFInfoHeaderLine(ORIGINAL_CONTIG_KEY, 1, VCFHeaderLineType.String, "Original contig name for the record")); + addInfoLine(new VCFInfoHeaderLine(ORIGINAL_START_KEY, 1, VCFHeaderLineType.Integer, "Original start position for the record")); + addInfoLine(new VCFInfoHeaderLine(VQS_LOD_KEY, 1, VCFHeaderLineType.Float, "Log odds ratio of being a true variant versus being false under the trained gaussian mixture model")); + addInfoLine(new VCFInfoHeaderLine(CULPRIT_KEY, 1, VCFHeaderLineType.String, "The annotation which was the worst performing in the Gaussian mixture model, likely the reason why the variant was filtered out")); + addInfoLine(new VCFInfoHeaderLine(POSITIVE_LABEL_KEY, 1, VCFHeaderLineType.Flag, "This variant was used to build the positive training set of good variants")); + addInfoLine(new VCFInfoHeaderLine(NEGATIVE_LABEL_KEY, 1, VCFHeaderLineType.Flag, "This variant was used to build the negative training set of bad variants")); + addInfoLine(new VCFInfoHeaderLine(RBP_INCONSISTENT_KEY, 0, VCFHeaderLineType.Flag, "Are the reads significantly haplotype-inconsistent?")); + addInfoLine(new VCFInfoHeaderLine(GENOTYPE_AND_VALIDATE_STATUS_KEY, 1, VCFHeaderLineType.String, "Value from the validation VCF")); + addInfoLine(new VCFInfoHeaderLine(AVG_INTERVAL_DP_KEY, 1, VCFHeaderLineType.Float, "Average depth across the interval. Sum of the depth in a loci divided by interval size.")); + addInfoLine(new VCFInfoHeaderLine(INTERVAL_GC_CONTENT_KEY, 1, VCFHeaderLineType.Float, "GC Content of the interval")); + addInfoLine(new VCFInfoHeaderLine(GENOTYPE_PRIOR_KEY, VCFHeaderLineCount.G, VCFHeaderLineType.Integer, "Genotype Likelihood Prior")); + addInfoLine(new VCFInfoHeaderLine(BEAGLE_R2_KEY, 1, VCFHeaderLineType.Float, "r2 Value reported by Beagle on each site")); + addInfoLine(new VCFInfoHeaderLine(NUM_GENOTYPES_CHANGED_KEY, 1, VCFHeaderLineType.Integer, "The number of genotypes changed by Beagle")); + addInfoLine(new VCFInfoHeaderLine(ORIGINAL_ALT_ALLELE_INFO_KEY, 1, VCFHeaderLineType.String, "The original alt allele for a site set to monomorphic by Beagle")); + addInfoLine(new VCFInfoHeaderLine(BEAGLE_AC_COMP_KEY, 1, VCFHeaderLineType.Integer, "Allele Count from Comparison ROD at this site")); + addInfoLine(new VCFInfoHeaderLine(BEAGLE_AF_COMP_KEY, 1, VCFHeaderLineType.Integer, "Allele Frequency from Comparison ROD at this site")); + addInfoLine(new VCFInfoHeaderLine(BEAGLE_AN_COMP_KEY, 1, VCFHeaderLineType.Float, "Allele Number from Comparison ROD at this site")); + } +} diff --git a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/variant/GATKVariantContextUtils.java b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/variant/GATKVariantContextUtils.java index 88f689b2d..8f3e5c450 100644 --- a/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/variant/GATKVariantContextUtils.java +++ b/public/gatk-utils/src/main/java/org/broadinstitute/gatk/utils/variant/GATKVariantContextUtils.java @@ -55,9 +55,6 @@ public class GATKVariantContextUtils { @Deprecated public final static List NO_CALL_ALLELES = Arrays.asList(Allele.NO_CALL, Allele.NO_CALL); - public final static String NON_REF_SYMBOLIC_ALLELE_NAME = "NON_REF"; - public final static Allele NON_REF_SYMBOLIC_ALLELE = Allele.create("<"+NON_REF_SYMBOLIC_ALLELE_NAME+">", false); // represents any possible non-ref allele at this site - public final static String MERGE_FILTER_PREFIX = "filterIn"; public final static String MERGE_REF_IN_ALL = "ReferenceInAll"; public final static String MERGE_FILTER_IN_ALL = "FilteredInAll"; diff --git a/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/fragments/FragmentUtilsUnitTest.java b/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/fragments/FragmentUtilsUnitTest.java index f9f9ba441..4984d0a71 100644 --- a/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/fragments/FragmentUtilsUnitTest.java +++ b/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/fragments/FragmentUtilsUnitTest.java @@ -336,7 +336,7 @@ public class FragmentUtilsUnitTest extends BaseTest { final int readLen = pre + contigLen + post; final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, "read1", 0, 1, readLen); read.setAlignmentStart(1); - read.setCigar(TextCigarCodec.getSingleton().decode(pre + "S" + contigLen + "M" + post + "S")); + read.setCigar(TextCigarCodec.decode(pre + "S" + contigLen + "M" + post + "S")); read.setBaseQualities(Utils.dupBytes((byte) 30, readLen)); read.setReadBases(Utils.dupBytes((byte)'A', readLen)); read.setMappingQuality(60); diff --git a/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/haplotype/EventMapUnitTest.java b/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/haplotype/EventMapUnitTest.java index 6baf6ef4d..c4ff9b587 100644 --- a/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/haplotype/EventMapUnitTest.java +++ b/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/haplotype/EventMapUnitTest.java @@ -127,7 +127,7 @@ public class EventMapUnitTest extends BaseTest { */ @Test(dataProvider = "BlockSubstitutionsData") public void testBlockSubstitutionsData(final String refBases, final String haplotypeBases, final String cigar, final VariantContext expectedBlock) { - final Haplotype hap = new Haplotype(haplotypeBases.getBytes(), false, 0, TextCigarCodec.getSingleton().decode(cigar)); + final Haplotype hap = new Haplotype(haplotypeBases.getBytes(), false, 0, TextCigarCodec.decode(cigar)); final GenomeLoc loc = new UnvalidatingGenomeLoc(CHR, 0, 1, refBases.length()); final EventMap ee = new EventMap(hap, refBases.getBytes(), loc, NAME); ee.replaceClumpedEventsWithBlockSubstitutions(); @@ -156,7 +156,7 @@ public class EventMapUnitTest extends BaseTest { */ @Test(dataProvider = "AdjacentSNPIndelTest") public void testAdjacentSNPIndelTest(final String refBases, final String haplotypeBases, final String cigar, final List> expectedAlleles) { - final Haplotype hap = new Haplotype(haplotypeBases.getBytes(), false, 0, TextCigarCodec.getSingleton().decode(cigar)); + final Haplotype hap = new Haplotype(haplotypeBases.getBytes(), false, 0, TextCigarCodec.decode(cigar)); final GenomeLoc loc = new UnvalidatingGenomeLoc(CHR, 0, 1, refBases.length()); final EventMap ee = new EventMap(hap, refBases.getBytes(), loc, NAME); ee.replaceClumpedEventsWithBlockSubstitutions(); diff --git a/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/haplotype/HaplotypeUnitTest.java b/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/haplotype/HaplotypeUnitTest.java index b0087dc05..e71413d12 100644 --- a/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/haplotype/HaplotypeUnitTest.java +++ b/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/haplotype/HaplotypeUnitTest.java @@ -167,7 +167,7 @@ public class HaplotypeUnitTest extends BaseTest { private Haplotype makeHCForCigar(final String bases, final String cigar) { final Haplotype h = new Haplotype(bases.getBytes()); - h.setCigar(TextCigarCodec.getSingleton().decode(cigar)); + h.setCigar(TextCigarCodec.decode(cigar)); return h; } @@ -201,10 +201,10 @@ public class HaplotypeUnitTest extends BaseTest { final int hapStart = 10; full.setAlignmentStartHapwrtRef(hapStart); - full.setCigar(TextCigarCodec.getSingleton().decode(full.length() + "M")); + full.setCigar(TextCigarCodec.decode(full.length() + "M")); trimmed.setAlignmentStartHapwrtRef(hapStart + start); - trimmed.setCigar(TextCigarCodec.getSingleton().decode(trimmed.length() + "M")); + trimmed.setCigar(TextCigarCodec.decode(trimmed.length() + "M")); tests.add(new Object[]{full, trimmedLoc, trimmed}); } @@ -212,7 +212,7 @@ public class HaplotypeUnitTest extends BaseTest { final Haplotype full = new Haplotype("ACT".getBytes(), new UnvalidatingGenomeLoc("20", 0, 10, 14)); full.setAlignmentStartHapwrtRef(10); - full.setCigar(TextCigarCodec.getSingleton().decode("1M2D2M")); + full.setCigar(TextCigarCodec.decode("1M2D2M")); tests.add(new Object[]{full, new UnvalidatingGenomeLoc("20", 0, 11, 12), null}); tests.add(new Object[]{full, new UnvalidatingGenomeLoc("20", 0, 10, 12), null}); tests.add(new Object[]{full, new UnvalidatingGenomeLoc("20", 0, 11, 13), null}); diff --git a/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/locusiterator/LocusIteratorByStateBaseTest.java b/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/locusiterator/LocusIteratorByStateBaseTest.java index 073d69cde..8f5d8f7b2 100644 --- a/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/locusiterator/LocusIteratorByStateBaseTest.java +++ b/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/locusiterator/LocusIteratorByStateBaseTest.java @@ -98,7 +98,7 @@ public class LocusIteratorByStateBaseTest extends BaseTest { final private List elements; public LIBSTest(final String cigarString) { - final Cigar cigar = TextCigarCodec.getSingleton().decode(cigarString); + final Cigar cigar = TextCigarCodec.decode(cigarString); this.cigarString = cigarString; this.elements = cigar.getCigarElements(); this.readLength = cigar.getReadLength(); diff --git a/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/sam/AlignmentUtilsUnitTest.java b/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/sam/AlignmentUtilsUnitTest.java index 3334efddc..d0d6eb442 100644 --- a/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/sam/AlignmentUtilsUnitTest.java +++ b/public/gatk-utils/src/test/java/org/broadinstitute/gatk/utils/sam/AlignmentUtilsUnitTest.java @@ -168,7 +168,7 @@ public class AlignmentUtilsUnitTest { @Test(enabled = true, dataProvider = "CalcNumDifferentBasesData") public void testCalcNumDifferentBases(final String cigarString, final String ref, final String read, final int expectedDifferences) { - final Cigar cigar = TextCigarCodec.getSingleton().decode(cigarString); + final Cigar cigar = TextCigarCodec.decode(cigarString); Assert.assertEquals(AlignmentUtils.calcNumDifferentBases(cigar, ref.getBytes(), read.getBytes()), expectedDifferences); } @@ -299,8 +299,8 @@ public class AlignmentUtilsUnitTest { @Test(enabled = !DEBUG, dataProvider = "ConsolidateCigarData") public void testConsolidateCigarWithData(final String testCigarString, final String expectedCigarString) { - final Cigar testCigar = TextCigarCodec.getSingleton().decode(testCigarString); - final Cigar expectedCigar = TextCigarCodec.getSingleton().decode(expectedCigarString); + final Cigar testCigar = TextCigarCodec.decode(testCigarString); + final Cigar expectedCigar = TextCigarCodec.decode(expectedCigarString); final Cigar actualCigar = AlignmentUtils.consolidateCigar(testCigar); Assert.assertEquals(actualCigar, expectedCigar); } @@ -766,8 +766,8 @@ public class AlignmentUtilsUnitTest { @Test(dataProvider = "TrimCigarData", enabled = ! DEBUG) public void testTrimCigar(final String cigarString, final int start, final int length, final String expectedCigarString) { - final Cigar cigar = TextCigarCodec.getSingleton().decode(cigarString); - final Cigar expectedCigar = TextCigarCodec.getSingleton().decode(expectedCigarString); + final Cigar cigar = TextCigarCodec.decode(cigarString); + final Cigar expectedCigar = TextCigarCodec.decode(expectedCigarString); final Cigar actualCigar = AlignmentUtils.trimCigarByReference(cigar, start, length); Assert.assertEquals(actualCigar, expectedCigar); } @@ -801,8 +801,8 @@ public class AlignmentUtilsUnitTest { @Test(dataProvider = "TrimCigarByBasesData", enabled = !DEBUG) public void testTrimCigarByBase(final String cigarString, final int start, final int length, final String expectedCigarString) { - final Cigar cigar = TextCigarCodec.getSingleton().decode(cigarString); - final Cigar expectedCigar = TextCigarCodec.getSingleton().decode(expectedCigarString); + final Cigar cigar = TextCigarCodec.decode(cigarString); + final Cigar expectedCigar = TextCigarCodec.decode(expectedCigarString); final Cigar actualCigar = AlignmentUtils.trimCigarByBases(cigar, start, length); Assert.assertEquals(actualCigar, expectedCigar); } @@ -853,9 +853,9 @@ public class AlignmentUtilsUnitTest { @Test(dataProvider = "ApplyCigarToCigarData", enabled = !DEBUG) public void testApplyCigarToCigar(final String firstToSecondString, final String secondToThirdString, final String expectedCigarString) { - final Cigar firstToSecond = TextCigarCodec.getSingleton().decode(firstToSecondString); - final Cigar secondToThird = TextCigarCodec.getSingleton().decode(secondToThirdString); - final Cigar expectedCigar = TextCigarCodec.getSingleton().decode(expectedCigarString); + final Cigar firstToSecond = TextCigarCodec.decode(firstToSecondString); + final Cigar secondToThird = TextCigarCodec.decode(secondToThirdString); + final Cigar expectedCigar = TextCigarCodec.decode(expectedCigarString); final Cigar actualCigar = AlignmentUtils.applyCigarToCigar(firstToSecond, secondToThird); Assert.assertEquals(actualCigar, expectedCigar); } @@ -909,7 +909,7 @@ public class AlignmentUtilsUnitTest { @Test(dataProvider = "ReadOffsetFromCigarData", enabled = !DEBUG) public void testReadOffsetFromCigar(final String cigarString, final int startOnCigar, final int expectedOffset) { - final Cigar cigar = TextCigarCodec.getSingleton().decode(cigarString); + final Cigar cigar = TextCigarCodec.decode(cigarString); final int actualOffset = AlignmentUtils.calcFirstBaseMatchingReferenceInCigar(cigar, startOnCigar); Assert.assertEquals(actualOffset, expectedOffset); } @@ -940,9 +940,9 @@ public class AlignmentUtilsUnitTest { @Test(dataProvider = "AddCigarElementsData", enabled = !DEBUG) public void testAddCigarElements(final String cigarString, final int pos, final int start, final int end, final String expectedCigarString) { - final Cigar cigar = TextCigarCodec.getSingleton().decode(cigarString); + final Cigar cigar = TextCigarCodec.decode(cigarString); final CigarElement elt = cigar.getCigarElement(0); - final Cigar expectedCigar = TextCigarCodec.getSingleton().decode(expectedCigarString); + final Cigar expectedCigar = TextCigarCodec.decode(expectedCigarString); final List elts = new LinkedList(); final int actualEndPos = AlignmentUtils.addCigarElements(elts, pos, start, end, elt); @@ -1000,7 +1000,7 @@ public class AlignmentUtilsUnitTest { @Test(dataProvider = "GetBasesCoveringRefIntervalData", enabled = true) public void testGetBasesCoveringRefInterval(final String basesString, final int refStart, final int refEnd, final String cigarString, final String expected) { - final byte[] actualBytes = AlignmentUtils.getBasesCoveringRefInterval(refStart, refEnd, basesString.getBytes(), 0, TextCigarCodec.getSingleton().decode(cigarString)); + final byte[] actualBytes = AlignmentUtils.getBasesCoveringRefInterval(refStart, refEnd, basesString.getBytes(), 0, TextCigarCodec.decode(cigarString)); if ( expected == null ) Assert.assertNull(actualBytes); else @@ -1031,13 +1031,13 @@ public class AlignmentUtilsUnitTest { @Test(dataProvider = "StartsOrEndsWithInsertionOrDeletionData", enabled = true) public void testStartsOrEndsWithInsertionOrDeletion(final String cigar, final boolean expected) { - Assert.assertEquals(AlignmentUtils.startsOrEndsWithInsertionOrDeletion(TextCigarCodec.getSingleton().decode(cigar)), expected); + Assert.assertEquals(AlignmentUtils.startsOrEndsWithInsertionOrDeletion(TextCigarCodec.decode(cigar)), expected); } @Test(dataProvider = "StartsOrEndsWithInsertionOrDeletionData", enabled = true) public void testRemoveTrailingDeletions(final String cigar, final boolean expected) { - final Cigar originalCigar = TextCigarCodec.getSingleton().decode(cigar); + final Cigar originalCigar = TextCigarCodec.decode(cigar); final Cigar newCigar = AlignmentUtils.removeTrailingDeletions(originalCigar); Assert.assertEquals(originalCigar.equals(newCigar), !cigar.endsWith("D")); diff --git a/public/repo/picard/picard/1.123.1620/picard-1.123.1620.jar b/public/repo/picard/picard/1.127.1667/picard-1.127.1667.jar similarity index 75% rename from public/repo/picard/picard/1.123.1620/picard-1.123.1620.jar rename to public/repo/picard/picard/1.127.1667/picard-1.127.1667.jar index 2431ab8bb..fa648c370 100644 Binary files a/public/repo/picard/picard/1.123.1620/picard-1.123.1620.jar and b/public/repo/picard/picard/1.127.1667/picard-1.127.1667.jar differ diff --git a/public/repo/picard/picard/1.123.1620/picard-1.123.1620.pom b/public/repo/picard/picard/1.127.1667/picard-1.127.1667.pom similarity index 94% rename from public/repo/picard/picard/1.123.1620/picard-1.123.1620.pom rename to public/repo/picard/picard/1.127.1667/picard-1.127.1667.pom index 7645771a0..f80df2b2f 100644 --- a/public/repo/picard/picard/1.123.1620/picard-1.123.1620.pom +++ b/public/repo/picard/picard/1.127.1667/picard-1.127.1667.pom @@ -3,13 +3,13 @@ 4.0.0 picard picard - 1.123.1620 + 1.127.1667 picard samtools htsjdk - 1.123.1658 + 1.127.1690 diff --git a/public/repo/samtools/htsjdk/1.123.1658/htsjdk-1.123.1658.jar b/public/repo/samtools/htsjdk/1.127.1690/htsjdk-1.127.1690.jar similarity index 64% rename from public/repo/samtools/htsjdk/1.123.1658/htsjdk-1.123.1658.jar rename to public/repo/samtools/htsjdk/1.127.1690/htsjdk-1.127.1690.jar index 20803d294..720c49d33 100644 Binary files a/public/repo/samtools/htsjdk/1.123.1658/htsjdk-1.123.1658.jar and b/public/repo/samtools/htsjdk/1.127.1690/htsjdk-1.127.1690.jar differ diff --git a/public/repo/samtools/htsjdk/1.123.1658/htsjdk-1.123.1658.pom b/public/repo/samtools/htsjdk/1.127.1690/htsjdk-1.127.1690.pom similarity index 96% rename from public/repo/samtools/htsjdk/1.123.1658/htsjdk-1.123.1658.pom rename to public/repo/samtools/htsjdk/1.127.1690/htsjdk-1.127.1690.pom index 858b68cd1..d610ded0d 100644 --- a/public/repo/samtools/htsjdk/1.123.1658/htsjdk-1.123.1658.pom +++ b/public/repo/samtools/htsjdk/1.127.1690/htsjdk-1.127.1690.pom @@ -3,7 +3,7 @@ 4.0.0 samtools htsjdk - 1.123.1658 + 1.127.1690 htsjdk