diff --git a/build.xml b/build.xml
index 0a4cd2171..d3377a763 100644
--- a/build.xml
+++ b/build.xml
@@ -1249,11 +1249,7 @@
-
-
-
-
-
+
diff --git a/licensing/GATK2_beta_license.doc b/licensing/GATK2_beta_license.doc
index 4fa04a3f6..2b9cdeb9c 100644
Binary files a/licensing/GATK2_beta_license.doc and b/licensing/GATK2_beta_license.doc differ
diff --git a/licensing/GATK2_beta_license.pdf b/licensing/GATK2_beta_license.pdf
new file mode 100644
index 000000000..fc592066e
Binary files /dev/null and b/licensing/GATK2_beta_license.pdf differ
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PoolGenotypeLikelihoodsCalculationModel.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PoolGenotypeLikelihoodsCalculationModel.java
index 8b5639817..37b676601 100644
--- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PoolGenotypeLikelihoodsCalculationModel.java
+++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PoolGenotypeLikelihoodsCalculationModel.java
@@ -213,7 +213,7 @@ public abstract class PoolGenotypeLikelihoodsCalculationModel extends GenotypeLi
if (UAC.TREAT_ALL_READS_AS_SINGLE_POOL) {
AlignmentContext mergedContext = AlignmentContextUtils.joinContexts(contexts.values());
Map newContext = new HashMap();
- newContext.put(DUMMY_POOL,mergedContext);
+ newContext.put(DUMMY_SAMPLE_NAME,mergedContext);
contexts = newContext;
}
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PoolIndelGenotypeLikelihoodsCalculationModel.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PoolIndelGenotypeLikelihoodsCalculationModel.java
index 0922b8e7f..c2bac4455 100644
--- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PoolIndelGenotypeLikelihoodsCalculationModel.java
+++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PoolIndelGenotypeLikelihoodsCalculationModel.java
@@ -39,6 +39,7 @@ import org.broadinstitute.sting.utils.variantcontext.*;
import java.util.*;
public class PoolIndelGenotypeLikelihoodsCalculationModel extends PoolGenotypeLikelihoodsCalculationModel {
+ private static final int MAX_NUM_ALLELES_TO_GENOTYPE = 4;
private PairHMMIndelErrorModel pairModel;
private boolean allelesArePadded = false;
@@ -94,7 +95,10 @@ public class PoolIndelGenotypeLikelihoodsCalculationModel extends PoolGenotypeLi
final Pair,Boolean> pair = IndelGenotypeLikelihoodsCalculationModel.getInitialAlleleList(tracker, ref, contexts, contextType, locParser, UAC,true);
- final List alleles = pair.first;
+ List alleles = pair.first;
+
+ if (alleles.size() > MAX_NUM_ALLELES_TO_GENOTYPE)
+ alleles = alleles.subList(0,MAX_NUM_ALLELES_TO_GENOTYPE);
allelesArePadded = pair.second;
if (contextType == AlignmentContextUtils.ReadOrientation.COMPLETE) {
IndelGenotypeLikelihoodsCalculationModel.getIndelLikelihoodMap().clear();
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/GenotypingEngine.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/GenotypingEngine.java
index 47a7030a8..bdd04cba1 100644
--- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/GenotypingEngine.java
+++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/GenotypingEngine.java
@@ -33,6 +33,7 @@ import org.apache.commons.lang.ArrayUtils;
import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedGenotyperEngine;
import org.broadinstitute.sting.gatk.walkers.genotyper.VariantCallContext;
import org.broadinstitute.sting.utils.*;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFAlleleClipper;
import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.variantcontext.*;
@@ -381,24 +382,7 @@ public class GenotypingEngine {
}
if( R2 > MERGE_EVENTS_R2_THRESHOLD ) {
- byte[] refBases = thisVC.getReference().getBases();
- byte[] altBases = thisVC.getAlternateAllele(0).getBases();
- final int thisPadding = ( thisVC.getReference().isNull() || thisVC.getAlternateAllele(0).isNull() ? 1 : 0 );
- final int nextPadding = ( nextVC.getReference().isNull() || nextVC.getAlternateAllele(0).isNull() ? 1 : 0 );
- for( int locus = thisStart + refBases.length + thisPadding ; locus < nextStart + nextPadding; locus++ ) {
- final byte refByte = ref[ locus - refLoc.getStart() ];
- refBases = ArrayUtils.add(refBases, refByte);
- altBases = ArrayUtils.add(altBases, refByte);
- }
- refBases = ArrayUtils.addAll(refBases, nextVC.getReference().getBases());
- altBases = ArrayUtils.addAll(altBases, nextVC.getAlternateAllele(0).getBases());
-
- final ArrayList mergedAlleles = new ArrayList();
- mergedAlleles.add( Allele.create( refBases, true ) );
- mergedAlleles.add( Allele.create( altBases, false ) );
- final VariantContext mergedVC = ( refBases.length == altBases.length ?
- new VariantContextBuilder("MNP", thisVC.getChr(), thisVC.getStart() + (thisVC.isIndel() && !thisVC.isComplexIndel() ? 1 : 0) , nextVC.getEnd(), mergedAlleles).make() :
- new VariantContextBuilder("Complex", thisVC.getChr(), thisVC.getStart(), nextVC.getEnd(), mergedAlleles).referenceBaseForIndel(ref[thisStart-refLoc.getStart()]).make() );
+ final VariantContext mergedVC = createMergedVariantContext(thisVC, nextVC, ref, refLoc);
// remove the old event from the eventMap on every haplotype and the start pos key set, replace with merged event
for( final Haplotype h : haplotypes ) {
@@ -431,6 +415,36 @@ public class GenotypingEngine {
}
}
+ // BUGBUG: make this merge function more general
+ protected static VariantContext createMergedVariantContext( final VariantContext thisVC, final VariantContext nextVC, final byte[] ref, final GenomeLoc refLoc ) {
+ final int thisStart = thisVC.getStart();
+ final int nextStart = nextVC.getStart();
+ byte[] refBases = ( thisVC.hasReferenceBaseForIndel() ? new byte[]{ thisVC.getReferenceBaseForIndel() } : new byte[]{} );
+ byte[] altBases = ( thisVC.hasReferenceBaseForIndel() ? new byte[]{ thisVC.getReferenceBaseForIndel() } : new byte[]{} );
+ refBases = ArrayUtils.addAll(refBases, thisVC.getReference().getBases());
+ altBases = ArrayUtils.addAll(altBases, thisVC.getAlternateAllele(0).getBases());
+ for( int locus = thisStart + refBases.length; locus < nextStart; locus++ ) {
+ final byte refByte = ref[locus - refLoc.getStart()];
+ refBases = ArrayUtils.add(refBases, refByte);
+ altBases = ArrayUtils.add(altBases, refByte);
+ }
+ if( nextVC.hasReferenceBaseForIndel() ) {
+ refBases = ArrayUtils.add(refBases, nextVC.getReferenceBaseForIndel());
+ altBases = ArrayUtils.add(altBases, nextVC.getReferenceBaseForIndel());
+ }
+ refBases = ArrayUtils.addAll(refBases, nextVC.getReference().getBases());
+ altBases = ArrayUtils.addAll(altBases, nextVC.getAlternateAllele(0).getBases());
+
+ int iii = 0;
+ if( refBases.length == altBases.length && VCFAlleleClipper.needsPadding(thisVC) ) { // special case of insertion + deletion of same length creates an MNP --> trim padding bases off the allele
+ while( iii < refBases.length && refBases[iii] == altBases[iii] ) { iii++; }
+ }
+ final ArrayList mergedAlleles = new ArrayList();
+ mergedAlleles.add( Allele.create( ArrayUtils.subarray(refBases, iii, refBases.length), true ) );
+ mergedAlleles.add( Allele.create( ArrayUtils.subarray(altBases, iii, altBases.length), false ) );
+ return new VariantContextBuilder("merged", thisVC.getChr(), thisVC.getStart() + iii, nextVC.getEnd(), mergedAlleles).make();
+ }
+
@Requires({"x11 >= 0", "x12 >= 0", "x21 >= 0", "x22 >= 0"})
@Ensures({"result >= 0.0", "result <= 1.0"})
protected static double calculateR2LD( final int x11, final int x12, final int x21, final int x22 ) {
diff --git a/protected/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/PoolCallerIntegrationTest.java b/protected/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/PoolCallerIntegrationTest.java
index f04a3fd4d..903465538 100644
--- a/protected/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/PoolCallerIntegrationTest.java
+++ b/protected/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/PoolCallerIntegrationTest.java
@@ -39,7 +39,7 @@ public class PoolCallerIntegrationTest extends WalkerTest {
@Test
public void testBOTH_GGA_Pools() {
- PC_LSV_Test(String.format(" -maxAlleles 2 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -alleles %s",LSV_ALLELES),"LSV_BOTH_GGA","POOLBOTH","da85bf56eeafae31b5a269b4e19b5db6");
+ PC_LSV_Test(String.format(" -maxAlleles 2 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -alleles %s",LSV_ALLELES),"LSV_BOTH_GGA","POOLBOTH","36b8db57f65be1cc3d2d9d7f9f3f26e4");
}
@Test
@@ -49,13 +49,13 @@ public class PoolCallerIntegrationTest extends WalkerTest {
@Test
public void testMT_SNP_DISCOVERY_sp4() {
- PC_MT_Test(CEUTRIO_BAM, " -maxAlleles 1 -ploidy 8", "MT_SNP_DISCOVERY_sp4","060f06987a33f60433b0382cd7227140");
+ PC_MT_Test(CEUTRIO_BAM, " -maxAlleles 1 -ploidy 8", "MT_SNP_DISCOVERY_sp4","fa5ee7c957c473a80f3a7f3c35dc80b5");
}
@Test
public void testMT_SNP_GGA_sp10() {
- PC_MT_Test(CEUTRIO_BAM, String.format(" -maxAlleles 1 -ploidy 20 -gt_mode GENOTYPE_GIVEN_ALLELES -alleles %s",NA12891_CALLS), "MT_SNP_GGA_sp10", "df3ffc5cb76224ba152f543925eb3974");
+ PC_MT_Test(CEUTRIO_BAM, String.format(" -maxAlleles 1 -ploidy 20 -gt_mode GENOTYPE_GIVEN_ALLELES -alleles %s",NA12891_CALLS), "MT_SNP_GGA_sp10", "6907c8617d49bb57b33f8704ce7f0323");
}
}
diff --git a/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/GenotypingEngineUnitTest.java b/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/GenotypingEngineUnitTest.java
index 4826bfb16..04bb3a753 100644
--- a/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/GenotypingEngineUnitTest.java
+++ b/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/GenotypingEngineUnitTest.java
@@ -12,6 +12,7 @@ import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.fasta.CachingIndexedFastaSequenceFile;
import org.broadinstitute.sting.utils.variantcontext.Allele;
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextBuilder;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -232,7 +233,7 @@ public class GenotypingEngineUnitTest extends BaseTest {
}
/**
- * Tests that we get the right values from the binomial distribution
+ * Tests that we get the right values from the R^2 calculation
*/
@Test
public void testCalculateR2LD() {
@@ -244,6 +245,146 @@ public class GenotypingEngineUnitTest extends BaseTest {
Assert.assertEquals(GenotypingEngine.calculateR2LD(100,0,0,100), 1.0, 0.00001);
Assert.assertEquals(GenotypingEngine.calculateR2LD(1,2,3,4), (0.1 - 0.12) * (0.1 - 0.12) / (0.3 * 0.7 * 0.4 * 0.6), 0.00001);
}
+
+ @Test
+ public void testCreateMergedVariantContext() {
+ logger.warn("Executing testCreateMergedVariantContext");
+
+ final byte[] ref = "AATTCCGGAATTCCGGAATT".getBytes();
+ final GenomeLoc refLoc = genomeLocParser.createGenomeLoc("2", 1700, 1700 + ref.length);
+
+ // SNP + SNP = simple MNP
+ VariantContext thisVC = new VariantContextBuilder().loc("2", 1703, 1703).alleles("T","G").make();
+ VariantContext nextVC = new VariantContextBuilder().loc("2", 1704, 1704).alleles("C","G").make();
+ VariantContext truthVC = new VariantContextBuilder().loc("2", 1703, 1704).alleles("TC","GG").source("merged").make();
+ VariantContext mergedVC = GenotypingEngine.createMergedVariantContext(thisVC, nextVC, ref, refLoc);
+ logger.warn(truthVC + " == " + mergedVC);
+ Assert.assertTrue(truthVC.hasSameAllelesAs(mergedVC));
+ Assert.assertEquals(truthVC.getStart(), mergedVC.getStart());
+ Assert.assertEquals(truthVC.getEnd(), mergedVC.getEnd());
+ Assert.assertEquals(truthVC.hasReferenceBaseForIndel(), mergedVC.hasReferenceBaseForIndel());
+ Assert.assertEquals(truthVC.getReferenceBaseForIndel(), mergedVC.getReferenceBaseForIndel());
+
+ // SNP + ref + SNP = MNP with ref base gap
+ thisVC = new VariantContextBuilder().loc("2", 1703, 1703).alleles("T","G").make();
+ nextVC = new VariantContextBuilder().loc("2", 1705, 1705).alleles("C","G").make();
+ truthVC = new VariantContextBuilder().loc("2", 1703, 1705).alleles("TCC","GCG").source("merged").make();
+ mergedVC = GenotypingEngine.createMergedVariantContext(thisVC, nextVC, ref, refLoc);
+ logger.warn(truthVC + " == " + mergedVC);
+ Assert.assertTrue(truthVC.hasSameAllelesAs(mergedVC));
+ Assert.assertEquals(truthVC.getStart(), mergedVC.getStart());
+ Assert.assertEquals(truthVC.getEnd(), mergedVC.getEnd());
+ Assert.assertEquals(truthVC.hasReferenceBaseForIndel(), mergedVC.hasReferenceBaseForIndel());
+ Assert.assertEquals(truthVC.getReferenceBaseForIndel(), mergedVC.getReferenceBaseForIndel());
+
+ // insertion + SNP
+ thisVC = new VariantContextBuilder().loc("2", 1703, 1703).alleles("-","AAAAA").referenceBaseForIndel("T").make();
+ nextVC = new VariantContextBuilder().loc("2", 1705, 1705).alleles("C","G").make();
+ truthVC = new VariantContextBuilder().loc("2", 1703, 1705).alleles("TCC","TAAAAACG").source("merged").make();
+ mergedVC = GenotypingEngine.createMergedVariantContext(thisVC, nextVC, ref, refLoc);
+ logger.warn(truthVC + " == " + mergedVC);
+ Assert.assertTrue(truthVC.hasSameAllelesAs(mergedVC));
+ Assert.assertEquals(truthVC.getStart(), mergedVC.getStart());
+ Assert.assertEquals(truthVC.getEnd(), mergedVC.getEnd());
+ Assert.assertEquals(truthVC.hasReferenceBaseForIndel(), mergedVC.hasReferenceBaseForIndel());
+ Assert.assertEquals(truthVC.getReferenceBaseForIndel(), mergedVC.getReferenceBaseForIndel());
+
+ // SNP + insertion
+ thisVC = new VariantContextBuilder().loc("2", 1703, 1703).alleles("T","G").make();
+ nextVC = new VariantContextBuilder().loc("2", 1705, 1705).alleles("-","AAAAA").referenceBaseForIndel("C").make();
+ truthVC = new VariantContextBuilder().loc("2", 1703, 1705).alleles("TCC","GCCAAAAA").source("merged").make();
+ mergedVC = GenotypingEngine.createMergedVariantContext(thisVC, nextVC, ref, refLoc);
+ logger.warn(truthVC + " == " + mergedVC);
+ Assert.assertTrue(truthVC.hasSameAllelesAs(mergedVC));
+ Assert.assertEquals(truthVC.getStart(), mergedVC.getStart());
+ Assert.assertEquals(truthVC.getEnd(), mergedVC.getEnd());
+ Assert.assertEquals(truthVC.hasReferenceBaseForIndel(), mergedVC.hasReferenceBaseForIndel());
+ Assert.assertEquals(truthVC.getReferenceBaseForIndel(), mergedVC.getReferenceBaseForIndel());
+
+ // deletion + SNP
+ thisVC = new VariantContextBuilder().loc("2", 1703, 1704).alleles("C","-").referenceBaseForIndel("T").make();
+ nextVC = new VariantContextBuilder().loc("2", 1705, 1705).alleles("C","G").make();
+ truthVC = new VariantContextBuilder().loc("2", 1703, 1705).alleles("TCC","TG").source("merged").make();
+ mergedVC = GenotypingEngine.createMergedVariantContext(thisVC, nextVC, ref, refLoc);
+ logger.warn(truthVC + " == " + mergedVC);
+ Assert.assertTrue(truthVC.hasSameAllelesAs(mergedVC));
+ Assert.assertEquals(truthVC.getStart(), mergedVC.getStart());
+ Assert.assertEquals(truthVC.getEnd(), mergedVC.getEnd());
+ Assert.assertEquals(truthVC.hasReferenceBaseForIndel(), mergedVC.hasReferenceBaseForIndel());
+ Assert.assertEquals(truthVC.getReferenceBaseForIndel(), mergedVC.getReferenceBaseForIndel());
+
+ // SNP + deletion
+ thisVC = new VariantContextBuilder().loc("2", 1703, 1703).alleles("T","G").make();
+ nextVC = new VariantContextBuilder().loc("2", 1705, 1706).alleles("G","-").referenceBaseForIndel("C").make();
+ truthVC = new VariantContextBuilder().loc("2", 1703, 1706).alleles("TCCG","GCC").source("merged").make();
+ mergedVC = GenotypingEngine.createMergedVariantContext(thisVC, nextVC, ref, refLoc);
+ logger.warn(truthVC + " == " + mergedVC);
+ Assert.assertTrue(truthVC.hasSameAllelesAs(mergedVC));
+ Assert.assertEquals(truthVC.getStart(), mergedVC.getStart());
+ Assert.assertEquals(truthVC.getEnd(), mergedVC.getEnd());
+ Assert.assertEquals(truthVC.hasReferenceBaseForIndel(), mergedVC.hasReferenceBaseForIndel());
+ Assert.assertEquals(truthVC.getReferenceBaseForIndel(), mergedVC.getReferenceBaseForIndel());
+
+ // insertion + deletion = MNP
+ thisVC = new VariantContextBuilder().loc("2", 1703, 1703).alleles("-","A").referenceBaseForIndel("T").make();
+ nextVC = new VariantContextBuilder().loc("2", 1705, 1706).alleles("G","-").referenceBaseForIndel("C").make();
+ truthVC = new VariantContextBuilder().loc("2", 1704, 1706).alleles("CCG","ACC").source("merged").make();
+ mergedVC = GenotypingEngine.createMergedVariantContext(thisVC, nextVC, ref, refLoc);
+ logger.warn(truthVC + " == " + mergedVC);
+ Assert.assertTrue(truthVC.hasSameAllelesAs(mergedVC));
+ Assert.assertEquals(truthVC.getStart(), mergedVC.getStart());
+ Assert.assertEquals(truthVC.getEnd(), mergedVC.getEnd());
+ Assert.assertEquals(truthVC.hasReferenceBaseForIndel(), mergedVC.hasReferenceBaseForIndel());
+ Assert.assertEquals(truthVC.getReferenceBaseForIndel(), mergedVC.getReferenceBaseForIndel());
+
+ // insertion + deletion
+ thisVC = new VariantContextBuilder().loc("2", 1703, 1703).alleles("-","AAAAA").referenceBaseForIndel("T").make();
+ nextVC = new VariantContextBuilder().loc("2", 1705, 1706).alleles("G","-").referenceBaseForIndel("C").make();
+ truthVC = new VariantContextBuilder().loc("2", 1703, 1706).alleles("TCCG","TAAAAACC").source("merged").make();
+ mergedVC = GenotypingEngine.createMergedVariantContext(thisVC, nextVC, ref, refLoc);
+ logger.warn(truthVC + " == " + mergedVC);
+ Assert.assertTrue(truthVC.hasSameAllelesAs(mergedVC));
+ Assert.assertEquals(truthVC.getStart(), mergedVC.getStart());
+ Assert.assertEquals(truthVC.getEnd(), mergedVC.getEnd());
+ Assert.assertEquals(truthVC.hasReferenceBaseForIndel(), mergedVC.hasReferenceBaseForIndel());
+ Assert.assertEquals(truthVC.getReferenceBaseForIndel(), mergedVC.getReferenceBaseForIndel());
+
+ // insertion + insertion
+ thisVC = new VariantContextBuilder().loc("2", 1703, 1703).alleles("-","A").referenceBaseForIndel("T").make();
+ nextVC = new VariantContextBuilder().loc("2", 1705, 1705).alleles("-","A").referenceBaseForIndel("C").make();
+ truthVC = new VariantContextBuilder().loc("2", 1703, 1705).alleles("TCC","TACCA").source("merged").make();
+ mergedVC = GenotypingEngine.createMergedVariantContext(thisVC, nextVC, ref, refLoc);
+ logger.warn(truthVC + " == " + mergedVC);
+ Assert.assertTrue(truthVC.hasSameAllelesAs(mergedVC));
+ Assert.assertEquals(truthVC.getStart(), mergedVC.getStart());
+ Assert.assertEquals(truthVC.getEnd(), mergedVC.getEnd());
+ Assert.assertEquals(truthVC.hasReferenceBaseForIndel(), mergedVC.hasReferenceBaseForIndel());
+ Assert.assertEquals(truthVC.getReferenceBaseForIndel(), mergedVC.getReferenceBaseForIndel());
+
+ // deletion + deletion
+ thisVC = new VariantContextBuilder().loc("2", 1701, 1702).alleles("T","-").referenceBaseForIndel("A").make();
+ nextVC = new VariantContextBuilder().loc("2", 1705, 1706).alleles("G","-").referenceBaseForIndel("C").make();
+ truthVC = new VariantContextBuilder().loc("2", 1701, 1706).alleles("ATTCCG","ATCC").source("merged").make();
+ mergedVC = GenotypingEngine.createMergedVariantContext(thisVC, nextVC, ref, refLoc);
+ logger.warn(truthVC + " == " + mergedVC);
+ Assert.assertTrue(truthVC.hasSameAllelesAs(mergedVC));
+ Assert.assertEquals(truthVC.getStart(), mergedVC.getStart());
+ Assert.assertEquals(truthVC.getEnd(), mergedVC.getEnd());
+ Assert.assertEquals(truthVC.hasReferenceBaseForIndel(), mergedVC.hasReferenceBaseForIndel());
+ Assert.assertEquals(truthVC.getReferenceBaseForIndel(), mergedVC.getReferenceBaseForIndel());
+
+ // complex + complex
+ thisVC = new VariantContextBuilder().loc("2", 1703, 1704).alleles("TC","AAA").make();
+ nextVC = new VariantContextBuilder().loc("2", 1706, 1707).alleles("GG","AC").make();
+ truthVC = new VariantContextBuilder().loc("2", 1703, 1707).alleles("TCCGG","AAACAC").source("merged").make();
+ mergedVC = GenotypingEngine.createMergedVariantContext(thisVC, nextVC, ref, refLoc);
+ logger.warn(truthVC + " == " + mergedVC);
+ Assert.assertTrue(truthVC.hasSameAllelesAs(mergedVC));
+ Assert.assertEquals(truthVC.getStart(), mergedVC.getStart());
+ Assert.assertEquals(truthVC.getEnd(), mergedVC.getEnd());
+ Assert.assertEquals(truthVC.hasReferenceBaseForIndel(), mergedVC.hasReferenceBaseForIndel());
+ Assert.assertEquals(truthVC.getReferenceBaseForIndel(), mergedVC.getReferenceBaseForIndel());
+ }
/**
* Private function to compare HashMap of VCs, it only checks the types and start locations of the VariantContext
diff --git a/public/java/src/org/broadinstitute/sting/commandline/CommandLineProgram.java b/public/java/src/org/broadinstitute/sting/commandline/CommandLineProgram.java
index 9e1be5bca..976889613 100644
--- a/public/java/src/org/broadinstitute/sting/commandline/CommandLineProgram.java
+++ b/public/java/src/org/broadinstitute/sting/commandline/CommandLineProgram.java
@@ -369,9 +369,9 @@ public abstract class CommandLineProgram {
System.exit(1);
}
- public static void exitSystemWithSamError(final Exception e) {
- if ( e.getMessage() == null )
- throw new ReviewedStingException("SamException found with no message!", e);
+ public static void exitSystemWithSamError(final Throwable t) {
+ if ( t.getMessage() == null )
+ throw new ReviewedStingException("SamException found with no message!", t);
errorPrintf("------------------------------------------------------------------------------------------%n");
errorPrintf("A BAM ERROR has occurred (version %s): %n", CommandLineGATK.getVersionNumber());
@@ -383,7 +383,7 @@ public abstract class CommandLineProgram {
errorPrintf("Also, please ensure that your BAM index is not corrupted: delete the current one and regenerate it with 'samtools index'%n");
printDocumentationReference();
errorPrintf("%n");
- errorPrintf("MESSAGE: %s%n", e.getMessage().trim());
+ errorPrintf("MESSAGE: %s%n", t.getMessage().trim());
errorPrintf("------------------------------------------------------------------------------------------%n");
System.exit(1);
}
diff --git a/public/java/src/org/broadinstitute/sting/gatk/CommandLineGATK.java b/public/java/src/org/broadinstitute/sting/gatk/CommandLineGATK.java
index 70c6bc734..c0865e656 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/CommandLineGATK.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/CommandLineGATK.java
@@ -35,6 +35,7 @@ import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
import org.broadinstitute.sting.gatk.refdata.tracks.FeatureManager;
import org.broadinstitute.sting.gatk.walkers.Attribution;
import org.broadinstitute.sting.gatk.walkers.Walker;
+import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.help.*;
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
@@ -101,20 +102,35 @@ public class CommandLineGATK extends CommandLineExecutable {
// TODO: Should Picard exceptions be, in general, UserExceptions or ReviewedStingExceptions?
exitSystemWithError(e);
} catch (SAMException e) {
- checkForTooManyOpenFilesProblem(e.getMessage());
+ checkForMaskedUserErrors(e);
exitSystemWithSamError(e);
} catch (OutOfMemoryError e) {
exitSystemWithUserError(new UserException.NotEnoughMemory());
} catch (Throwable t) {
- checkForTooManyOpenFilesProblem(t.getMessage());
+ checkForMaskedUserErrors(t);
exitSystemWithError(t);
}
}
- private static void checkForTooManyOpenFilesProblem(String message) {
- // Special case the "Too many open files" error because it's a common User Error for which we know what to do
- if ( message != null && message.indexOf("Too many open files") != -1 )
+ protected static final String PICARD_TEXT_SAM_FILE_ERROR_1 = "Cannot use index file with textual SAM file";
+ protected static final String PICARD_TEXT_SAM_FILE_ERROR_2 = "Cannot retrieve file pointers within SAM text files";
+ private static void checkForMaskedUserErrors(final Throwable t) {
+ final String message = t.getMessage();
+ if ( message == null )
+ return;
+
+ // we know what to do about the common "Too many open files" error
+ if ( message.indexOf("Too many open files") != -1 )
exitSystemWithUserError(new UserException.TooManyOpenFiles());
+
+ // malformed BAM looks like a SAM file
+ if ( message.indexOf(PICARD_TEXT_SAM_FILE_ERROR_1) != -1 ||
+ message.indexOf(PICARD_TEXT_SAM_FILE_ERROR_2) != -1 )
+ exitSystemWithSamError(t);
+
+ // can't close tribble index when writing
+ if ( message.indexOf("Unable to close index for") != -1 )
+ exitSystemWithUserError(new UserException(t.getCause().getMessage()));
}
/**
diff --git a/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java b/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java
index 9d2a138fa..8dfa89083 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java
@@ -51,7 +51,7 @@ import org.broadinstitute.sting.gatk.samples.SampleDBBuilder;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.baq.BAQ;
-import org.broadinstitute.sting.utils.classloader.JVMUtils;
+import org.broadinstitute.sting.utils.classloader.GATKLiteUtils;
import org.broadinstitute.sting.utils.codecs.vcf.VCFCodec;
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
import org.broadinstitute.sting.utils.collections.Pair;
@@ -206,7 +206,7 @@ public class GenomeAnalysisEngine {
* Utility method to determine whether this is the lite version of the GATK
*/
public boolean isGATKLite() {
- return JVMUtils.isGATKLite();
+ return GATKLiteUtils.isGATKLite();
}
/**
diff --git a/public/java/src/org/broadinstitute/sting/gatk/arguments/GATKArgumentCollection.java b/public/java/src/org/broadinstitute/sting/gatk/arguments/GATKArgumentCollection.java
index 45499817e..3fd3857c5 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/arguments/GATKArgumentCollection.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/arguments/GATKArgumentCollection.java
@@ -211,6 +211,7 @@ public class GATKArgumentCollection {
* Any value greater than zero will be used to recalculate the quantization using that many levels.
* Negative values mean that we should quantize using the recalibration report's quantization level.
*/
+ @Hidden
@Argument(fullName="quantize_quals", shortName = "qq", doc = "Quantize quality scores to a given number of levels (with -BQSR)", required=false)
public int quantizationLevels = 0;
diff --git a/public/java/src/org/broadinstitute/sting/gatk/datasources/reads/GATKBAMIndex.java b/public/java/src/org/broadinstitute/sting/gatk/datasources/reads/GATKBAMIndex.java
index 2bf75b035..73301c511 100644
--- a/public/java/src/org/broadinstitute/sting/gatk/datasources/reads/GATKBAMIndex.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/datasources/reads/GATKBAMIndex.java
@@ -24,6 +24,7 @@
package org.broadinstitute.sting.gatk.datasources.reads;
import net.sf.samtools.*;
+import org.broadinstitute.sting.gatk.CommandLineGATK;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException;
@@ -300,7 +301,7 @@ public class GATKBAMIndex {
fileChannel = fileStream.getChannel();
}
catch (IOException exc) {
- throw new ReviewedStingException("Unable to open index file " + mFile, exc);
+ throw new ReviewedStingException("Unable to open index file (" + exc.getMessage() +")" + mFile, exc);
}
}
diff --git a/public/java/src/org/broadinstitute/sting/gatk/executive/HierarchicalMicroScheduler.java b/public/java/src/org/broadinstitute/sting/gatk/executive/HierarchicalMicroScheduler.java
index b821b98e6..5f20ac7af 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/executive/HierarchicalMicroScheduler.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/executive/HierarchicalMicroScheduler.java
@@ -11,7 +11,6 @@ import org.broadinstitute.sting.gatk.io.ThreadLocalOutputTracker;
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
import org.broadinstitute.sting.gatk.walkers.Walker;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
-import org.broadinstitute.sting.utils.exceptions.StingException;
import org.broadinstitute.sting.utils.threading.ThreadPoolMonitor;
import java.util.Collection;
@@ -256,7 +255,8 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Hierar
// Specifically catch Tribble I/O exceptions and rethrow them as Reviewed. We don't expect
// any issues here because we created the Tribble output file mere moments ago and expect it to
// be completely valid.
- throw new ReviewedStingException("Unable to merge temporary Tribble output file.",ex);
+ final String reason = ex.getMessage();
+ throw new ReviewedStingException("Unable to merge temporary Tribble output file" + (reason == null ? "." : (" (" + reason + ").")), ex);
}
}
}
diff --git a/public/java/src/org/broadinstitute/sting/gatk/executive/ShardTraverser.java b/public/java/src/org/broadinstitute/sting/gatk/executive/ShardTraverser.java
index 9920213a3..bb0344848 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/executive/ShardTraverser.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/executive/ShardTraverser.java
@@ -6,11 +6,11 @@ import org.broadinstitute.sting.gatk.datasources.providers.ShardDataProvider;
import org.broadinstitute.sting.gatk.datasources.reads.Shard;
import org.broadinstitute.sting.gatk.io.ThreadLocalOutputTracker;
import org.broadinstitute.sting.gatk.traversals.TraversalEngine;
-import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.walkers.Walker;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
/**
* User: hanna
* Date: Apr 29, 2009
@@ -79,6 +79,10 @@ public class ShardTraverser implements Callable {
microScheduler.reportShardTraverseTime(endTime-startTime);
return accumulator;
+ } catch(Throwable t) {
+ // Notify that an exception has occurred
+ microScheduler.handleException(new ExecutionException(t));
+ throw new RuntimeException(t);
} finally {
synchronized(this) {
complete = true;
diff --git a/public/java/src/org/broadinstitute/sting/gatk/filters/ReadFilter.java b/public/java/src/org/broadinstitute/sting/gatk/filters/ReadFilter.java
index 641bddb2d..d8caa3dea 100644
--- a/public/java/src/org/broadinstitute/sting/gatk/filters/ReadFilter.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/filters/ReadFilter.java
@@ -28,6 +28,7 @@ public abstract class ReadFilter implements SamRecordFilter {
* @return true if the SAMRecords matches the filter, otherwise false
* @throws UnsupportedOperationException when paired filter not implemented
*/
+ @Override
public boolean filterOut(final SAMRecord first, final SAMRecord second) {
throw new UnsupportedOperationException("Paired filter not implemented: " + this.getClass());
}
diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java
index e3ee8c923..6dc0ba3e1 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java
@@ -255,12 +255,9 @@ public class FisherStrand extends InfoFieldAnnotation implements StandardAnnotat
for ( Map.Entry sample : stratifiedContexts.entrySet() ) {
for (PileupElement p : sample.getValue().getBasePileup()) {
- if ( p.isDeletion() || p.getRead().isReducedRead() ) // ignore deletions and reduced reads
+ if ( ! RankSumTest.isUsableBase(p, false) || p.getRead().isReducedRead() ) // ignore deletions and reduced reads
continue;
- if ( p.getRead().getMappingQuality() < 20 || p.getQual() < 20 )
- continue; // todo -- fixme, should take filtered context!
-
Allele base = Allele.create(p.getBase(), false);
boolean isFW = !p.getRead().getReadNegativeStrandFlag();
@@ -301,9 +298,7 @@ public class FisherStrand extends InfoFieldAnnotation implements StandardAnnotat
final ReadBackedPileup pileup = context.getBasePileup();
for ( final PileupElement p : pileup ) {
- if ( p.getRead().isReducedRead() ) // ignore reduced reads
- continue;
- if ( p.getRead().getMappingQuality() < 20 )
+ if ( ! RankSumTest.isUsableBase(p, true) || p.getRead().isReducedRead() ) // ignore reduced reads
continue;
if ( indelLikelihoodMap.containsKey(p) ) {
// to classify a pileup element as ref or alt, we look at the likelihood associated with the allele associated to this element.
diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java
index bf66958e0..1955c87b8 100644
--- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java
@@ -149,9 +149,28 @@ public abstract class RankSumTest extends InfoFieldAnnotation implements ActiveR
protected abstract void fillIndelQualsFromPileup(final ReadBackedPileup pileup, final List refQuals, final List altQuals);
- protected static boolean isUsableBase(final PileupElement p) {
+ /**
+ * Can the base in this pileup element be used in comparative tests between ref / alt bases?
+ *
+ * Note that this function by default does not allow deletion pileup elements
+ *
+ * @param p the pileup element to consider
+ * @return true if this base is part of a meaningful read for comparison, false otherwise
+ */
+ public static boolean isUsableBase(final PileupElement p) {
+ return isUsableBase(p, false);
+ }
+
+ /**
+ * Can the base in this pileup element be used in comparative tests between ref / alt bases?
+ *
+ * @param p the pileup element to consider
+ * @param allowDeletions if true, allow p to be a deletion base
+ * @return true if this base is part of a meaningful read for comparison, false otherwise
+ */
+ public static boolean isUsableBase(final PileupElement p, final boolean allowDeletions) {
return !(p.isInsertionAtBeginningOfRead() ||
- p.isDeletion() ||
+ (! allowDeletions && p.isDeletion()) ||
p.getMappingQual() == 0 ||
p.getMappingQual() == QualityUtils.MAPPING_QUALITY_UNAVAILABLE ||
((int) p.getQual()) < QualityUtils.MIN_USABLE_Q_SCORE); // need the unBAQed quality score here
diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/BaseQualityScoreRecalibrator.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/BaseQualityScoreRecalibrator.java
index 1a99d51e6..8210a11b7 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/BaseQualityScoreRecalibrator.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/BaseQualityScoreRecalibrator.java
@@ -34,8 +34,7 @@ import org.broadinstitute.sting.gatk.filters.MappingQualityZeroFilter;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.utils.baq.BAQ;
-import org.broadinstitute.sting.utils.classloader.PluginManager;
-import org.broadinstitute.sting.utils.classloader.ProtectedPackageSource;
+import org.broadinstitute.sting.utils.classloader.GATKLiteUtils;
import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException;
@@ -179,27 +178,15 @@ public class BaseQualityScoreRecalibrator extends LocusWalker implem
}
private RecalibrationEngine initializeRecalibrationEngine() {
- List> REclasses = new PluginManager(RecalibrationEngine.class).getPlugins();
- if ( REclasses.isEmpty() )
- throw new ReviewedStingException("The RecalibrationEngine class is not found; repository must be corrupted");
-
- Class c = null;
- for ( Class extends RecalibrationEngine> REclass : REclasses ) {
- if ( ProtectedPackageSource.class.isAssignableFrom(REclass) ) {
- c = REclass;
- break;
- }
- }
- if ( c == null )
- c = REclasses.get(0);
+ final Class recalibrationEngineClass = GATKLiteUtils.getProtectedClassIfAvailable(RecalibrationEngine.class);
try {
- Constructor constructor = c.getDeclaredConstructor((Class[])null);
+ Constructor constructor = recalibrationEngineClass.getDeclaredConstructor((Class[])null);
constructor.setAccessible(true);
return (RecalibrationEngine)constructor.newInstance();
}
catch (Exception e) {
- throw new ReviewedStingException("Unable to create RecalibrationEngine class instance " + c.getSimpleName());
+ throw new ReviewedStingException("Unable to create RecalibrationEngine class instance " + recalibrationEngineClass.getSimpleName());
}
}
diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsCalculationModel.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsCalculationModel.java
index 84467085b..4253ff3ad 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsCalculationModel.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsCalculationModel.java
@@ -48,7 +48,7 @@ import java.util.Map;
public abstract class GenotypeLikelihoodsCalculationModel implements Cloneable {
public static final String DUMMY_LANE = "Lane1";
- public static final String DUMMY_POOL = "Pool1";
+ public static final String DUMMY_SAMPLE_NAME = "DummySample1";
/* public enum Model {
SNP,
diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java
index ac7c370bf..c767cf783 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java
@@ -35,7 +35,6 @@ import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.baq.BAQ;
-import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.pileup.PileupElement;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
@@ -43,7 +42,6 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedPileupImpl;
import org.broadinstitute.sting.utils.variantcontext.*;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -68,9 +66,11 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC
final byte refBase = ref.getBase();
final int indexOfRefBase = BaseUtils.simpleBaseToBaseIndex(refBase);
+ // handle non-standard reference bases
+ if ( indexOfRefBase == -1 )
+ return null;
final Allele refAllele = Allele.create(refBase, true);
-
// calculate the GLs
ArrayList GLs = new ArrayList(contexts.size());
for ( Map.Entry sample : contexts.entrySet() ) {
diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java
index 31a2dfd77..d504badab 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java
@@ -25,10 +25,8 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
-import net.sf.samtools.SAMReadGroupRecord;
import org.broadinstitute.sting.commandline.*;
import org.broadinstitute.sting.gatk.DownsampleType;
-import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.arguments.DbsnpArgumentCollection;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
@@ -40,6 +38,7 @@ import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotatorEngine;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotatorCompatibleWalker;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.baq.BAQ;
+import org.broadinstitute.sting.utils.classloader.GATKLiteUtils;
import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
import org.broadinstitute.sting.utils.exceptions.UserException;
@@ -226,7 +225,7 @@ public class UnifiedGenotyper extends LocusWalker, Unif
public void initialize() {
// Check for protected modes
- if (getToolkit().isGATKLite()) {
+ if (GATKLiteUtils.isGATKLite()) {
// no polyploid/pooled mode in GATK Like
if (UAC.samplePloidy != VariantContextUtils.DEFAULT_PLOIDY ||
UAC.referenceSampleName != null ||
@@ -240,7 +239,7 @@ public class UnifiedGenotyper extends LocusWalker, Unif
// in full mode: check for consistency in ploidy/pool calling arguments
// check for correct calculation models
if (UAC.samplePloidy != VariantContextUtils.DEFAULT_PLOIDY) {
- // polyploidy required POOL GL and AF calculation models to be specified right now
+ // polyploidy requires POOL GL and AF calculation models to be specified right now
if (UAC.GLmodel != GenotypeLikelihoodsCalculationModel.Model.POOLSNP && UAC.GLmodel != GenotypeLikelihoodsCalculationModel.Model.POOLINDEL
&& UAC.GLmodel != GenotypeLikelihoodsCalculationModel.Model.POOLBOTH) {
throw new UserException("Incorrect genotype calculation model chosen. Only [POOLSNP|POOLINDEL|POOLBOTH] supported with this walker if sample ploidy != 2");
@@ -253,7 +252,7 @@ public class UnifiedGenotyper extends LocusWalker, Unif
// get all of the unique sample names
if (UAC.TREAT_ALL_READS_AS_SINGLE_POOL) {
samples.clear();
- samples.add(GenotypeLikelihoodsCalculationModel.DUMMY_POOL);
+ samples.add(GenotypeLikelihoodsCalculationModel.DUMMY_SAMPLE_NAME);
} else {
samples = SampleUtils.getSAMFileSamples(getToolkit().getSAMFileHeader());
if (UAC.referenceSampleName != null )
diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/ValidationReport.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/ValidationReport.java
index e36c2f294..a2bcdaf1d 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/ValidationReport.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/ValidationReport.java
@@ -11,6 +11,7 @@ import org.broadinstitute.sting.utils.variantcontext.Allele;
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import java.util.Collection;
+import java.util.Set;
/**
* The Broad Institute
@@ -102,6 +103,10 @@ public class ValidationReport extends VariantEvaluator implements StandardEval {
nDifferentAlleleSites++;
else {
SiteStatus evalStatus = calcSiteStatus(eval);
+ final Set evalSamples = getWalker().getSampleNamesForEvaluation();
+ if ( comp.hasGenotypes() && ! evalSamples.isEmpty() && comp.hasGenotypes(evalSamples) )
+ // if we have genotypes in both eval and comp, subset comp down just the samples in eval
+ comp = comp.subContextFromSamples(evalSamples, false);
SiteStatus compStatus = calcSiteStatus(comp);
counts[compStatus.ordinal()][evalStatus.ordinal()]++;
}
@@ -111,7 +116,7 @@ public class ValidationReport extends VariantEvaluator implements StandardEval {
//
// helper routines
//
- public SiteStatus calcSiteStatus(VariantContext vc) {
+ private SiteStatus calcSiteStatus(VariantContext vc) {
if ( vc == null ) return SiteStatus.NO_CALL;
if ( vc.isFiltered() ) return SiteStatus.FILTERED;
if ( vc.isMonomorphicInSamples() ) return SiteStatus.MONO;
@@ -121,24 +126,18 @@ public class ValidationReport extends VariantEvaluator implements StandardEval {
int ac = 0;
if ( vc.getNAlleles() > 2 ) {
return SiteStatus.POLY;
-//// System.out.printf("multiple alleles %s = %s%n", vc.getAlleles(), vc.getExtendedAttribute(VCFConstants.ALLELE_COUNT_KEY));
-// // todo -- omg this is painful. We need a better approach to dealing with multi-valued attributes
-// for ( String v : (List)vc.getExtendedAttribute(VCFConstants.ALLELE_COUNT_KEY) )
-// ac += Integer.valueOf(v);
-//// System.out.printf(" ac = %d%n", ac);
}
else
ac = vc.getAttributeAsInt(VCFConstants.ALLELE_COUNT_KEY, 0);
return ac > 0 ? SiteStatus.POLY : SiteStatus.MONO;
} else {
return TREAT_ALL_SITES_IN_EVAL_VCF_AS_CALLED ? SiteStatus.POLY : SiteStatus.NO_CALL; // we can't figure out what to do
- //return SiteStatus.NO_CALL; // we can't figure out what to do
}
}
- public boolean haveDifferentAltAlleles(VariantContext eval, VariantContext comp) {
+ private boolean haveDifferentAltAlleles(VariantContext eval, VariantContext comp) {
Collection evalAlts = eval.getAlternateAlleles();
Collection compAlts = comp.getAlternateAlleles();
if ( evalAlts.size() != compAlts.size() ) {
diff --git a/public/java/src/org/broadinstitute/sting/utils/classloader/GATKLiteUtils.java b/public/java/src/org/broadinstitute/sting/utils/classloader/GATKLiteUtils.java
new file mode 100755
index 000000000..db9b9d8b7
--- /dev/null
+++ b/public/java/src/org/broadinstitute/sting/utils/classloader/GATKLiteUtils.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2010 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.sting.utils.classloader;
+
+import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
+
+import java.util.*;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ebanks
+ *
+ * A set of static utility methods for working with the full vs. Lite GATK build
+ */
+public class GATKLiteUtils {
+ /**
+ * Constructor access disallowed...static utility methods only!
+ */
+ private GATKLiteUtils() { }
+
+ /**
+ * Utility method to determine whether this is the lite version of the GATK
+ */
+ public static boolean isGATKLite() {
+ if ( isLiteVersion == null ) {
+ try {
+ Class.forName(DummyProtectedClassName);
+ isLiteVersion = false;
+ } catch ( ClassNotFoundException e) {
+ isLiteVersion = true;
+ }
+ }
+ return isLiteVersion;
+ }
+ private static final String DummyProtectedClassName = "org.broadinstitute.sting.gatk.DummyProtectedClass";
+ private static Boolean isLiteVersion = null;
+
+
+ /**
+ * Utility method to pull out a protected subclass if possible, otherwise it falls back to a public subclass.
+ * Important note: the protected classes MUST implement ProtectedPackageSource!
+ *
+ * @param interfaceClass the interface class which the target classes implement
+ */
+ public static Class getProtectedClassIfAvailable(final Class interfaceClass) {
+ List> classes = new PluginManager