From df8ea8f43789ab7f8abaa7de5626c34d340cba5b Mon Sep 17 00:00:00 2001 From: ebanks Date: Thu, 8 Oct 2009 17:43:58 +0000 Subject: [PATCH] UG integration test. This was the old SSG test with MD5s updated. I'll need to add some multi-sample tests in a bit... git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1791 348d0f76-0448-11de-a6fe-93d51630548a --- .../UnifiedGenotyperIntegrationTest.java | 190 ++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100755 java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java new file mode 100755 index 000000000..c0bab2ac6 --- /dev/null +++ b/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java @@ -0,0 +1,190 @@ +package org.broadinstitute.sting.gatk.walkers.genotyper; + +import org.broadinstitute.sting.WalkerTest; +import org.junit.Test; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +public class UnifiedGenotyperIntegrationTest extends WalkerTest { + public static String baseTestString() { + return "-T UnifiedGenotyper -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s"; + } + + public static String testGeliLod5() { + return baseTestString() + " --variant_output_format GELI -lod 5"; + } + + private static String OneMb1StateMD5 = "7e3fc1d8427329eb2a3e05a81011749a"; + private static String OneMb3StateMD5 = "f5912d5d6585436a77495688f09cf1cc"; + private static String OneMbEmpiricalMD5 = "b9b2d9c7eb9a7af416fddd3b77a72efe"; + +// private static String oneMbMD5(BaseMismatchModel m) { +// switch (m) { +// case ONE_STATE: return OneMb1StateMD5; +// case THREE_STATE: return OneMb3StateMD5; +// case EMPIRICAL: return OneMbEmpiricalMD5; +// default: throw new RuntimeException("Unexpected BaseMismatchModel " + m); +// } +// } + + // Uncomment to not check outputs against expectations + //protected boolean parameterize() { + // return true; + //} + + // -------------------------------------------------------------------------------------------------------------- + // + // testing calls with SLX, 454, and SOLID data + // + // -------------------------------------------------------------------------------------------------------------- + @Test + public void testMultiTechnologies() { + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + "-T UnifiedGenotyper" + + " -R /broad/1KG/reference/human_b36_both.fasta" + + " -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.allTechs.bam" + + " -varout %s" + + " -L 1:10,000,000-10,100,000" + + " -bm empirical", + 1, + Arrays.asList("f490a407c9c62d43eb83107e83c858f6")); + + executeTest(String.format("testMultiTechnologies"), spec); + } + + // -------------------------------------------------------------------------------------------------------------- + // + // testing the cache + // + // -------------------------------------------------------------------------------------------------------------- + /* + @Test + public void testCache() { + for ( BaseMismatchModel model : BaseMismatchModel.values() ) { + // calculated the expected value without the cache enabled + WalkerTest.WalkerTestSpec withoutCacheSpec = new WalkerTest.WalkerTestSpec( + testGeliLod5() + " -L 1:10,000,000-10,100,000 --disableCache -m " + model.toString(), 1, + Arrays.asList("")); + List withoutCache = executeTest("empirical1MbTest", withoutCacheSpec ).getSecond(); + + WalkerTest.WalkerTestSpec withCacheSpec = new WalkerTest.WalkerTestSpec( + testGeliLod5() + " -L 1:10,000,000-10,100,000 -bm " + model.toString(), 1, + withoutCache); + executeTest(String.format("testCache[%s]", model), withCacheSpec ); + } + } + */ + + // -------------------------------------------------------------------------------------------------------------- + // + // testing genotype mode + // + // -------------------------------------------------------------------------------------------------------------- + @Test + public void genotypeTest() { + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + testGeliLod5() + " -L 1:10,000,000-10,100,000 -bm empirical --genotype", 1, + Arrays.asList("6a930a8f115495f5319541c21a892d8e")); + executeTest("genotypeTest", spec); + } + + // -------------------------------------------------------------------------------------------------------------- + // + // basic base calling models + // + // -------------------------------------------------------------------------------------------------------------- + + @Test + public void oneState100bpTest() { + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( testGeliLod5() + " -L 1:10,000,000-10,000,100 -bm one_state", 1, Arrays.asList("3cd402d889c015be4a318123468f4262")); + executeTest("oneState100bpTest", spec); + } + + @Test + public void oneState1MbTest() { + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + testGeliLod5() + " -L 1:10,000,000-11,000,000 -bm one_state", + 1, Arrays.asList(OneMb1StateMD5)); + executeTest("oneState1MbTest", spec); + } + + @Test + public void threeState1MbTest() { + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + testGeliLod5() + " -L 1:10,000,000-11,000,000 -bm three_state", 1, + Arrays.asList(OneMb3StateMD5)); + executeTest("threeState1MbTest", spec); + } + + @Test + public void empirical1MbTest() { + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + testGeliLod5() + " -L 1:10,000,000-11,000,000 -bm empirical", 1, + Arrays.asList(OneMbEmpiricalMD5)); + executeTest("empirical1MbTest", spec); + } + + + + // -------------------------------------------------------------------------------------------------------------- + // + // testing output formats + // + // -------------------------------------------------------------------------------------------------------------- + + //@Argument(fullName = "variant_output_format", shortName = "vf", doc = "File format to be used", required = false) + //public GenotypeWriterFactory.GENOTYPE_FORMAT VAR_FORMAT = GenotypeWriterFactory.GENOTYPE_FORMAT.GELI; + + // -------------------------------------------------------------------------------------------------------------- + // + // testing LOD thresholding + // + // -------------------------------------------------------------------------------------------------------------- + @Test + public void testLOD() { + HashMap e = new HashMap(); + e.put( 10.0, "94c5b48c0c956fcdacbffaa38a80d926" ); + e.put( 3.0, "f1f53b944b821f05d5dd1ad8fda2f57b" ); + + for ( Map.Entry entry : e.entrySet() ) { + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + baseTestString() + " --variant_output_format GELI -L 1:10,000,000-11,000,000 -bm EMPIRICAL -lod " + entry.getKey(), 1, + Arrays.asList(entry.getValue())); + executeTest("testLOD", spec); + } + } + + // -------------------------------------------------------------------------------------------------------------- + // + // testing hetero setting + // + // -------------------------------------------------------------------------------------------------------------- + @Test + public void testHeterozyosity() { + HashMap e = new HashMap(); + e.put( 0.01, "953fe510a81e357d0b56feac2a90095d" ); + e.put( 0.0001, "ef0f2af7d13f166829d86b15fabc2b81" ); + e.put( 1.0 / 1850, "a435c8c966c11f4393a25a9d01c4fc3d" ); + + for ( Map.Entry entry : e.entrySet() ) { + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + testGeliLod5() + " -L 1:10,000,000-11,000,000 -bm EMPIRICAL --heterozygosity " + entry.getKey(), 1, + Arrays.asList(entry.getValue())); + executeTest(String.format("testHeterozyosity[%s]", entry.getKey()), spec); + } + } + + /** + * test the output of a binary geli file + */ + @Test + public void empirical1MbTestBinaryGeli() { + WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + baseTestString() + " -L 1:10,000,000-11,000,000 -bm empirical --variant_output_format GELI_BINARY -lod 5", 1, + Arrays.asList("915abf82a04fcd1842f6865501bae67c")); + executeTest("empirical1MbTestBinaryGeli", spec); + } + +}