From e96b1791abd3b65c939b214730cd6999cb2464f8 Mon Sep 17 00:00:00 2001 From: ebanks Date: Tue, 27 Oct 2009 02:43:43 +0000 Subject: [PATCH] Need to check for biallelic snp or exception gets thrown. Also, update to new tracker calls. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1913 348d0f76-0448-11de-a6fe-93d51630548a --- .../concordance/SNPGenotypeConcordance.java | 8 +++++-- .../gatk/walkers/concordance/SimpleVenn.java | 24 ++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/concordance/SNPGenotypeConcordance.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/concordance/SNPGenotypeConcordance.java index 7f42b6fb0..724f3c514 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/concordance/SNPGenotypeConcordance.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/concordance/SNPGenotypeConcordance.java @@ -2,6 +2,8 @@ package org.broadinstitute.sting.playground.gatk.walkers.concordance; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; +import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum; +import org.broadinstitute.sting.gatk.refdata.RODRecordList; import org.broadinstitute.sting.utils.StingException; import org.broadinstitute.sting.utils.genotype.VariantBackedByGenotype; import org.broadinstitute.sting.utils.genotype.Variation; @@ -52,8 +54,10 @@ public class SNPGenotypeConcordance implements ConcordanceType { } public void computeConcordance(RefMetaDataTracker tracker, ReferenceContext ref) { - Variation call1 = (Variation)tracker.lookup("callset1", null); - Variation call2 = (Variation)tracker.lookup("callset2", null); + RODRecordList call1List = tracker.getTrackData("callset1", null); + RODRecordList call2List = tracker.getTrackData("callset2", null); + Variation call1 = (call1List == null ? null : (Variation)call1List.getRecords().get(0)); + Variation call2 = (call2List == null ? null : (Variation)call2List.getRecords().get(0)); // the only reason they would be null is a lack of coverage if ( call1 == null || call2 == null ) { diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/concordance/SimpleVenn.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/concordance/SimpleVenn.java index 08677b943..7e3247824 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/concordance/SimpleVenn.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/concordance/SimpleVenn.java @@ -2,6 +2,8 @@ package org.broadinstitute.sting.playground.gatk.walkers.concordance; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; +import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum; +import org.broadinstitute.sting.gatk.refdata.RODRecordList; import org.broadinstitute.sting.utils.StingException; import org.broadinstitute.sting.utils.genotype.Variation; @@ -38,8 +40,10 @@ public class SimpleVenn implements ConcordanceType { } public void computeConcordance(RefMetaDataTracker tracker, ReferenceContext ref) { - Variation call1 = (Variation)tracker.lookup("callset1", null); - Variation call2 = (Variation)tracker.lookup("callset2", null); + RODRecordList call1List = tracker.getTrackData("callset1", null); + RODRecordList call2List = tracker.getTrackData("callset2", null); + Variation call1 = (call1List == null ? null : (Variation)call1List.getRecords().get(0)); + Variation call2 = (call2List == null ? null : (Variation)call2List.getRecords().get(0)); if ( call1 == null && call2 == null ) return; @@ -55,13 +59,15 @@ public class SimpleVenn implements ConcordanceType { else if ( call1 == null ) printVariant(set2_writer, call2); - // intersection (concordant) - else if ( call1.getAlternativeBaseForSNP() == call2.getAlternativeBaseForSNP()) - printVariant(intersect_writer, call1); - - // intersection (discordant) - else - printVariant(discord_writer, call1); + // we can't really deal with multi-allelic variants + else if ( call1.isBiallelic() && call2.isBiallelic() ) { + // intersection (concordant) + if ( call1.getAlternativeBaseForSNP() == call2.getAlternativeBaseForSNP() ) + printVariant(intersect_writer, call1); + // intersection (discordant) + else + printVariant(discord_writer, call1); + } } private static void printVariant(PrintWriter writer, Variation variant) {