public abstract class CommandLineProgram
extends java.lang.Object
implements org.broadinstitute.barclay.argparser.CommandLinePluginProvider
Modifier and Type | Field and Description |
---|---|
java.lang.String |
GATK_CONFIG_FILE |
protected org.apache.logging.log4j.Logger |
logger |
int |
NIO_MAX_REOPENS |
java.lang.String |
NIO_PROJECT_FOR_REQUESTER_PAYS |
java.lang.Boolean |
QUIET |
org.broadinstitute.barclay.argparser.SpecialArgumentsCollection |
specialArgumentsCollection |
GATKPathSpecifier |
tmpDir |
boolean |
useJdkDeflater |
boolean |
useJdkInflater |
htsjdk.samtools.util.Log.LogLevel |
VERBOSITY |
Constructor and Description |
---|
CommandLineProgram() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String[] |
customCommandLineValidation()
Put any custom command-line validation in an override of this method.
|
protected abstract java.lang.Object |
doWork()
Do the work after command line has been parsed.
|
java.lang.String |
getCommandLine() |
org.broadinstitute.barclay.argparser.CommandLineParser |
getCommandLineParser() |
java.util.List<htsjdk.samtools.metrics.Header> |
getDefaultHeaders()
Returns the (live) list of default metrics headers used by this tool.
|
protected <A extends htsjdk.samtools.metrics.MetricBase,B extends java.lang.Comparable<?>> |
getMetricsFile()
Gets a MetricsFile with default headers already written into it.
|
java.util.List<? extends org.broadinstitute.barclay.argparser.CommandLinePluginDescriptor<?>> |
getPluginDescriptors()
Return the list of GATKCommandLinePluginDescriptors to be used for this CLP.
|
protected java.lang.String |
getSupportInformation() |
protected java.lang.String |
getToolkitName() |
protected java.lang.String |
getToolkitShortName() |
protected java.lang.String |
getToolStatusWarning(boolean useTerminalColor)
If this tool is either Experimental or Beta, return a warning message advising against use in production
envirogetnment.
|
java.lang.String |
getUsage() |
java.lang.String |
getVersion() |
java.lang.Object |
instanceMain(java.lang.String[] argv) |
java.lang.Object |
instanceMainPostParseArgs() |
boolean |
isBetaFeature() |
boolean |
isExperimentalFeature() |
protected void |
onShutdown()
Perform cleanup after doWork() is finished.
|
protected void |
onStartup()
Perform initialization/setup after command-line argument parsing but before doWork() is invoked.
|
protected boolean |
parseArgs(java.lang.String[] argv)
Parse arguments and initialize any values annotated with
Argument |
protected void |
printLibraryVersions()
Output versions of important dependencies to the logger.
|
protected void |
printSettings()
Output a curated set of important settings to the logger.
|
protected void |
printStartupMessage(java.time.ZonedDateTime startDateTime)
Prints a user-friendly message on startup with some information about who we are and the
runtime environment.
|
java.lang.Object |
runTool()
Template method that runs the startup hook, doWork and then the shutdown hook.
|
void |
setDefaultHeaders(java.util.List<htsjdk.samtools.metrics.Header> headers)
Replaces the set of default metrics headers by the given argument.
|
protected void |
warnOnToolStatus()
If a tool is either Experimental or Beta, log a warning against use in production a environment.
|
protected final org.apache.logging.log4j.Logger logger
@Argument(fullName="tmp-dir", common=true, optional=true, doc="Temp directory to use.") public GATKPathSpecifier tmpDir
@ArgumentCollection(doc="Special Arguments that have meaning to the argument parsing system. It is unlikely these will ever need to be accessed by the command line program") public org.broadinstitute.barclay.argparser.SpecialArgumentsCollection specialArgumentsCollection
@Argument(fullName="verbosity", shortName="verbosity", doc="Control verbosity of logging.", common=true, optional=true) public htsjdk.samtools.util.Log.LogLevel VERBOSITY
@Argument(fullName="QUIET", doc="Whether to suppress job-summary info on System.err.", common=true) public java.lang.Boolean QUIET
@Argument(fullName="use-jdk-deflater", shortName="jdk-deflater", doc="Whether to use the JdkDeflater (as opposed to IntelDeflater)", common=true) public boolean useJdkDeflater
@Argument(fullName="use-jdk-inflater", shortName="jdk-inflater", doc="Whether to use the JdkInflater (as opposed to IntelInflater)", common=true) public boolean useJdkInflater
@Argument(fullName="gcs-max-retries", shortName="gcs-retries", doc="If the GCS bucket channel errors out, how many times it will attempt to re-initiate the connection", optional=true) public int NIO_MAX_REOPENS
@Argument(fullName="gcs-project-for-requester-pays", doc="Project to bill when accessing \"requester pays\" buckets. If unset, these buckets cannot be accessed.", optional=true) public java.lang.String NIO_PROJECT_FOR_REQUESTER_PAYS
@Argument(fullName="gatk-config-file", doc="A configuration file to use with the GATK.", common=true, optional=true) public java.lang.String GATK_CONFIG_FILE
protected void onStartup()
protected abstract java.lang.Object doWork()
protected void onShutdown()
public final java.lang.Object runTool()
public java.lang.Object instanceMainPostParseArgs()
public java.lang.Object instanceMain(java.lang.String[] argv)
protected java.lang.String[] customCommandLineValidation()
org.broadinstitute.barclay.argparser.CommandLineException
- if command line is invalid and handling as exception is preferred.protected final boolean parseArgs(java.lang.String[] argv)
Argument
SpecialArgumentsCollection.HELP_FULLNAME
was specifiedorg.broadinstitute.barclay.argparser.CommandLineException
- if command line validation failspublic java.util.List<? extends org.broadinstitute.barclay.argparser.CommandLinePluginDescriptor<?>> getPluginDescriptors()
getPluginDescriptors
in interface org.broadinstitute.barclay.argparser.CommandLinePluginProvider
protected <A extends htsjdk.samtools.metrics.MetricBase,B extends java.lang.Comparable<?>> htsjdk.samtools.metrics.MetricsFile<A,B> getMetricsFile()
protected void printStartupMessage(java.time.ZonedDateTime startDateTime)
startDateTime
- Startup date/timeprotected java.lang.String getToolStatusWarning(boolean useTerminalColor)
useTerminalColor
- true if the message should include highlighting terminal colorizationprotected void warnOnToolStatus()
public boolean isBetaFeature()
BetaFeature
status.public boolean isExperimentalFeature()
ExperimentalFeature
status.protected java.lang.String getToolkitName()
protected java.lang.String getToolkitShortName()
DEFAULT_TOOLKIT_SHORT_NAME
if the manifest is unavailable.
Subclasses may override to do something different.public java.lang.String getVersion()
protected java.lang.String getSupportInformation()
protected void printLibraryVersions()
protected void printSettings()
public final java.lang.String getCommandLine()
public final java.lang.String getUsage()
public final void setDefaultHeaders(java.util.List<htsjdk.samtools.metrics.Header> headers)
public final java.util.List<htsjdk.samtools.metrics.Header> getDefaultHeaders()
public final org.broadinstitute.barclay.argparser.CommandLineParser getCommandLineParser()