From ab8fa8f359fe61eab4c34ec596cbf9d021e4a7dd Mon Sep 17 00:00:00 2001 From: Guillermo del Angel Date: Fri, 21 Sep 2012 20:48:12 -0400 Subject: [PATCH] Bug fix: AlleleCount stratification in VariantEval didn't support higher ploidy and was producing bad tables --- .../sting/gatk/walkers/varianteval/VariantEval.java | 4 ++++ .../gatk/walkers/varianteval/stratifications/AlleleCount.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEval.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEval.java index 01237ade3..a73e125ad 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEval.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEval.java @@ -171,6 +171,9 @@ public class VariantEval extends RodWalker implements TreeRedu @Argument(shortName="mvq", fullName="mendelianViolationQualThreshold", doc="Minimum genotype QUAL score for each trio member required to accept a site as a violation. Default is 50.", required=false) protected double MENDELIAN_VIOLATION_QUAL_THRESHOLD = 50; + @Argument(shortName="ploidy", fullName="samplePloidy", doc="Per-sample ploidy (number of chromosomes per sample)", required=false) + protected int ploidy = VariantContextUtils.DEFAULT_PLOIDY; + @Argument(fullName="ancestralAlignments", shortName="aa", doc="Fasta file with ancestral alleles", required=false) private File ancestralAlignmentsFile = null; @@ -574,6 +577,7 @@ public class VariantEval extends RodWalker implements TreeRedu public double getMinPhaseQuality() { return MIN_PHASE_QUALITY; } + public int getSamplePloidy() { return ploidy; } public double getMendelianViolationQualThreshold() { return MENDELIAN_VIOLATION_QUAL_THRESHOLD; } public static String getAllSampleName() { return ALL_SAMPLE_NAME; } diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/AlleleCount.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/AlleleCount.java index fbd6371f3..e6efd4482 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/AlleleCount.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/AlleleCount.java @@ -27,9 +27,9 @@ public class AlleleCount extends VariantStratifier { if ( getVariantEvalWalker().getEvals().size() != 1 && !getVariantEvalWalker().mergeEvals ) throw new UserException.BadArgumentValue("AlleleCount", "AlleleCount stratification only works with a single eval vcf"); - // There are 2 x n sample chromosomes for diploids + // There are ploidy x n sample chromosomes // TODO -- generalize to handle multiple ploidy - nchrom = getVariantEvalWalker().getSampleNamesForEvaluation().size() * 2; + nchrom = getVariantEvalWalker().getSampleNamesForEvaluation().size() * getVariantEvalWalker().getSamplePloidy(); if ( nchrom < 2 ) throw new UserException.BadArgumentValue("AlleleCount", "AlleleCount stratification requires an eval vcf with at least one sample");