public class GenericCommandRunner extends Module
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_QUEUE_LENGTH |
static String |
GCR_STDERR |
static String |
GCR_STDERR_BUFFERSIZE |
static String |
GCR_STDOUT |
static String |
GCR_STDOUT_BUFFERSIZE |
processingAccession, VERSION
Constructor and Description |
---|
GenericCommandRunner() |
Modifier and Type | Method and Description |
---|---|
ReturnValue |
clean_up()
clean_up.
|
ReturnValue |
do_run()
do_run.
|
ReturnValue |
do_test()
do_test.
|
ReturnValue |
do_verify_input()
do_verify_input.
|
ReturnValue |
do_verify_output()
do_verify_output.
|
ReturnValue |
do_verify_parameters()
do_verify_parameters.
|
String |
get_syntax()
Generates a "help" message for the user of the module.
|
protected joptsimple.OptionParser |
getOptionParser()
getOptionParser is an internal method to parse command line args.
|
ReturnValue |
init()
init.
|
get_galaxy_xml, getAlgorithm, getMetadata, getParameters, getProcessingAccession, getStderrFile, getStdoutFile, setAlgorithm, setMetadata, setParameters, setProcessingAccession, setStderrFile, setStdoutFile
public static final String GCR_STDOUT
public static final String GCR_STDERR
public static final String GCR_STDERR_BUFFERSIZE
public static final String GCR_STDOUT_BUFFERSIZE
public static final int DEFAULT_QUEUE_LENGTH
protected joptsimple.OptionParser getOptionParser()
getOptionParser
in class Module
public String get_syntax()
get_syntax
in interface ModuleInterface
get_syntax
in class Module
public ReturnValue init()
init.
The init method is where you put any code needed to setup your module. Here I set some basic information in the ReturnValue object which will eventually populate the "processing" table in seqware_meta_db. I also create a temporary directory using the FileTools object. init is optionalinit
in interface ModuleInterface
init
in class Module
public ReturnValue do_verify_parameters()
do_verify_parameters.
Verifies that the parameters make sensedo_verify_parameters
in interface ModuleInterface
do_verify_parameters
in class Module
public ReturnValue do_verify_input()
do_verify_input.
The do_verify_input method ensures that the input is reasonable and valid for this tool. For this generic command runner we really can't tell if thedo_verify_input
in interface ModuleInterface
do_verify_input
in class Module
public ReturnValue do_test()
do_test.
This is really an optional method but a very good idea. You would test the programs your calling here by running them on a "known good" test dataset and then compare the new answer with the previous known good answer. Other forms of testing could be encapsulated here as well.do_test
in interface ModuleInterface
do_test
in class Module
public ReturnValue do_run()
do_run.
This is the core of a module. While some modules may be written in pure Java or use various third-party Java APIs, the vast majority of modules will use this method to make calls out to the shell (typically the BASH shell in Linux) and use that shell to execute various commands. In an ideal world this would never happen, we would all write out code with a language-agnostic, network-aware API (e.g. thrift, SOAP, etc). But until that day comes most programs in bioinformatics are command line tools (or websites). So the heart of the module is it acts as a way for us to treat the disparate tools as well-behaved modules that present a standard interface and report back their metadata in well-defined ways. That's, ultimately, what this object and, in particular this method, are all about. There are other alternatives out there, such as Galaxy, that may provide an XML syntax for accomplishing much of the same thing. For example, they make disparate tools appear to function the same because the inputs/outputs are all described using a standardized language. We chose Java because it was more expressive than XML as a module running descriptor. But clearly there are a lot of ways to solve this problem. The key concern, though, is that a module should present very clear inputs and outputs based, whenever possible, on standardized file types. This makes it easy to use modules in novel workflows, rearranging them as needed. Make every effort to make your modules self-contained and robust!do_run
in interface ModuleInterface
do_run
in class Module
public ReturnValue do_verify_output()
do_verify_output.
A method to check to make sure the output was created correctlydo_verify_output
in interface ModuleInterface
do_verify_output
in class Module
public ReturnValue clean_up()
clean_up.
A cleanup method, make sure you cleanup files that are outside the current working directory since Pegasus won't clean those for you. clean_up is optionalclean_up
in interface ModuleInterface
clean_up
in class Module
Copyright © 2015 SeqWare. All rights reserved.