htsjdk.samtools.util.BlockGunzipper Java Examples

The following examples show how to use htsjdk.samtools.util.BlockGunzipper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestUtils.java    From Drop-seq with MIT License 5 votes vote down vote up
/**
 * CommandLineProgram only replaces default inflater/deflater with Intel versions, which don't work on Mac.
 * Once they've been set to Intel versions in a JVM, they need to be reverted explicitly by any unit test.
 * that is failing on Mac.
 */
public static void setInflaterDeflaterIfMacOs() {
	if (isMacOs()) {
		BlockCompressedOutputStream.setDefaultDeflaterFactory(new DeflaterFactory());
		BlockGunzipper.setDefaultInflaterFactory(new InflaterFactory());
	}
}
 
Example #2
Source File: CommandLineProgram.java    From gatk with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Output a curated set of important settings to the logger.
 *
 * May be overridden by subclasses to specify a different set of settings to output.
 */
protected void printSettings() {
    if ( VERBOSITY != Log.LogLevel.DEBUG ) {
        logger.info("HTSJDK Defaults.COMPRESSION_LEVEL : " + Defaults.COMPRESSION_LEVEL);
        logger.info("HTSJDK Defaults.USE_ASYNC_IO_READ_FOR_SAMTOOLS : " + Defaults.USE_ASYNC_IO_READ_FOR_SAMTOOLS);
        logger.info("HTSJDK Defaults.USE_ASYNC_IO_WRITE_FOR_SAMTOOLS : " + Defaults.USE_ASYNC_IO_WRITE_FOR_SAMTOOLS);
        logger.info("HTSJDK Defaults.USE_ASYNC_IO_WRITE_FOR_TRIBBLE : " + Defaults.USE_ASYNC_IO_WRITE_FOR_TRIBBLE);
    }
    else {
        // At DEBUG verbosity, print all the HTSJDK defaults:
        Defaults.allDefaults()
                .forEach((key, value) -> logger.info("HTSJDK " + Defaults.class.getSimpleName() + "." + key + " : " + value));
    }

    // Log the configuration options:
    ConfigFactory.logConfigFields(ConfigFactory.getInstance().getGATKConfig(), Log.LogLevel.DEBUG);

    final boolean usingIntelDeflater = (BlockCompressedOutputStream.getDefaultDeflaterFactory() instanceof IntelDeflaterFactory && ((IntelDeflaterFactory)BlockCompressedOutputStream.getDefaultDeflaterFactory()).usingIntelDeflater());
    logger.info("Deflater: " + (usingIntelDeflater ? "IntelDeflater": "JdkDeflater"));
    final boolean usingIntelInflater = (BlockGunzipper.getDefaultInflaterFactory() instanceof IntelInflaterFactory && ((IntelInflaterFactory)BlockGunzipper.getDefaultInflaterFactory()).usingIntelInflater());
    logger.info("Inflater: " + (usingIntelInflater ? "IntelInflater": "JdkInflater"));

    logger.info("GCS max retries/reopens: " + BucketUtils.getCloudStorageConfiguration(NIO_MAX_REOPENS, "").maxChannelReopens());
    if (Strings.isNullOrEmpty(NIO_PROJECT_FOR_REQUESTER_PAYS)) {
        logger.info("Requester pays: disabled");
    } else {
        logger.info("Requester pays: enabled. Billed to: " + NIO_PROJECT_FOR_REQUESTER_PAYS);
    }
}
 
Example #3
Source File: IntelInflaterDeflaterIntegrationTest.java    From gatk with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@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 = GATKBaseTest.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);
}