11package org .broadinstitute .hellbender ;
22
3+ import htsjdk .beta .plugin .IOUtils ;
4+ import htsjdk .io .IOPath ;
35import org .apache .commons .lang3 .tuple .Pair ;
6+ import org .broadinstitute .hellbender .engine .GATKPath ;
47import org .broadinstitute .hellbender .testutils .ArgumentsBuilder ;
58import org .broadinstitute .hellbender .testutils .IntegrationTestSpec ;
69import org .testng .annotations .DataProvider ;
@@ -14,11 +17,12 @@ public class PrintFileDiagnosticsIntegrationTest extends CommandLineProgramTest
1417
1518 @ DataProvider (name = "fileDiagnosticsTestCases" )
1619 public Object [][] getFileDiagnosticsTestCases () {
20+ // the pathnames used by the diagnostics tool wind up embedded in the diagnostics output file, so for these
21+ // tests use just a relative pathname as input (instead of the named constants, i.e., NA12878_20_21_WGS_cram,
22+ // which are full path names) in order to avoid test failures caused by the full pathname varying in
23+ // different environments, i.e. in CI
1724 return new Object [][]{
1825 {
19- //this pathname is embedded in the diagnostics output file, so we use a relative pathname
20- // instead of the named constant NA12878_20_21_WGS_cram in order to avoid test failures
21- // caused by the full pathname varying in different environments
2226 "src/test/resources/large/CEUTrio.HiSeq.WGS.b37.NA12878.20.21.v3.0.samtools.cram" ,
2327 List .of (Pair .of ("count-limit" , "10" )),
2428 "src/test/resources/filediagnostics/CEUTrio.HiSeq.WGS.b37.NA12878.20.21.txt"
@@ -33,6 +37,12 @@ public Object[][] getFileDiagnosticsTestCases() {
3337 null ,
3438 "src/test/resources/filediagnostics/cram_with_crai_index.cram.crai.txt"
3539 },
40+ {
41+ // cram file that uses all the new 3.1 codecs (fqzcomp, name tok, ransNx16, and adaptive arithmetic)
42+ "src/test/resources/large/CEUTrio.HiSeq.WGS.b37.NA12878.20.21.v3.1.samtools.archive.cram" ,
43+ List .of (Pair .of ("count-limit" , "20" )),
44+ "src/test/resources/filediagnostics/CEUTrio.HiSeq.WGS.b37.NA12878.20.21.v3.1.samtools.archive.cram.txt"
45+ }
3646 };
3747 }
3848
@@ -41,15 +51,22 @@ public void testFileDiagnostics(
4151 final String inputPath ,
4252 final List <Pair <String , String >> extraArgs ,
4353 final String expectedOutputPath ) throws IOException {
44- final File outFile = createTempFile ("testFileDiagnostics" , ".txt" );
45- ArgumentsBuilder argBuilder = new ArgumentsBuilder ();
46- argBuilder .addInput (inputPath );
47- argBuilder .addOutput (outFile );
54+ final IOPath outFile = IOUtils .createTempPath ("testFileDiagnostics" , ".txt" );
55+ runFileDiagnosticsTool (new GATKPath (inputPath ), extraArgs , outFile );
56+ IntegrationTestSpec .assertEqualTextFiles (outFile .toPath ().toFile (), new File (expectedOutputPath ));
57+ }
58+
59+ private void runFileDiagnosticsTool (
60+ final IOPath inputPath ,
61+ final List <Pair <String , String >> extraArgs ,
62+ final IOPath outputPath ) {
63+ final ArgumentsBuilder argBuilder = new ArgumentsBuilder ();
64+ argBuilder .addInput (inputPath .getRawInputString ());
65+ argBuilder .addOutput (outputPath .getRawInputString ());
4866 if (extraArgs != null ) {
4967 extraArgs .forEach (argPair -> argBuilder .add (argPair .getKey (), argPair .getValue ()));
5068 }
5169 runCommandLine (argBuilder .getArgsList ());
52-
53- IntegrationTestSpec .assertEqualTextFiles (outFile , new File (expectedOutputPath ));
5470 }
71+
5572}
0 commit comments