From c59c8b9872538edd24338ed276d5f9d07f0a4439 Mon Sep 17 00:00:00 2001 From: ebanks Date: Wed, 23 Feb 2011 21:05:20 +0000 Subject: [PATCH] Phase I of my promise to Mark: fleshed out integration tests for Indel Realigner git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5297 348d0f76-0448-11de-a6fe-93d51630548a --- .../UnifiedGenotyperIntegrationTest.java | 3 +- .../indels/IndelRealignerIntegrationTest.java | 98 +++++++++++++++---- 2 files changed, 80 insertions(+), 21 deletions(-) diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java index e60ee4f43..459851a19 100755 --- a/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java @@ -13,8 +13,7 @@ import java.util.Map; // Note that this class also serves as an integration test for the VariantAnnotator! // // ********************************************************************************** // -public class - UnifiedGenotyperIntegrationTest extends WalkerTest { +public class UnifiedGenotyperIntegrationTest extends WalkerTest { private final static String baseCommand = "-T UnifiedGenotyper -R " + b36KGReference + " -NO_HEADER"; diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/indels/IndelRealignerIntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/indels/IndelRealignerIntegrationTest.java index 970c1a806..59be4fa09 100755 --- a/java/test/org/broadinstitute/sting/gatk/walkers/indels/IndelRealignerIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/indels/IndelRealignerIntegrationTest.java @@ -4,36 +4,96 @@ import org.broadinstitute.sting.WalkerTest; import org.testng.annotations.Test; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; public class IndelRealignerIntegrationTest extends WalkerTest { + private static final String mainTestBam = validationDataLocation + "indelRealignerTest.pilot1.ceu.bam"; + private static final String mainTestIntervals = validationDataLocation + "indelRealignerTest.pilot1.ceu.intervals"; + private static final String knownIndels = validationDataLocation + "indelRealignerTest.pilot1.ceu.vcf"; + private static final String baseCommandPrefix = "-T IndelRealigner -noPG -R " + b36KGReference + " -I " + mainTestBam + " -targetIntervals " + mainTestIntervals + " -compress 0 -L 20:49,500-55,500 --sortInCoordinateOrderEvenThoughItIsHighlyUnsafe "; + private static final String baseCommand = baseCommandPrefix + "-o %s "; + @Test - public void testRealignerLod5() { - String[] md5s = {"a377de4e2eb4df8ef79590e4131afe35", "c4ef635f2597b12b93a73199f07e509b"}; - WalkerTestSpec spec = new WalkerTestSpec( - "-T IndelRealigner -noPG -LOD 5 -maxConsensuses 100 -greedy 100 -R " + b36KGReference + " -I " + validationDataLocation + "NA12878.chrom1.SLX.SRP000032.2009_06.bam -L 1:10023000-10030000 -compress 1 -targetIntervals " + validationDataLocation + "cleaner.test.intervals -o %s -stats %s --sortInCoordinateOrderEvenThoughItIsHighlyUnsafe", - 2, - Arrays.asList(md5s)); - executeTest("test realigner lod5", spec); + public void testDefaults() { + String md5 = "20ff8b76d834a8aaca46405e8328d258"; + + WalkerTestSpec spec1 = new WalkerTestSpec( + baseCommand, + 1, + Arrays.asList(md5)); + executeTest("test realigner defaults", spec1); + + WalkerTestSpec spec2 = new WalkerTestSpec( + baseCommand + "-B:indels,vcf " + knownIndels, + 1, + Arrays.asList(md5)); + executeTest("test realigner defaults with VCF", spec2); + + WalkerTestSpec spec3 = new WalkerTestSpec( + baseCommand + "-D " + GATKDataLocation + "dbsnp_129_b36.rod", + 1, + Arrays.asList(md5)); + executeTest("realigner defaults with dbsnp", spec3); + } @Test - public void testRealignerLod50() { - String[] md5s = {"a377de4e2eb4df8ef79590e4131afe35", "3735a510513b6fa4161d92155e026283"}; + public void testStats() { WalkerTestSpec spec = new WalkerTestSpec( - "-T IndelRealigner -noPG -LOD 50 -maxConsensuses 100 -greedy 100 -R " + b36KGReference + " -I " + validationDataLocation + "NA12878.chrom1.SLX.SRP000032.2009_06.bam -L 1:10023000-10030000 -compress 1 -targetIntervals " + validationDataLocation + "cleaner.test.intervals -o %s -stats %s --sortInCoordinateOrderEvenThoughItIsHighlyUnsafe", - 2, - Arrays.asList(md5s)); - executeTest("test realigner lod50", spec); + baseCommandPrefix + "-stats %s -o /dev/null", + 1, + Arrays.asList("ed5a207ddf5bdda4bb76899fb3eae35c")); + executeTest("realigner stats", spec); + } @Test - public void testRealignerKnownsOnly() { - String[] md5s = {"654cb0c845c3f25af6a3f8911ac06a73", "74652bd8240291293ec921f8ecfa1622"}; + public void testLods() { + HashMap e = new HashMap(); + e.put( "-LOD 60", "20ff8b76d834a8aaca46405e8328d258" ); + e.put( "-LOD 1", "39862f48d9eaaf841ca4a0d2c05c4187" ); + + for ( Map.Entry entry : e.entrySet() ) { + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + baseCommand + entry.getKey(), + 1, + Arrays.asList(entry.getValue())); + executeTest(String.format("realigner [%s]", entry.getKey()), spec); + } + } + + @Test + public void testKnownsOnly() { + WalkerTestSpec spec1 = new WalkerTestSpec( + baseCommand + "-knownsOnly -B:indels,vcf " + knownIndels, + 1, + Arrays.asList("1218d3c8fbd50581af5815938d6c0070")); + executeTest("realigner known indels only from VCF", spec1); + + WalkerTestSpec spec2 = new WalkerTestSpec( + baseCommand + "-knownsOnly -D " + GATKDataLocation + "dbsnp_129_b36.rod", + 1, + Arrays.asList("848740b201adc5c45bf82384c1f19d4d")); + executeTest("realigner known indels only from dbsnp", spec2); + } + + @Test + public void testNoTags() { WalkerTestSpec spec = new WalkerTestSpec( - "-T IndelRealigner -noPG -LOD 1.0 -R " + b36KGReference + " -I " + validationDataLocation + "NA12878.chrom1.SLX.SRP000032.2009_06.bam -L 1:10023000-10076000 -compress 1 -targetIntervals " + validationDataLocation + "NA12878.indels.intervals -B:knownIndels,VCF " + validationDataLocation + "NA12878.indels.vcf4 -o %s -stats %s --sortInCoordinateOrderEvenThoughItIsHighlyUnsafe -knownsOnly", - 2, - Arrays.asList(md5s)); - executeTest("test realigner known indels only", spec); + baseCommand + "--noOriginalAlignmentTags", + 1, + Arrays.asList("00e009c97905f4fa89e3102261a1fd57")); + executeTest("realigner no output tags", spec); + } + + @Test + public void testLongRun() { + WalkerTestSpec spec = new WalkerTestSpec( + "-T IndelRealigner -noPG -R " + b36KGReference + " -I " + validationDataLocation + "NA12878.chrom1.SLX.SRP000032.2009_06.bam -L 1:10,000,000-11,000,000 -targetIntervals " + validationDataLocation + "indelRealignerTest.NA12878.chrom1.intervals -compress 0 --sortInCoordinateOrderEvenThoughItIsHighlyUnsafe -o %s", + 1, + Arrays.asList("")); + executeTest("realigner long run", spec); } }