diff --git a/java/test/org/broadinstitute/sting/WalkerTest.java b/java/test/org/broadinstitute/sting/WalkerTest.java index eebddae1d..84ce40029 100755 --- a/java/test/org/broadinstitute/sting/WalkerTest.java +++ b/java/test/org/broadinstitute/sting/WalkerTest.java @@ -40,14 +40,8 @@ import java.io.File; import java.util.*; public class WalkerTest extends BaseTest { - // the default output path for the integration test - private File outputFileLocation = null; private static final boolean ENABLE_REPORTING = false; - public void setOutputFileLocation(File outputFileLocation) { - this.outputFileLocation = outputFileLocation; - } - public String assertMatchingMD5(final String name, final File resultsFile, final String expectedMD5) { return assertMatchingMD5(name, resultsFile, expectedMD5, parameterize()); } @@ -84,6 +78,9 @@ public class WalkerTest extends BaseTest { List exts = null; Class expectedException = null; + // the default output path for the integration test + private File outputFileLocation = null; + protected Map auxillaryFiles = new HashMap(); public WalkerTestSpec(String args, List md5s) { @@ -113,6 +110,14 @@ public class WalkerTest extends BaseTest { this.expectedException = expectedException; } + public void setOutputFileLocation(File outputFileLocation) { + this.outputFileLocation = outputFileLocation; + } + + protected File getOutputFileLocation() { + return outputFileLocation; + } + public boolean expectsException() { return expectedException != null; } @@ -125,6 +130,7 @@ public class WalkerTest extends BaseTest { public void addAuxFile(String expectededMD5sum, File outputfile) { auxillaryFiles.put(expectededMD5sum, outputfile); } + } protected boolean parameterize() { @@ -163,7 +169,7 @@ public class WalkerTest extends BaseTest { if ( spec.expectsException() ) { // this branch handles the case were we are testing that a walker will fail as expected - return executeTest(name, null, tmpFiles, args, spec.getExpectedException()); + return executeTest(name, spec.getOutputFileLocation(), null, tmpFiles, args, spec.getExpectedException()); } else { List md5s = new LinkedList(); md5s.addAll(spec.md5s); @@ -173,7 +179,7 @@ public class WalkerTest extends BaseTest { md5s.add(md5); tmpFiles.add(spec.auxillaryFiles.get(md5)); } - return executeTest(name, md5s, tmpFiles, args, null); + return executeTest(name, spec.getOutputFileLocation(), md5s, tmpFiles, args, null); } } @@ -186,9 +192,9 @@ public class WalkerTest extends BaseTest { * @param expectedException the expected exception or null * @return a pair of file and string lists */ - private Pair, List> executeTest(String name, List md5s, List tmpFiles, String args, Class expectedException) { + private Pair, List> executeTest(String name, File outputFileLocation, List md5s, List tmpFiles, String args, Class expectedException) { if (outputFileLocation != null) - args += " -o " + this.outputFileLocation.getAbsolutePath(); + args += " -o " + outputFileLocation.getAbsolutePath(); executeTest(name, args, expectedException); if ( expectedException != null ) { diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageB36IntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageB36IntegrationTest.java index 8b3fc7324..e86a241d5 100644 --- a/java/test/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageB36IntegrationTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageB36IntegrationTest.java @@ -50,10 +50,6 @@ public class DepthOfCoverageB36IntegrationTest extends WalkerTest { @Test public void testMapQ0Only() { - // our base file - File baseOutputFile = this.createTempFile("depthofcoveragemapq0",".tmp"); - this.setOutputFileLocation(baseOutputFile); - String[] intervals = {"1:10,000,000-10,002,000","1:10,003,000-10,004,000"}; String[] bams = {"/humgen/gsa-hpprojects/GATK/data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.allTechs.bam"}; @@ -61,6 +57,10 @@ public class DepthOfCoverageB36IntegrationTest extends WalkerTest { WalkerTestSpec spec = new WalkerTestSpec(cmd,0,new ArrayList()); + // our base file + File baseOutputFile = this.createTempFile("depthofcoveragemapq0",".tmp"); + + spec.setOutputFileLocation(baseOutputFile); spec.addAuxFile("f39af6ad99520fd4fb27b409ab0344a0",baseOutputFile); spec.addAuxFile("6b15f5330414b6d4e2f6caea42139fa1", createTempFileFromBase(baseOutputFile.getAbsolutePath()+".sample_cumulative_coverage_counts")); spec.addAuxFile("cc6640d82077991dde8a2b523935cdff", createTempFileFromBase(baseOutputFile.getAbsolutePath()+".sample_cumulative_coverage_proportions")); @@ -74,14 +74,15 @@ public class DepthOfCoverageB36IntegrationTest extends WalkerTest { @Test public void testLotsOfSamples() { - File baseOutputFile = this.createTempFile("testManySamples",".tmp"); - this.setOutputFileLocation(baseOutputFile); String[] intervals = {"1:1105290-1105295"}; String[] bams = {"/humgen/gsa-hpprojects/GATK/data/Validation_Data/pilot3.CEU+TSI.5loci.bam"}; String cmd = buildRootCmd(b36KGReference, new ArrayList(Arrays.asList(bams)), new ArrayList(Arrays.asList(intervals))); WalkerTestSpec spec = new WalkerTestSpec(cmd,0,new ArrayList()); + File baseOutputFile = this.createTempFile("testManySamples",".tmp"); + + spec.setOutputFileLocation(baseOutputFile); spec.addAuxFile("c9561b52344536d2b06ab97b0bb1a234",baseOutputFile); execute("testLotsOfSamples",spec); diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageIntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageIntegrationTest.java index 74c990c44..216753be9 100644 --- a/java/test/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageIntegrationTest.java @@ -44,16 +44,16 @@ public class DepthOfCoverageIntegrationTest extends WalkerTest { @Test public void testBaseOutputNoFiltering() { - // our base file - File baseOutputFile = this.createTempFile("depthofcoveragenofiltering",".tmp"); - this.setOutputFileLocation(baseOutputFile); - String[] intervals = {"/humgen/gsa-hpprojects/GATK/data/Validation_Data/fhs_jhs_30_targts.interval_list"}; String[] bams = {"/humgen/gsa-hpprojects/GATK/data/Validation_Data/FHS_indexed_subset.bam"}; String cmd = buildRootCmd(hg18Reference,new ArrayList(Arrays.asList(bams)),new ArrayList(Arrays.asList(intervals))) + " -mmq 0 -mbq 0 -dels -baseCounts -pt readgroup -pt sample -pt library --outputFormat csv -ct 10 -ct 15 -ct 20 -ct 25"; WalkerTestSpec spec = new WalkerTestSpec(cmd,0, new ArrayList()); + // our base file + File baseOutputFile = this.createTempFile("depthofcoveragenofiltering",".tmp"); + spec.setOutputFileLocation(baseOutputFile); + // now add the expected files that get generated spec.addAuxFile("423571e4c05e7934322172654ac6dbb7", baseOutputFile); spec.addAuxFile("9df5e7e07efeb34926c94a724714c219", createTempFileFromBase(baseOutputFile.getAbsolutePath()+".library_cumulative_coverage_counts")); @@ -80,15 +80,15 @@ public class DepthOfCoverageIntegrationTest extends WalkerTest { @Test public void testNoCoverageDueToFiltering() { - File baseOutputFile = this.createTempFile("depthofcoveragenofiltering",".tmp"); - this.setOutputFileLocation(baseOutputFile); - String[] intervals = {"/humgen/gsa-hpprojects/GATK/data/Validation_Data/fhs_jhs_30_targts.interval_list"}; String[] bams = {"/humgen/gsa-hpprojects/GATK/data/Validation_Data/FHS_indexed_subset.bam"}; String cmd = buildRootCmd(hg18Reference,new ArrayList(Arrays.asList(bams)),new ArrayList(Arrays.asList(intervals))) + " -mmq 0 -mbq 5 --maxBaseQuality 4 -dels -baseCounts -pt readgroup -pt sample -pt library --outputFormat csv"; WalkerTestSpec spec = new WalkerTestSpec(cmd,0, new ArrayList()); + File baseOutputFile = this.createTempFile("depthofcoveragenofiltering",".tmp"); + spec.setOutputFileLocation(baseOutputFile); + spec.addAuxFile("6ccd7d8970ba98cb95fe41636a070c1c",baseOutputFile); spec.addAuxFile("0ee40f3e5091536c14e077b77557083a",createTempFileFromBase(baseOutputFile.getAbsolutePath()+".library_interval_summary")); diff --git a/java/test/org/broadinstitute/sting/utils/interval/IntervalIntegrationTest.java b/java/test/org/broadinstitute/sting/utils/interval/IntervalIntegrationTest.java index 1013417cc..ecf8c475c 100644 --- a/java/test/org/broadinstitute/sting/utils/interval/IntervalIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/utils/interval/IntervalIntegrationTest.java @@ -75,7 +75,7 @@ public class IntervalIntegrationTest extends WalkerTest { // our base file File baseOutputFile = createTempFile("testUnmappedReadInclusion",".bam"); - this.setOutputFileLocation(baseOutputFile); + spec.setOutputFileLocation(baseOutputFile); spec.addAuxFile("fcd11cfa8474472c617d400623a30fcd",createTempFileFromBase(baseOutputFile.getAbsolutePath())); spec.addAuxFile("3d1f077727e6b68e20a2095d034e56d7", createTempFileFromBase(baseOutputFile.getAbsolutePath().substring(0,baseOutputFile.getAbsolutePath().indexOf(".bam"))+".bai")); @@ -95,7 +95,7 @@ public class IntervalIntegrationTest extends WalkerTest { // our base file File baseOutputFile = createTempFile("testUnmappedReadExclusion",".bam"); - this.setOutputFileLocation(baseOutputFile); + spec.setOutputFileLocation(baseOutputFile); spec.addAuxFile("3153593c9f9ff80a8551fff5655e65ec",createTempFileFromBase(baseOutputFile.getAbsolutePath())); spec.addAuxFile("7fc574ac72211623e4df74d9f75a4e48", createTempFileFromBase(baseOutputFile.getAbsolutePath().substring(0,baseOutputFile.getAbsolutePath().indexOf(".bam"))+".bai"));