diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java b/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java index 0cb24c573..f59c6e197 100755 --- a/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java @@ -383,6 +383,8 @@ public class VariantContextAdaptors { result = VCFGenotypeRecord.getMissingFieldValue(key); else if ( val instanceof Double ) result = String.format("%.2f", (Double)val); + else if ( val instanceof Boolean ) + result = (Boolean)val ? "" : null; // empty string for true, null for false else if ( val instanceof List ) { List list = (List)val; if ( list.size() == 0 ) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java index 27ef48744..f008ba642 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java @@ -73,6 +73,9 @@ public class VariantAnnotator extends RodWalker { @Argument(fullName="list", shortName="ls", doc="List the available annotations and exit") protected Boolean LIST = false; + @Argument(fullName = "assume_single_sample_reads", shortName = "single_sample", doc = "The single sample that we should assume is represented in the input bam (and therefore associate with all reads regardless of whether they have read groups)", required = false) + protected String ASSUME_SINGLE_SAMPLE = null; + @Argument(fullName="vcfContainsOnlyIndels", shortName="dels",doc="Use if you are annotating an indel vcf, currently VERY experimental", required = false) protected boolean indelsOnly = false; @@ -196,9 +199,9 @@ public class VariantAnnotator extends RodWalker { Map stratifiedContexts; if ( BaseUtils.simpleBaseToBaseIndex(ref.getBase()) != -1 ) { if ( ! context.hasExtendedEventPileup() ) { - stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(context.getBasePileup()); + stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(context.getBasePileup(), ASSUME_SINGLE_SAMPLE, null); } else { - stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(context.getExtendedEventPileup()); + stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(context.getExtendedEventPileup(), ASSUME_SINGLE_SAMPLE, null); } if ( stratifiedContexts != null ) { annotatedVCs = engine.annotateContext(tracker, ref, stratifiedContexts, vc); @@ -206,7 +209,6 @@ public class VariantAnnotator extends RodWalker { } if ( ! indelsOnly ) { - if ( variant instanceof VCFRecord ) { for(VariantContext annotatedVC : annotatedVCs ) { vcfWriter.addRecord(VariantContextAdaptors.toVCF(annotatedVC, ref.getBase())); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorEngine.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorEngine.java index 561a56c85..af0eb03f4 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorEngine.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorEngine.java @@ -186,11 +186,11 @@ public class VariantAnnotatorEngine { for ( GenotypeAnnotation annotation : requestedGenotypeAnnotations ) descriptions.addAll(annotation.getDescriptions()); if ( annotateDbsnp ) - descriptions.add(new VCFInfoHeaderLine(VCFRecord.DBSNP_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "dbSNP Membership")); + descriptions.add(new VCFInfoHeaderLine(VCFRecord.DBSNP_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Flag, "dbSNP Membership")); if ( annotateHapmap2 ) - descriptions.add(new VCFInfoHeaderLine(VCFRecord.HAPMAP2_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Hapmap 2 Membership")); + descriptions.add(new VCFInfoHeaderLine(VCFRecord.HAPMAP2_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Flag, "Hapmap 2 Membership")); if ( annotateHapmap3 ) - descriptions.add(new VCFInfoHeaderLine(VCFRecord.HAPMAP3_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Hapmap 3 Membership")); + descriptions.add(new VCFInfoHeaderLine(VCFRecord.HAPMAP3_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Flag, "Hapmap 3 Membership")); return descriptions; } @@ -202,7 +202,7 @@ public class VariantAnnotatorEngine { // annotate dbsnp occurrence if ( annotateDbsnp ) { DbSNPFeature dbsnp = DbSNPHelper.getFirstRealSNP(tracker.getReferenceMetaData(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME)); - infoAnnotations.put(VCFRecord.DBSNP_KEY, dbsnp == null ? "0" : "1"); + infoAnnotations.put(VCFRecord.DBSNP_KEY, dbsnp == null ? false : true); // annotate dbsnp id if available and not already there if ( dbsnp != null && (!vc.hasAttribute("ID") || vc.getAttribute("ID").equals(VCFRecord.EMPTY_ID_FIELD)) ) infoAnnotations.put("ID", dbsnp.getRsID()); @@ -210,12 +210,12 @@ public class VariantAnnotatorEngine { if ( annotateHapmap2 ) { List hapmap2 = tracker.getReferenceMetaData("hapmap2"); - infoAnnotations.put(VCFRecord.HAPMAP2_KEY, hapmap2.size() == 0 ? "0" : "1"); + infoAnnotations.put(VCFRecord.HAPMAP2_KEY, hapmap2.size() == 0 ? false : true); } if ( annotateHapmap3 ) { List hapmap3 = tracker.getReferenceMetaData("hapmap3"); - infoAnnotations.put(VCFRecord.HAPMAP3_KEY, hapmap3.size() == 0 ? "0" : "1"); + infoAnnotations.put(VCFRecord.HAPMAP3_KEY, hapmap3.size() == 0 ? false : true); } //Process the info field diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorIntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorIntegrationTest.java index 3589865fc..71e5b5319 100755 --- a/java/test/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorIntegrationTest.java @@ -113,8 +113,16 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest { @Test public void testNoReads() { WalkerTestSpec spec = new WalkerTestSpec( - baseTestString() + " -G \"Standard\" -B variant,VCF," + validationDataLocation + "vcfexample3empty.vcf -L 1:10,000,000-10,050,000", 1, + baseTestString() + " -G \"Standard\" -B variant,VCF," + validationDataLocation + "vcfexample3empty.vcf -BTI variant", 1, Arrays.asList("07af9983127c62e96accc03db2fb523e")); - executeTest("test file doesn't have annotations, not passing it any reads", spec); + executeTest("not passing it any reads", spec); + } + + @Test + public void testDBTag() { + WalkerTestSpec spec = new WalkerTestSpec( + baseTestString() + " -D " + GATKDataLocation + "dbsnp_129_b36.rod -G \"Standard\" -B variant,VCF," + validationDataLocation + "vcfexample3empty.vcf -BTI variant", 1, + Arrays.asList("286887826ab99bb2864f7f4db195e59e")); + executeTest("getting DB tag", spec); } } \ No newline at end of file diff --git a/java/test/org/broadinstitute/sting/playground/gatk/walkers/annotator/GenomicAnnotatorIntegrationTest.java b/java/test/org/broadinstitute/sting/playground/gatk/walkers/annotator/GenomicAnnotatorIntegrationTest.java index bff12b8ee..2587c927f 100755 --- a/java/test/org/broadinstitute/sting/playground/gatk/walkers/annotator/GenomicAnnotatorIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/playground/gatk/walkers/annotator/GenomicAnnotatorIntegrationTest.java @@ -26,7 +26,7 @@ public class GenomicAnnotatorIntegrationTest extends WalkerTest { */ - String[] md5WithDashSArg = {"fb6f52b72610a4f6bcf4c130ec14705a"}; + String[] md5WithDashSArg = {"35dffbdb99dbf480f4bc5169219bcfc1"}; WalkerTestSpec specWithSArg = new WalkerTestSpec( "-T GenomicAnnotator -R " + oneKGLocation + "reference/human_b36_both.fasta " + "-B variant,vcf,/humgen/gsa-hpprojects/GATK/data/Annotations/examples/CEU_hapmap_nogt_23_subset.vcf " + diff --git a/settings/repository/org.broad/tribble-102.jar b/settings/repository/org.broad/tribble-103.jar similarity index 93% rename from settings/repository/org.broad/tribble-102.jar rename to settings/repository/org.broad/tribble-103.jar index 89c36296b..592e6292c 100644 Binary files a/settings/repository/org.broad/tribble-102.jar and b/settings/repository/org.broad/tribble-103.jar differ diff --git a/settings/repository/org.broad/tribble-102.xml b/settings/repository/org.broad/tribble-103.xml similarity index 64% rename from settings/repository/org.broad/tribble-102.xml rename to settings/repository/org.broad/tribble-103.xml index 0fdc55018..d42c5a7d0 100644 --- a/settings/repository/org.broad/tribble-102.xml +++ b/settings/repository/org.broad/tribble-103.xml @@ -1,3 +1,3 @@ - +