From 8c28be5933a2748e20ce6b40521e80fd303362bc Mon Sep 17 00:00:00 2001 From: ebanks Date: Fri, 11 Jun 2010 16:42:06 +0000 Subject: [PATCH] Fixing a VCF bug for Sendu: we weren't emitting flags (booleans) correctly in VCF3.3 (rev'ed tribble for this). Updated dbsnp/hapmap membership info fields to be flags now instead of ints. While I was there, I added the change in the Annotator for Jan to force reads to be from a specific sample. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3536 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/refdata/VariantContextAdaptors.java | 2 ++ .../walkers/annotator/VariantAnnotator.java | 8 +++++--- .../annotator/VariantAnnotatorEngine.java | 12 ++++++------ .../VariantAnnotatorIntegrationTest.java | 12 ++++++++++-- .../GenomicAnnotatorIntegrationTest.java | 2 +- .../{tribble-102.jar => tribble-103.jar} | Bin 221973 -> 222035 bytes .../{tribble-102.xml => tribble-103.xml} | 2 +- 7 files changed, 25 insertions(+), 13 deletions(-) rename settings/repository/org.broad/{tribble-102.jar => tribble-103.jar} (93%) rename settings/repository/org.broad/{tribble-102.xml => tribble-103.xml} (64%) 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 89c36296bb97946c14aebe3d43b5de6600e1989e..592e6292cc8052dd51059e9398ed342d39dc1504 100644 GIT binary patch delta 4158 zcmZ8k33yaR60WMA%zHEQ5^`d~eI%TM+zBxuH@WYGoFpXN1V{+s76S-!t++78<`78) z#1$3R0Amz|MFf;XP!|N?oy4roA9dYmQSr5*`0+~zDNs5EHqW^7v!606xnE+HfVWt1xCE~27R*;QawU6XtzB{NbUJm#Y~?RA{$snG00ctthOHSQD!x;+-1Mq4+fU3m?EQ3ZC*zln1K z6xV8}UoEPZ$D0Fus(k>eeVm7419@XH3v_k%rh4}p+q%=w?)jeTNh|)?iaoja5VG)y zKIE=tavz%HuFV@S9$t9L6F@$}?%E6?jel6m9M0XVZLZe7blM&B;ZUk{M->u9OJ}kisRM->^e>Y|-#d9pAD;FFdH@+md?64*q!1j)(BD z6#vlih>q_{%~2iSlb**kJZ^`f*r4MH`F>xD4`i?>ZBV}jPstfh%k7p3@04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@`U}$h1uR|0ZlybsH0r4?;uNCzXA=byKA_yBT z>?XqSajQ?7h{6@>WL-@aUGZ7QApw9Z@JVZCn&=X+4gzSs)f6vUT3gbDLp+5~`#c>@ zlb$vy{ba&tR45Oum(Px}k1xO)0JkoG<==vDlEbmR{Jrgv91gYewx42m6y_p@iogET zvHGTq1b%(7W~7TGepR%#rir8VaRp z@-Tnlb;CrBVxJl&#wn1PFESNamM;_LE}hSpc`%Ss(|n==k*~n1yP#{KKeBZ1YuDjI zF-_?VEb^N_SL9FOR*?+KgQzK%>&~8EEf!N02rKa`&ngj973W-uzop5gVz{zeT`DS+ z=+{!esI*LsQk>>8F-GZx4wrRvh=s%bR;PxGRHYM9?r-Aka#5{xJ}Vbh3Jk1}GvIty zRQPMZSRseOoS`G+(AnYI5ptjmei`APQ{hNIcypx8nMG|X{Z-7Z^hZBlDN|*UoPLS| zvq$+kpN^6nz@o0B{eG5?_9uVoE+=P;!rd>4FJ<*z-eTK0#P7gzf^ u7pmo=GAF*qpZw!Bau&?FQsY<78!IQsoR`On;{SiQw~Z6o_V3d8=Kdcf@B|b9 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 @@ - +