All Downloads are FREE. Search and download functionalities are using the official Maven repository.

picard.cmdline.CommandLineDefaults Maven / Gradle / Ivy

Go to download

A set of command line tools (in Java) for manipulating high-throughput sequencing (HTS) data and formats such as SAM/BAM/CRAM and VCF.

There is a newer version: 3.2.0
Show newest version
package picard.cmdline;

import java.io.File;

/**
 * Embodies defaults for global values that affect how the Picard Command Line operates. Defaults are encoded in the class
 * and are also overridable using system properties.
 *
 * @author Nils Homer
 */
public class CommandLineDefaults {

    /** Implementation note, this is duplicate code stolen from HTSJDK's Default.java

    /**
     * Decides if we want to write colors to the terminal.
     */
    public static final boolean COLOR_STATUS;

    static {
        COLOR_STATUS = getBooleanProperty("color_status", true);
    }

    /** Gets a string system property, prefixed with "picard.cmdline." using the default if the property does not exist. */
    private static String getStringProperty(final String name, final String def) {
        return System.getProperty("picard.cmdline." + name, def);
    }

    /** Gets a boolean system property, prefixed with "picard.cmdline." using the default if the property does not exist. */
    private static boolean getBooleanProperty(final String name, final boolean def) {
        final String value = getStringProperty(name, String.valueOf(def));
        return Boolean.parseBoolean(value);
    }

    /** Gets an int system property, prefixed with "picard.cmdline." using the default if the property does not exist. */
    private static int getIntProperty(final String name, final int def) {
        final String value = getStringProperty(name, String.valueOf(def));
        return Integer.parseInt(value);
    }

    /** Gets a File system property, prefixed with "picard.cmdline." using the default if the property does not exist. */
    private static File getFileProperty(final String name, final String def) {
        final String value = getStringProperty(name, def);
        // TODO: assert that it is readable
        return (null == value) ? null : new File(value);
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy