public class GalaxyAdaptor extends Object
Parameter
s and ParameterSet
s and the parameter representation
in Galaxy.
A GalaxyAdaptor
can be created from a ParameterSet
containing all parameters that are necessary for
the execution of some program that shall be included in a Galaxy installation.
The conversion is done by the method parse(String[],boolean)
. If this method is called with first argument equal to "--create"
and second argument a filename, then the Galaxy-representation of the current ParameterSet
is stored to that file. Afterwards, the application
and this file must be added to tool_conf.xml
(see Galaxy tutorial for details).
During the execution of the main program, addResult(Result, boolean, boolean)
and addResultSet(ResultSet, boolean, boolean)
can be used to add results of the computation to the results displayed in Galaxy, to export these and to add these to a summary page. If a
protocol of the program run shall be written, a GalaxyAdaptor.Protocol
object can be obtained by the getProtocol(boolean)
method.
After all results have been added and the protocol has been written, the method writeOutput()
must be called to create
the appropriate output files within Galaxy.Modifier and Type | Class and Description |
---|---|
static class |
GalaxyAdaptor.FileResult
Result for files that are results of some computation. |
static class |
GalaxyAdaptor.HeadResult
Class for a result that is basically a
CategoricalResult ,
but has its own name for checking purposes. |
static class |
GalaxyAdaptor.LineBasedResult
Superclass for all
Result that may be saved line by line. |
static class |
GalaxyAdaptor.LinkedImageResult
Class for an
ImageResult that is linked to a file that can be downloaded. |
static class |
GalaxyAdaptor.Protocol
Class for a Protocol writer.
|
Modifier and Type | Field and Description |
---|---|
static String |
stylesheet
The stylesheet used for the Galaxy HTML output.
|
Constructor and Description |
---|
GalaxyAdaptor(ParameterSet parameters,
JstacsTool.ResultEntry[] defaultResults,
boolean[] addLine,
String toolname,
String description,
String version,
String command,
String labelName)
Creates a new
GalaxyAdaptor from a given ParameterSet containing all parameters
that are necessary for a program is shall be included in a Galaxy installation. |
Modifier and Type | Method and Description |
---|---|
void |
addResult(Result res,
boolean export,
boolean includeInSummary)
Adds a result to the results of a program run.
|
void |
addResult(Result res,
boolean export,
boolean includeInSummary,
String exportExtension)
Adds a result to the results of a program run.
|
void |
addResultSet(ResultSet res,
boolean exportAll,
boolean includeInSummary)
Adds a set of results to the results of a program run.
|
String |
export(String filename,
Result res,
String exportExtension)
Exports a specified
Result of a program execution
to a file provided by filename and returns the
corresponding Galaxy data type. |
void |
fromGalaxyConfig(String filename)
Parses the values of the parameters from a galaxy script file
|
static String |
getColor(int depth)
Returns the color for a specified depth within the parameter hierarchy.
|
static String |
getDefaultExtension(Class<? extends Result> resClass)
Returns the default extension (Galaxy format) for a given result class.
|
String |
getHtmlFilesPath()
Returns the path where files, e.g.
|
static int |
getHtmlId()
Gets a unique id that can be used, e.g.
|
static String |
getLegalName(String name)
Returns a legal variable name in Galaxy
|
GalaxyAdaptor.Protocol |
getProtocol(boolean exportProtocol)
Returns an object for writing a protocol of a program run
|
int |
getThreads()
Returns the number of threads given by the Galaxy configuration
|
boolean |
parse(String[] args,
boolean configureThreads)
Parses the command line.
|
void |
setHelp(File helpfile)
Sets the help, i.e., a more detailed description of the program
to the contents of
helpfile . |
void |
setHelp(String help)
Sets the help, i.e., a more detailed description of the program
to
help . |
String |
toGalaxyConfig(boolean configureThreads)
Creates the contents of a Galaxy configuration file from all the information
provided to this
GalaxyAdaptor . |
void |
writeOutput()
Writes all output files of one program execution.
|
public static String stylesheet
public GalaxyAdaptor(ParameterSet parameters, JstacsTool.ResultEntry[] defaultResults, boolean[] addLine, String toolname, String description, String version, String command, String labelName)
GalaxyAdaptor
from a given ParameterSet
containing all parameters
that are necessary for a program is shall be included in a Galaxy installation. Besides the
parameters, a name, a description, and a version number of the program must be provided.
Additionally, the user must provide the command to run this program. For instance, if the program is bundled into
a jar MyJar.jar
, this command could be java -jar MyJar.jar
.parameters
- the parameters of the programdefaultResults
- the default results (see JstacsTool.getDefaultResultInfos()
, may be null
addLine
- indicates for each parameter in parameters
if a line is displayed before its name, ignored if parameters
is not a SimpleParameterSet
. May be null
.toolname
- the name of the programdescription
- a description of the program, may be supplemented by additional help provided by setHelp(File)
or setHelp(String)
version
- the version of the programcommand
- the command to run the programlabelName
- if null
, the default names of Galaxy are used, otherwise a field "Job name"
is added as first parameter of the tool with internal name labelName
. The internal name must not collide with the name of any other parameter.public int getThreads()
public static String getColor(int depth)
depth
- the depthpublic static int getHtmlId()
public void setHelp(String help)
help
.help
- the help textpublic void setHelp(File helpfile) throws IOException
helpfile
.helpfile
- the file containing the help textIOException
- if helpfile
could not be readpublic GalaxyAdaptor.Protocol getProtocol(boolean exportProtocol)
exportProtocol
- if true
the protocol will be exported and accessible
as extra result within Galaxypublic String toGalaxyConfig(boolean configureThreads) throws Exception
GalaxyAdaptor
.configureThreads
- if the configuration should include the number of threadsException
- if any of the parameters could not be convertedpublic void fromGalaxyConfig(String filename) throws Exception
filename
- the name of the script fileException
- if the parameter values could not be parsedpublic static String getDefaultExtension(Class<? extends Result> resClass)
null
.resClass
- the result classpublic String export(String filename, Result res, String exportExtension) throws IOException
Result
of a program execution
to a file provided by filename
and returns the
corresponding Galaxy data type.filename
- the filenameres
- the resultexportExtension
- the extension used for the exported fileIOException
- if the contents of res
could not be written to the filepublic void writeOutput() throws IOException
IOException
- if any of the files could not be created or writtenpublic boolean parse(String[] args, boolean configureThreads) throws Exception
args
- the argumentsconfigureThreads
- if the configuration should include the number of threadstrue
if this execution should be a program run (as opposed to writing a configuration file)Exception
- if the arguments could not be parsed or the Galaxy configuration file could not be createdpublic void addResult(Result res, boolean export, boolean includeInSummary)
res
- the resultexport
- if true
the result is exported to its own Galaxy result, e.g. for
evaluation in other application within GalaxyincludeInSummary
- if true
the result is shown on the summary pagepublic void addResult(Result res, boolean export, boolean includeInSummary, String exportExtension)
res
- the resultexport
- if true
the result is exported to its own Galaxy result, e.g. for
evaluation in other application within GalaxyincludeInSummary
- if true
the result is shown on the summary pageexportExtension
- the file extension used for the exported filepublic void addResultSet(ResultSet res, boolean exportAll, boolean includeInSummary)
res
- the resultsexportAll
- if true
all results in this set are exported to their own Galaxy result, e.g. for
evaluation in other application within GalaxyincludeInSummary
- if true
the results are shown on the summary pagepublic static String getLegalName(String name)
name
- the original namepublic String getHtmlFilesPath()