Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.utils.galaxy
Class GalaxyAdaptor

    java.lang.Object
      de.jstacs.utils.galaxy.GalaxyAdaptor

    public class GalaxyAdaptor

extends Object

Adaptor class between the parameter representation of Jstacs in `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[])`. 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.

Author:
  Jan Grau

Nested Class Summary
`static class` | `GalaxyAdaptor.FileResult` `Result` for files that are results of some computation.
`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.

Constructor Summary
`GalaxyAdaptor(ParameterSet parameters, String toolname, String description, String version, String command)` 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.

Method Summary
`void` | `addResult(Result res, boolean export, boolean includeInSummary)` 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)` Exports a specified `GalaxyAdaptor.LinkedImageResult` 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.
`String` | `getHtmlFilesPath()` Returns the path where files, e.g. images, that shall be linked from the HTML summary shall be stored in.
`static int` | `getHtmlId()` Gets a unique id that can be used, e.g. to create unique filenames.
`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
`boolean` | `parse(String[] args)` 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()` 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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GalaxyAdaptor

    public GalaxyAdaptor(ParameterSet parameters,
                         String toolname,
                         String description,
                         String version,
                         String command)

  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. 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:
    `parameters` - the parameters of the program
    `toolname` - the name of the program
    `description` - a description of the program, may be supplemented by additional help provided by `setHelp(File)` or `setHelp(String)`
    `version` - the version of the program
    `command` - the command to run the program

Method Detail

### getColor

    public static String getColor(int depth)

  Returns the color for a specified depth within the parameter hierarchy.

  Parameters:
    `depth` - the depth
  Returns:
    the color

### getHtmlId

    public static int getHtmlId()

  Gets a unique id that can be used, e.g. to create unique filenames.

  Returns:
    the id

### setHelp

    public void setHelp(String help)

  Sets the help, i.e., a more detailed description of the program to `help`.

  Parameters:
    `help` - the help text

### setHelp

    public void setHelp(File helpfile)
                 throws IOException

  Sets the help, i.e., a more detailed description of the program to the contents of `helpfile`.

  Parameters:
    `helpfile` - the file containing the help text
  Throws:
    `IOException` - if `helpfile` could not be read

### getProtocol

    public GalaxyAdaptor.Protocol getProtocol(boolean exportProtocol)

  Returns an object for writing a protocol of a program run

  Parameters:
    `exportProtocol` - if `true` the protocol will be exported and accessible as extra result within Galaxy
  Returns:
    the protocol object

### toGalaxyConfig

    public String toGalaxyConfig()
                          throws Exception

  Creates the contents of a Galaxy configuration file from all the information provided to this `GalaxyAdaptor`.

  Returns:
    the configuration
  Throws:
    `Exception` - if any of the parameters could not be converted

### fromGalaxyConfig

    public void fromGalaxyConfig(String filename)
                          throws Exception

  Parses the values of the parameters from a galaxy script file

  Parameters:
    `filename` - the name of the script file
  Throws:
    `Exception` - if the parameter values could not be parsed

### export

    public String export(String filename,
                         Result res)
                  throws IOException

  Exports a specified `GalaxyAdaptor.LinkedImageResult` of a program execution to a file provided by `filename` and returns the corresponding Galaxy data type.

  Parameters:
    `filename` - the filename
    `res` - the result
  Returns:
    the data type
  Throws:
    `IOException` - if the contents of `res` could not be written to the file

### writeOutput

    public void writeOutput()
                     throws IOException

  Writes all output files of one program execution. This includes the summary of the execution, exported results and protocols, and images.

  Throws:
    `IOException` - if any of the files could not be created or written

### parse

    public boolean parse(String[] args)
                  throws Exception

  Parses the command line. If the first argument is equal to "--create", then the configuration file is written to the file with filename provided in the second argument. Otherwise the first argument must be "--run" to parse the parameters of a program run within Galaxy.

  Parameters:
    `args` - the arguments
  Returns:
    `true` if this execution should be a program run (as opposed to writing a configuration file)
  Throws:
    `Exception` - if the arguments could not be parsed or the Galaxy configuration file could not be created

### addResult

    public void addResult(Result res,
                          boolean export,
                          boolean includeInSummary)

  Adds a result to the results of a program run.

  Parameters:
    `res` - the result
    `export` - if `true` the result is exported to its own Galaxy result, e.g. for evaluation in other application within Galaxy
    `includeInSummary` - if `true` the result is shown on the summary page

### addResultSet

    public void addResultSet(ResultSet res,
                             boolean exportAll,
                             boolean includeInSummary)

  Adds a set of results to the results of a program run.

  Parameters:
    `res` - the results
    `exportAll` - if `true` all results in this set are exported to their own Galaxy result, e.g. for evaluation in other application within Galaxy
    `includeInSummary` - if `true` the results are shown on the summary page

### getLegalName

    public static String getLegalName(String name)

  Returns a legal variable name in Galaxy

  Parameters:
    `name` - the original name
  Returns:
    the legalized name

### getHtmlFilesPath

    public String getHtmlFilesPath()

  Returns the path where files, e.g. images, that shall be linked from the HTML summary shall be stored in.

  Returns:
    the path

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD