use of htsjdk.samtools.util.zip.InflaterFactory in project gatk by broadinstitute.
the class IntelInflaterDeflaterIntegrationTest method testIntelInflaterDeflaterWithPrintReads.
@Test(dataProvider = "JdkFlags")
public void testIntelInflaterDeflaterWithPrintReads(final boolean use_jdk_inflater, final boolean use_jdk_deflater) throws Exception {
if (!isIntelInflaterDeflaterSupported()) {
throw new SkipException("IntelInflater/IntelDeflater not available on this platform");
}
final File ORIG_BAM = new File(largeFileTestDir, INPUT_FILE);
final File outFile = BaseTest.createTempFile(INPUT_FILE, ".bam");
final ArrayList<String> args = new ArrayList<>();
args.add("--input");
args.add(ORIG_BAM.getAbsolutePath());
args.add("--output");
args.add(outFile.getAbsolutePath());
args.add("--use_jdk_inflater");
args.add(String.valueOf(use_jdk_inflater));
args.add("--use_jdk_deflater");
args.add(String.valueOf(use_jdk_deflater));
// store current default factories, so they can be restored later
InflaterFactory currentInflaterFactory = BlockGunzipper.getDefaultInflaterFactory();
DeflaterFactory currentDeflaterFactory = BlockCompressedOutputStream.getDefaultDeflaterFactory();
// set default factories to jdk version
// because PrintReads cannot change the factory to Jdk if it was already set to Intel
BlockGunzipper.setDefaultInflaterFactory(new InflaterFactory());
BlockCompressedOutputStream.setDefaultDeflaterFactory(new DeflaterFactory());
// run PrintReads
runCommandLine(args);
// restore default factories
BlockGunzipper.setDefaultInflaterFactory(currentInflaterFactory);
BlockCompressedOutputStream.setDefaultDeflaterFactory(currentDeflaterFactory);
// validate input and output files are the same
SamAssertionUtils.assertSamsEqual(outFile, ORIG_BAM);
}
Aggregations