Search in sources :

Example 1 with InflaterFactory

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);
}
Also used : InflaterFactory(htsjdk.samtools.util.zip.InflaterFactory) IntelInflaterFactory(com.intel.gkl.compression.IntelInflaterFactory) IntelDeflaterFactory(com.intel.gkl.compression.IntelDeflaterFactory) DeflaterFactory(htsjdk.samtools.util.zip.DeflaterFactory) ArrayList(java.util.ArrayList) SkipException(org.testng.SkipException) File(java.io.File) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Aggregations

IntelDeflaterFactory (com.intel.gkl.compression.IntelDeflaterFactory)1 IntelInflaterFactory (com.intel.gkl.compression.IntelInflaterFactory)1 DeflaterFactory (htsjdk.samtools.util.zip.DeflaterFactory)1 InflaterFactory (htsjdk.samtools.util.zip.InflaterFactory)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)1 SkipException (org.testng.SkipException)1 Test (org.testng.annotations.Test)1