parameters Package¶
parameters Package¶
Classes encapsulating Galaxy tool parameters.
-
galaxy.tools.parameters.check_param(trans, param, incoming_value, param_values, source='html')[source]¶ Check the value of a single parameter param. The value in incoming_value is converted from its HTML encoding and validated. The param_values argument contains the processed values of previous parameters (this may actually be an ExpressionContext when dealing with grouping scenarios).
-
galaxy.tools.parameters.params_from_strings(params, param_values, app, ignore_errors=False)[source]¶ Convert a dictionary of strings as produced by params_to_strings back into parameter values (decode the json representation and then allow each parameter to convert the basic types into the parameters preferred form).
-
galaxy.tools.parameters.params_to_incoming(incoming, inputs, input_values, app, name_prefix='')[source]¶ Given a tool’s parameter definition (inputs) and a specific set of parameter input_values objects, populate incoming with the html values.
Useful for e.g. the rerun function.
-
galaxy.tools.parameters.params_to_strings(params, param_values, app)[source]¶ Convert a dictionary of parameter values to a dictionary of strings suitable for persisting. The value_to_basic method of each parameter is called to convert its value to basic types, the result of which is then json encoded (this allowing complex nested parameters and such).
-
galaxy.tools.parameters.visit_input_values(inputs, input_values, callback, name_prefix='', label_prefix='')[source]¶ Given a tools parameter definition (inputs) and a specific set of parameter values, call callback for each non-grouping parameter, passing the parameter object, value, a constructed unique name, and a display label.
If the callback returns a value, it will be replace the old value.
- FIXME: There is redundancy between this and the visit_inputs methods of
- Repeat and Group. This tracks labels and those do not. It would be nice to unify all the places that recursively visit inputs.
basic Module¶
Basic tool parameters.
-
class
galaxy.tools.parameters.basic.BaseURLToolParameter(tool, elem)[source]¶ Bases:
galaxy.tools.parameters.basic.ToolParameterReturns a parameter the contains its value prepended by the current server base url. Used in all redirects.
-
class
galaxy.tools.parameters.basic.BooleanToolParameter(tool, elem)[source]¶ Bases:
galaxy.tools.parameters.basic.ToolParameterParameter that takes one of two values.
>>> p = BooleanToolParameter( None, XML( '<param name="blah" type="boolean" checked="yes" truevalue="bulletproof vests" falsevalue="cellophane chests" />' ) ) >>> print p.name blah >>> print p.get_html() <input type="checkbox" id="blah" name="blah" value="true" checked="checked"><input type="hidden" name="blah" value="true"> >>> print p.from_html( ["true","true"] ) True >>> print p.to_param_dict_string( True ) bulletproof vests >>> print p.from_html( ["true"] ) False >>> print p.to_param_dict_string( False ) cellophane chests
-
legal_values¶
-
-
class
galaxy.tools.parameters.basic.ColumnListParameter(tool, elem)[source]¶ Bases:
galaxy.tools.parameters.basic.SelectToolParameterSelect list that consists of either the total number of columns or only those columns that contain numerical values in the associated DataToolParameter.
# TODO: we need better testing here, but not sure how to associate a DatatoolParameter with a ColumnListParameter # from a twill perspective...
>>> # Mock up a history (not connected to database) >>> from galaxy.model import History, HistoryDatasetAssociation >>> from galaxy.util.bunch import Bunch >>> from galaxy.model.mapping import init >>> sa_session = init( "/tmp", "sqlite:///:memory:", create_tables=True ).session >>> hist = History() >>> sa_session.add( hist ) >>> sa_session.flush() >>> hda = hist.add_dataset( HistoryDatasetAssociation( id=1, extension='interval', create_dataset=True, sa_session=sa_session ) ) >>> dtp = DataToolParameter( None, XML( '<param name="blah" type="data" format="interval"/>' ) ) >>> print dtp.name blah >>> clp = ColumnListParameter ( None, XML( '<param name="numerical_column" type="data_column" data_ref="blah" numerical="true"/>' ) ) >>> print clp.name numerical_column
-
from_html(value, trans=None, context={})[source]¶ Label convention prepends column number with a ‘c’, but tool uses the integer. This removes the ‘c’ when entered into a workflow.
-
get_column_list(trans, other_values)[source]¶ Generate a select list containing the columns of the associated dataset (if found).
-
-
galaxy.tools.parameters.basic.DEFAULT_VALUE_MAP(x)¶
-
class
galaxy.tools.parameters.basic.DataCollectionToolParameter(tool, elem, trans=None)[source]¶ Bases:
galaxy.tools.parameters.basic.BaseDataToolParameter-
collection_type¶
-
-
class
galaxy.tools.parameters.basic.DataToolParameter(tool, elem, trans=None)[source]¶ Bases:
galaxy.tools.parameters.basic.BaseDataToolParameterParameter that takes on one (or many) or a specific set of values.
- TODO: There should be an alternate display that allows single selects to be
- displayed as radio buttons and multiple selects as a set of checkboxes
TODO: The following must be fixed to test correctly for the new security_check tag in the DataToolParameter ( the last test below is broken ) Nate’s next pass at the dataset security stuff will dramatically alter this anyway.
-
class
galaxy.tools.parameters.basic.DrillDownSelectToolParameter(tool, elem, context=None)[source]¶ Bases:
galaxy.tools.parameters.basic.SelectToolParameterParameter that takes on one (or many) of a specific set of values. Creating a hierarchical select menu, which allows users to ‘drill down’ a tree-like set of options.
>>> p = DrillDownSelectToolParameter( None, XML( ... ''' ... <param name="some_name" type="drill_down" display="checkbox" hierarchy="recurse" multiple="true"> ... <options> ... <option name="Heading 1" value="heading1"> ... <option name="Option 1" value="option1"/> ... <option name="Option 2" value="option2"/> ... <option name="Heading 1" value="heading1"> ... <option name="Option 3" value="option3"/> ... <option name="Option 4" value="option4"/> ... </option> ... </option> ... <option name="Option 5" value="option5"/> ... </options> ... </param> ... ''' ) ) >>> print p.get_html() <div class="form-row drilldown-container" id="drilldown--736f6d655f6e616d65"> <div class="form-row-input"> <div><span class="form-toggle icon-button toggle-expand" id="drilldown--736f6d655f6e616d65-68656164696e6731-click"></span> <input type="checkbox" name="some_name" value="heading1" >Heading 1 </div><div class="form-row" id="drilldown--736f6d655f6e616d65-68656164696e6731-container" style="float: left; margin-left: 1em;"> <div class="form-row-input"> <input type="checkbox" name="some_name" value="option1" >Option 1 </div> <div class="form-row-input"> <input type="checkbox" name="some_name" value="option2" >Option 2 </div> <div class="form-row-input"> <div><span class="form-toggle icon-button toggle-expand" id="drilldown--736f6d655f6e616d65-68656164696e6731-68656164696e6731-click"></span> <input type="checkbox" name="some_name" value="heading1" >Heading 1 </div><div class="form-row" id="drilldown--736f6d655f6e616d65-68656164696e6731-68656164696e6731-container" style="float: left; margin-left: 1em;"> <div class="form-row-input"> <input type="checkbox" name="some_name" value="option3" >Option 3 </div> <div class="form-row-input"> <input type="checkbox" name="some_name" value="option4" >Option 4 </div> </div> </div> </div> </div> <div class="form-row-input"> <input type="checkbox" name="some_name" value="option5" >Option 5 </div> </div> >>> p = DrillDownSelectToolParameter( None, XML( ... ''' ... <param name="some_name" type="drill_down" display="radio" hierarchy="recurse" multiple="false"> ... <options> ... <option name="Heading 1" value="heading1"> ... <option name="Option 1" value="option1"/> ... <option name="Option 2" value="option2"/> ... <option name="Heading 1" value="heading1"> ... <option name="Option 3" value="option3"/> ... <option name="Option 4" value="option4"/> ... </option> ... </option> ... <option name="Option 5" value="option5"/> ... </options> ... </param> ... ''' ) ) >>> print p.get_html() <div class="form-row drilldown-container" id="drilldown--736f6d655f6e616d65"> <div class="form-row-input"> <div><span class="form-toggle icon-button toggle-expand" id="drilldown--736f6d655f6e616d65-68656164696e6731-click"></span> <input type="radio" name="some_name" value="heading1" >Heading 1 </div><div class="form-row" id="drilldown--736f6d655f6e616d65-68656164696e6731-container" style="float: left; margin-left: 1em;"> <div class="form-row-input"> <input type="radio" name="some_name" value="option1" >Option 1 </div> <div class="form-row-input"> <input type="radio" name="some_name" value="option2" >Option 2 </div> <div class="form-row-input"> <div><span class="form-toggle icon-button toggle-expand" id="drilldown--736f6d655f6e616d65-68656164696e6731-68656164696e6731-click"></span> <input type="radio" name="some_name" value="heading1" >Heading 1 </div><div class="form-row" id="drilldown--736f6d655f6e616d65-68656164696e6731-68656164696e6731-container" style="float: left; margin-left: 1em;"> <div class="form-row-input"> <input type="radio" name="some_name" value="option3" >Option 3 </div> <div class="form-row-input"> <input type="radio" name="some_name" value="option4" >Option 4 </div> </div> </div> </div> </div> <div class="form-row-input"> <input type="radio" name="some_name" value="option5" >Option 5 </div> </div> >>> print p.options [{'selected': False, 'name': 'Heading 1', 'value': 'heading1', 'options': [{'selected': False, 'name': 'Option 1', 'value': 'option1', 'options': []}, {'selected': False, 'name': 'Option 2', 'value': 'option2', 'options': []}, {'selected': False, 'name': 'Heading 1', 'value': 'heading1', 'options': [{'selected': False, 'name': 'Option 3', 'value': 'option3', 'options': []}, {'selected': False, 'name': 'Option 4', 'value': 'option4', 'options': []}]}]}, {'selected': False, 'name': 'Option 5', 'value': 'option5', 'options': []}]
-
class
galaxy.tools.parameters.basic.FTPFileToolParameter(tool, elem)[source]¶ Bases:
galaxy.tools.parameters.basic.ToolParameterParameter that takes a file uploaded via FTP as a value.
-
visible¶
-
-
class
galaxy.tools.parameters.basic.FileToolParameter(tool, elem)[source]¶ Bases:
galaxy.tools.parameters.basic.ToolParameterParameter that takes an uploaded file as a value.
>>> p = FileToolParameter( None, XML( '<param name="blah" type="file"/>' ) ) >>> print p.name blah >>> print p.get_html() <input type="file" name="blah"> >>> p = FileToolParameter( None, XML( '<param name="blah" type="file" ajax-upload="true"/>' ) ) >>> print p.get_html() <input type="file" name="blah" galaxy-ajax-upload="true">
-
class
galaxy.tools.parameters.basic.FloatToolParameter(tool, elem)[source]¶ Bases:
galaxy.tools.parameters.basic.TextToolParameterParameter that takes a real number value.
>>> p = FloatToolParameter( None, XML( '<param name="blah" type="float" size="4" value="3.141592" />' ) ) >>> print p.name blah >>> print p.get_html() <input type="text" name="blah" size="4" value="3.141592"> >>> type( p.from_html( "36.1" ) ) <type 'float'> >>> type( p.from_html( "bleh" ) ) Traceback (most recent call last): ... ValueError: A real number is required
-
dict_collection_visible_keys= ('name', 'type', 'label', 'help', 'min', 'max')¶
-
-
class
galaxy.tools.parameters.basic.GenomeBuildParameter(*args, **kwds)[source]¶ Bases:
galaxy.tools.parameters.basic.SelectToolParameterSelect list that sets the last used genome build for the current history as “selected”.
>>> # Create a mock transaction with 'hg17' as the current build >>> from galaxy.util.bunch import Bunch >>> trans = Bunch( history=Bunch( genome_build='hg17' ), db_builds=util.read_dbnames( None ) )
>>> p = GenomeBuildParameter( None, XML( ... ''' ... <param name="blah" type="genomebuild" /> ... ''' ) ) >>> print p.name blah
>>> # hg17 should be selected by default >>> print p.get_html( trans ) <select name="blah" last_selected_value="hg17"> <option value="?">unspecified (?)</option> ... <option value="hg18">Human Mar. 2006 (NCBI36/hg18) (hg18)</option> <option value="hg17" selected>Human May 2004 (NCBI35/hg17) (hg17)</option> ... </select>
>>> # If the user selected something else already, that should be used >>> # instead >>> print p.get_html( trans, value='hg18' ) <select name="blah" last_selected_value="hg18"> <option value="?">unspecified (?)</option> ... <option value="hg18" selected>Human Mar. 2006 (NCBI36/hg18) (hg18)</option> <option value="hg17">Human May 2004 (NCBI35/hg17) (hg17)</option> ... </select>
>>> print p.filter_value( "hg17" ) hg17
-
class
galaxy.tools.parameters.basic.HiddenDataToolParameter(tool, elem)[source]¶ Bases:
galaxy.tools.parameters.basic.HiddenToolParameter,galaxy.tools.parameters.basic.DataToolParameterHidden parameter that behaves as a DataToolParameter. As with all hidden parameters, this is a HACK.
-
class
galaxy.tools.parameters.basic.HiddenToolParameter(tool, elem)[source]¶ Bases:
galaxy.tools.parameters.basic.ToolParameterParameter that takes one of two values.
- FIXME: This seems hacky, parameters should only describe things the user
- might change. It is used for ‘initializing’ the UCSC proxy tool
>>> p = HiddenToolParameter( None, XML( '<param name="blah" type="hidden" value="wax so rockin"/>' ) ) >>> print p.name blah >>> print p.get_html() <input type="hidden" name="blah" value="wax so rockin">
-
class
galaxy.tools.parameters.basic.IntegerToolParameter(tool, elem)[source]¶ Bases:
galaxy.tools.parameters.basic.TextToolParameterParameter that takes an integer value.
>>> p = IntegerToolParameter( None, XML( '<param name="blah" type="integer" size="4" value="10" />' ) ) >>> print p.name blah >>> print p.get_html() <input type="text" name="blah" size="4" value="10"> >>> type( p.from_html( "10" ) ) <type 'int'> >>> type( p.from_html( "bleh" ) ) Traceback (most recent call last): ... ValueError: An integer is required
-
dict_collection_visible_keys= ('name', 'type', 'label', 'help', 'min', 'max')¶
-
-
class
galaxy.tools.parameters.basic.LibraryDatasetToolParameter(tool, elem)[source]¶ Bases:
galaxy.tools.parameters.basic.ToolParameterParameter that lets users select a LDDA from a modal window, then use it within the wrapper.
-
class
galaxy.tools.parameters.basic.RuntimeValue[source]¶ Bases:
objectWrapper to note a value that is not yet set, but will be required at runtime.
-
class
galaxy.tools.parameters.basic.SelectToolParameter(tool, elem, context=None)[source]¶ Bases:
galaxy.tools.parameters.basic.ToolParameterParameter that takes on one (or many) or a specific set of values.
>>> p = SelectToolParameter( None, XML( ... ''' ... <param name="blah" type="select"> ... <option value="x">I am X</option> ... <option value="y" selected="true">I am Y</option> ... <option value="z">I am Z</option> ... </param> ... ''' ) ) >>> print p.name blah >>> print p.get_html() <select name="blah" last_selected_value="y"> <option value="x">I am X</option> <option value="y" selected>I am Y</option> <option value="z">I am Z</option> </select> >>> print p.get_html( value="z" ) <select name="blah" last_selected_value="z"> <option value="x">I am X</option> <option value="y">I am Y</option> <option value="z" selected>I am Z</option> </select> >>> print p.filter_value( "y" ) y
>>> p = SelectToolParameter( None, XML( ... ''' ... <param name="blah" type="select" multiple="true"> ... <option value="x">I am X</option> ... <option value="y" selected="true">I am Y</option> ... <option value="z" selected="true">I am Z</option> ... </param> ... ''' ) ) >>> print p.name blah >>> print p.get_html() <select name="blah" multiple last_selected_value="z"> <option value="x">I am X</option> <option value="y" selected>I am Y</option> <option value="z" selected>I am Z</option> </select> >>> print p.get_html( value=["x","y"]) <select name="blah" multiple last_selected_value="y"> <option value="x" selected>I am X</option> <option value="y" selected>I am Y</option> <option value="z">I am Z</option> </select> >>> print p.to_param_dict_string( ["y", "z"] ) y,z
>>> p = SelectToolParameter( None, XML( ... ''' ... <param name="blah" type="select" multiple="true" display="checkboxes"> ... <option value="x">I am X</option> ... <option value="y" selected="true">I am Y</option> ... <option value="z" selected="true">I am Z</option> ... </param> ... ''' ) ) >>> print p.name blah >>> print p.get_html() <div class="checkUncheckAllPlaceholder" checkbox_name="blah"></div> <div><input type="checkbox" name="blah" value="x" id="blah|x"><label class="inline" for="blah|x">I am X</label></div> <div class="odd_row"><input type="checkbox" name="blah" value="y" id="blah|y" checked='checked'><label class="inline" for="blah|y">I am Y</label></div> <div><input type="checkbox" name="blah" value="z" id="blah|z" checked='checked'><label class="inline" for="blah|z">I am Z</label></div> >>> print p.get_html( value=["x","y"]) <div class="checkUncheckAllPlaceholder" checkbox_name="blah"></div> <div><input type="checkbox" name="blah" value="x" id="blah|x" checked='checked'><label class="inline" for="blah|x">I am X</label></div> <div class="odd_row"><input type="checkbox" name="blah" value="y" id="blah|y" checked='checked'><label class="inline" for="blah|y">I am Y</label></div> <div><input type="checkbox" name="blah" value="z" id="blah|z"><label class="inline" for="blah|z">I am Z</label></div> >>> print p.to_param_dict_string( ["y", "z"] ) y,z
-
need_late_validation(trans, context)[source]¶ Determine whether we need to wait to validate this parameters value given the current state. For parameters with static options this is always false (can always validate immediately). For parameters with dynamic options, we need to check whether the other parameters which determine what options are valid have been set. For the old style dynamic options which do not specify dependencies, this is always true (must validate at runtime).
-
-
class
galaxy.tools.parameters.basic.TextToolParameter(tool, elem)[source]¶ Bases:
galaxy.tools.parameters.basic.ToolParameterParameter that can take on any text value.
>>> p = TextToolParameter( None, XML( '<param name="blah" type="text" size="4" value="default" />' ) ) >>> print p.name blah >>> print p.get_html() <input type="text" name="blah" size="4" value="default"> >>> print p.get_html( value="meh" ) <input type="text" name="blah" size="4" value="meh">
-
class
galaxy.tools.parameters.basic.ToolParameter(tool, param, context=None)[source]¶ Bases:
object,galaxy.model.item_attrs.DictifiableDescribes a parameter accepted by a tool. This is just a simple stub at the moment but in the future should encapsulate more complex parameters (lists of valid choices, validation logic, ...)
-
dict_collection_visible_keys= ('name', 'type', 'label', 'help')¶
-
filter_value(value, trans=None, other_values={})[source]¶ Parse the value returned by the view into a form usable by the tool OR raise a ValueError.
-
from_html(value, trans=None, other_values={})[source]¶ Convert a value from an HTML POST into the parameters preferred value format.
-
get_html(trans=None, value=None, other_values={})[source]¶ Returns the html widget corresponding to the parameter. Optionally attempt to retain the current value specific by ‘value’
-
get_initial_value_from_history_prevent_repeats(trans, context, already_used, history=None)[source]¶ Get the starting value for the parameter, but if fetching from the history, try to find a value that has not yet been used. already_used is a list of objects that tools must manipulate (by adding to it) to store a memento that they can use to detect if a value has already been chosen from the history. This is to support the capability to choose each dataset once
-
get_required_enctype()[source]¶ If this parameter needs the form to have a specific encoding return it, otherwise return None (indicating compatibility with any encoding)
-
to_dict(trans, view='collection', value_mapper=None)[source]¶ to_dict tool parameter. This can be overridden by subclasses.
-
to_param_dict_string(value, other_values={})[source]¶ Called via __str__ when used in the Cheetah template
-
to_python(value, app)[source]¶ Convert a value created with to_string back to an object representation
-
value_to_display_text(value, app)[source]¶ Convert a value to a text representation suitable for displaying to the user
-
visible¶ Return true if the parameter should be rendered on the form
-
dynamic_options Module¶
Support for generating the options for a SelectToolParameter dynamically (based on the values of other parameters or other aspects of the current state)
-
class
galaxy.tools.parameters.dynamic_options.AdditionalValueFilter(d_option, elem)[source]¶ Bases:
galaxy.tools.parameters.dynamic_options.FilterAdds a single static value to an options list.
Type: add_value
- Required Attributes:
- value: value to appear in select list
- Optional Attributes:
- name: Display name to appear in select list (value) index: Index of option list to add value (APPEND)
-
class
galaxy.tools.parameters.dynamic_options.AttributeValueSplitterFilter(d_option, elem)[source]¶ Bases:
galaxy.tools.parameters.dynamic_options.FilterFilters a list of attribute-value pairs to be unique attribute names.
Type: attribute_value_splitter
- Required Attributes:
- column: column in options to compare with
- Optional Attributes:
- pair_separator: Split column by this (,) name_val_separator: Split name-value pair by this ( whitespace )
-
class
galaxy.tools.parameters.dynamic_options.DataMetaFilter(d_option, elem)[source]¶ Bases:
galaxy.tools.parameters.dynamic_options.FilterFilters a list of options on a column by a dataset metadata value.
Type: data_meta
When no ‘from’ source has been specified in the <options> tag, this will populate the options list with (meta_value, meta_value, False). Otherwise, options which do not match the metadata value in the column are discarded.
Required Attributes:
- ref: Name of input dataset
- key: Metadata key to use for comparison
- column: column in options to compare with (not required when not associated with input options)
Optional Attributes:
- multiple: Option values are multiple, split column by separator (True)
- separator: When multiple split by this (,)
-
class
galaxy.tools.parameters.dynamic_options.DynamicOptions(elem, tool_param)[source]¶ Bases:
objectHandles dynamically generated SelectToolParameter options
-
column_spec_to_index(column_spec)[source]¶ Convert a column specification (as read from the config file), to an index. A column specification can just be a number, a column name, or a column alias.
-
get_dependency_names()[source]¶ Return the names of parameters these options depend on – both data and other param types.
-
get_field_by_name_for_value(field_name, value, trans, other_values)[source]¶ Get contents of field by name for specified value.
-
-
class
galaxy.tools.parameters.dynamic_options.Filter(d_option, elem)[source]¶ Bases:
objectA filter takes the current options list and modifies it.
-
filter_options(options, trans, other_values)[source]¶ Returns a list of options after the filter is applied
-
-
class
galaxy.tools.parameters.dynamic_options.MultipleSplitterFilter(d_option, elem)[source]¶ Bases:
galaxy.tools.parameters.dynamic_options.FilterTurns a single line of options into multiple lines, by splitting a column and creating a line for each item.
Type: multiple_splitter
- Required Attributes:
- column: column in options to compare with
- Optional Attributes:
- separator: Split column by this (,)
-
class
galaxy.tools.parameters.dynamic_options.ParamValueFilter(d_option, elem)[source]¶ Bases:
galaxy.tools.parameters.dynamic_options.FilterFilters a list of options on a column by the value of another input.
Type: param_value
Required Attributes:
- ref: Name of input value
- column: column in options to compare with
Optional Attributes:
- keep: Keep columns matching value (True)
Discard columns matching value (False)
ref_attribute: Period (.) separated attribute chain of input (ref) to use as value for filter
-
class
galaxy.tools.parameters.dynamic_options.RemoveValueFilter(d_option, elem)[source]¶ Bases:
galaxy.tools.parameters.dynamic_options.FilterRemoves a value from an options list.
Type: remove_value
Required Attributes:
value: value to remove from select list or ref: param to refer to or meta_ref: dataset to refer to key: metadata key to compare to
-
class
galaxy.tools.parameters.dynamic_options.SortByColumnFilter(d_option, elem)[source]¶ Bases:
galaxy.tools.parameters.dynamic_options.FilterSorts an options list by a column
Type: sort_by
- Required Attributes:
- column: column to sort by
-
class
galaxy.tools.parameters.dynamic_options.StaticValueFilter(d_option, elem)[source]¶ Bases:
galaxy.tools.parameters.dynamic_options.FilterFilters a list of options on a column by a static value.
Type: static_value
- Required Attributes:
- value: static value to compare to column: column in options to compare with
- Optional Attributes:
- keep: Keep columns matching value (True)
- Discard columns matching value (False)
-
class
galaxy.tools.parameters.dynamic_options.UniqueValueFilter(d_option, elem)[source]¶ Bases:
galaxy.tools.parameters.dynamic_options.FilterFilters a list of options to be unique by a column value.
Type: unique_value
- Required Attributes:
- column: column in options to compare with
grouping Module¶
Constructs for grouping tool parameters
-
class
galaxy.tools.parameters.grouping.Conditional[source]¶ Bases:
galaxy.tools.parameters.grouping.Group-
is_job_resource_conditional¶
-
label¶
-
type= 'conditional'¶
-
-
class
galaxy.tools.parameters.grouping.ConditionalWhen[source]¶ Bases:
object,galaxy.model.item_attrs.Dictifiable-
dict_collection_visible_keys= ('value',)¶
-
-
class
galaxy.tools.parameters.grouping.Group[source]¶ Bases:
object,galaxy.model.item_attrs.Dictifiable-
dict_collection_visible_keys= ('name', 'type')¶
-
get_initial_value(trans, context, history=None)[source]¶ Return the initial state/value for this group
-
value_from_basic(value, app, ignore_errors=False)[source]¶ Convert a basic representation as produced by value_to_basic back into the preferred value form.
-
value_to_basic(value, app)[source]¶ Convert value to a (possibly nested) representation using only basic types (dict, list, tuple, str, unicode, int, long, float, bool, None)
-
visible¶
-
-
class
galaxy.tools.parameters.grouping.Repeat[source]¶ Bases:
galaxy.tools.parameters.grouping.Group-
dict_collection_visible_keys= ('name', 'type', 'title', 'help', 'default', 'min', 'max')¶
-
title_plural¶
-
type= 'repeat'¶
-
-
class
galaxy.tools.parameters.grouping.UploadDataset[source]¶ Bases:
galaxy.tools.parameters.grouping.Group-
title_plural¶
-
type= 'upload_dataset'¶
-
input_translation Module¶
Tool Input Translation.
-
class
galaxy.tools.parameters.input_translation.ToolInputTranslator[source]¶ Bases:
objectHandles Tool input translation. This is used for data source tools
>>> from galaxy.util import Params >>> from elementtree.ElementTree import XML >>> translator = ToolInputTranslator.from_element( XML( ... ''' ... <request_param_translation> ... <request_param galaxy_name="URL_method" remote_name="URL_method" missing="post" /> ... <request_param galaxy_name="URL" remote_name="URL" missing="" > ... <append_param separator="&" first_separator="?" join="="> ... <value name="_export" missing="1" /> ... <value name="GALAXY_URL" missing="0" /> ... </append_param> ... </request_param> ... <request_param galaxy_name="dbkey" remote_name="db" missing="?" /> ... <request_param galaxy_name="organism" remote_name="org" missing="unknown species" /> ... <request_param galaxy_name="table" remote_name="hgta_table" missing="unknown table" /> ... <request_param galaxy_name="description" remote_name="hgta_regionType" missing="no description" /> ... <request_param galaxy_name="data_type" remote_name="hgta_outputType" missing="tabular" > ... <value_translation> ... <value galaxy_value="tabular" remote_value="primaryTable" /> ... <value galaxy_value="tabular" remote_value="selectedFields" /> ... <value galaxy_value="wig" remote_value="wigData" /> ... <value galaxy_value="interval" remote_value="tab" /> ... <value galaxy_value="html" remote_value="hyperlinks" /> ... <value galaxy_value="fasta" remote_value="sequence" /> ... </value_translation> ... </request_param> ... </request_param_translation> ... ''' ) ) >>> params = Params( { 'db':'hg17', 'URL':'URL_value', 'org':'Human', 'hgta_outputType':'primaryTable' } ) >>> translator.translate( params ) >>> print params {'hgta_outputType': 'primaryTable', 'data_type': 'tabular', 'table': 'unknown table', 'URL': 'URL_value?GALAXY_URL=0&_export=1', 'org': 'Human', 'URL_method': 'post', 'db': 'hg17', 'organism': 'Human', 'dbkey': 'hg17', 'description': 'no description'}
output Module¶
Support for dynamically modifying output attributes.
-
class
galaxy.tools.parameters.output.BooleanFilter(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionOptionFilter-
tag= 'boolean'¶
-
-
class
galaxy.tools.parameters.output.ColumnReplaceFilter(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionOptionFilter-
tag= 'column_replace'¶
-
-
class
galaxy.tools.parameters.output.ColumnStripFilter(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionOptionFilter-
tag= 'column_strip'¶
-
-
class
galaxy.tools.parameters.output.DatatypeIsInstanceToolOutputActionConditionalWhen(parent, config_elem, value)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionConditionalWhen-
tag= 'when datatype_isinstance'¶
-
-
class
galaxy.tools.parameters.output.FormatToolOutputAction(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputAction-
tag= 'format'¶
-
-
class
galaxy.tools.parameters.output.FromDataTableOutputActionOption(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionOption-
tag= 'from_data_table'¶
-
-
class
galaxy.tools.parameters.output.FromFileToolOutputActionOption(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionOption-
tag= 'from_file'¶
-
-
class
galaxy.tools.parameters.output.FromParamToolOutputActionOption(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionOption-
tag= 'from_param'¶
-
-
class
galaxy.tools.parameters.output.InsertColumnToolOutputActionOptionFilter(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionOptionFilter-
tag= 'insert_column'¶
-
-
class
galaxy.tools.parameters.output.MetadataToolOutputAction(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputAction-
tag= 'metadata'¶
-
-
class
galaxy.tools.parameters.output.MetadataValueFilter(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionOptionFilter-
tag= 'metadata_value'¶
-
-
class
galaxy.tools.parameters.output.MultipleSplitterFilter(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionOptionFilter-
tag= 'multiple_splitter'¶
-
-
class
galaxy.tools.parameters.output.NullToolOutputActionOption(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionOption-
tag= 'null_option'¶
-
-
class
galaxy.tools.parameters.output.ParamValueToolOutputActionOptionFilter(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionOptionFilter-
tag= 'param_value'¶
-
-
class
galaxy.tools.parameters.output.StringFunctionFilter(parent, elem)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionOptionFilter-
tag= 'string_function'¶
-
-
class
galaxy.tools.parameters.output.ToolOutputAction(parent, elem)[source]¶ Bases:
object-
tag= 'action'¶
-
tool¶
-
-
class
galaxy.tools.parameters.output.ToolOutputActionConditional(parent, config_elem)[source]¶ Bases:
object-
tag= 'conditional'¶
-
tool¶
-
-
class
galaxy.tools.parameters.output.ToolOutputActionConditionalWhen(parent, config_elem, value)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionGroup-
tag= 'when'¶
-
-
class
galaxy.tools.parameters.output.ToolOutputActionGroup(parent, config_elem)[source]¶ Bases:
objectManages a set of tool output dataset actions directives
-
tag= 'group'¶
-
tool¶
-
-
class
galaxy.tools.parameters.output.ToolOutputActionOption(parent, elem)[source]¶ Bases:
object-
tag= 'object'¶
-
tool¶
-
-
class
galaxy.tools.parameters.output.ToolOutputActionOptionFilter(parent, elem)[source]¶ Bases:
object-
tag= 'filter'¶
-
tool¶
-
-
class
galaxy.tools.parameters.output.ValueToolOutputActionConditionalWhen(parent, config_elem, value)[source]¶ Bases:
galaxy.tools.parameters.output.ToolOutputActionConditionalWhen-
tag= 'when value'¶
-
-
galaxy.tools.parameters.output.action_type¶ alias of
FormatToolOutputAction
-
galaxy.tools.parameters.output.filter_type¶ alias of
ColumnReplaceFilter
-
galaxy.tools.parameters.output.option_type¶ alias of
FromDataTableOutputActionOption
sanitize Module¶
Tool Parameter specific sanitizing.
-
class
galaxy.tools.parameters.sanitize.ToolParameterSanitizer[source]¶ Bases:
objectHandles tool parameter specific sanitizing.
>>> from elementtree.ElementTree import XML >>> sanitizer = ToolParameterSanitizer.from_element( XML( ... ''' ... <sanitizer invalid_char=""> ... <valid initial="string.letters"/> ... </sanitizer> ... ''' ) ) >>> sanitizer.sanitize_param( ''.join( sorted( [ c for c in string.printable ] ) ) ) == ''.join( sorted( [ c for c in string.letters ] ) ) True >>> slash = chr( 92 ) >>> sanitizer = ToolParameterSanitizer.from_element( XML( ... ''' ... <sanitizer> ... <valid initial="none"> ... <add preset="string.printable"/> ... <remove value="""/> ... <remove value="%s"/> ... </valid> ... <mapping initial="none"> ... <add source=""" target="%s""/> ... <add source="%s" target="%s%s"/> ... </mapping> ... </sanitizer> ... ''' % ( slash, slash, slash, slash, slash ) ) ) >>> text = '%s"$rm&#!' % slash >>> [ c for c in sanitizer.sanitize_param( text ) ] == [ slash, slash, slash, '"', '$', 'r', 'm', '&', '#', '!' ] True
-
DEFAULT_INVALID_CHAR= 'X'¶
-
MAPPING_PRESET= {'default': {'@': '__at__', '\t': '__tc__', '\n': '__cn__', '\r': '__cr__', '[': '__ob__', ']': '__cb__', '#': '__pd__', '"': '__dq__', "'": '__sq__', '{': '__oc__', '}': '__cc__', '<': '__lt__', '>': '__gt__'}, 'none': {}}¶
-
VALID_PRESET= {'default': 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 -=_.()/+*^,:?!', 'none': ''}¶
-
validation Module¶
Classes related to parameter validation.
-
class
galaxy.tools.parameters.validation.DatasetOkValidator(message=None)[source]¶ Bases:
galaxy.tools.parameters.validation.ValidatorValidator that checks if a dataset is in an ‘ok’ state
-
class
galaxy.tools.parameters.validation.EmptyTextfieldValidator(message=None)[source]¶ Bases:
galaxy.tools.parameters.validation.ValidatorValidator that checks for empty text field
-
class
galaxy.tools.parameters.validation.ExpressionValidator(message, expression, substitute_value_in_message)[source]¶ Bases:
galaxy.tools.parameters.validation.ValidatorValidator that evaluates a python expression using the value
>>> from galaxy.tools.parameters import ToolParameter >>> p = ToolParameter.build( None, XML( ''' ... <param name="blah" type="text" size="10" value="10"> ... <validator type="expression" message="Not gonna happen">value.lower() == "foo"</validator> ... </param> ... ''' ) ) >>> t = p.validate( "Foo" ) >>> t = p.validate( "foo" ) >>> t = p.validate( "Fop" ) Traceback (most recent call last): ... ValueError: Not gonna happen
-
class
galaxy.tools.parameters.validation.InRangeValidator(message, range_min, range_max)[source]¶ Bases:
galaxy.tools.parameters.validation.ValidatorValidator that ensures a number is in a specific range
>>> from galaxy.tools.parameters import ToolParameter >>> p = ToolParameter.build( None, XML( ''' ... <param name="blah" type="integer" size="10" value="10"> ... <validator type="in_range" message="Not gonna happen" min="10" max="20"/> ... </param> ... ''' ) ) >>> t = p.validate( 10 ) >>> t = p.validate( 15 ) >>> t = p.validate( 20 ) >>> t = p.validate( 21 ) Traceback (most recent call last): ... ValueError: Not gonna happen
-
exception
galaxy.tools.parameters.validation.LateValidationError(message)[source]¶ Bases:
exceptions.Exception
-
class
galaxy.tools.parameters.validation.LengthValidator(message, length_min, length_max)[source]¶ Bases:
galaxy.tools.parameters.validation.ValidatorValidator that ensures the length of the provided string (value) is in a specific range
>>> from galaxy.tools.parameters import ToolParameter >>> p = ToolParameter.build( None, XML( ''' ... <param name="blah" type="text" size="10" value="foobar"> ... <validator type="length" min="2" max="8"/> ... </param> ... ''' ) ) >>> t = p.validate( "foo" ) >>> t = p.validate( "bar" ) >>> t = p.validate( "f" ) Traceback (most recent call last): ... ValueError: Must have length of at least 2 >>> t = p.validate( "foobarbaz" ) Traceback (most recent call last): ... ValueError: Must have length no more than 8
-
class
galaxy.tools.parameters.validation.MetadataInDataTableColumnValidator(tool_data_table, metadata_name, metadata_column, message='Value for metadata not found.', line_startswith=None)[source]¶ Bases:
galaxy.tools.parameters.validation.ValidatorValidator that checks if the value for a dataset’s metadata item exists in a file.
-
class
galaxy.tools.parameters.validation.MetadataInFileColumnValidator(filename, metadata_name, metadata_column, message='Value for metadata not found.', line_startswith=None)[source]¶ Bases:
galaxy.tools.parameters.validation.ValidatorValidator that checks if the value for a dataset’s metadata item exists in a file.
-
class
galaxy.tools.parameters.validation.MetadataValidator(message=None, check='', skip='')[source]¶ Bases:
galaxy.tools.parameters.validation.ValidatorValidator that checks for missing metadata
-
class
galaxy.tools.parameters.validation.NoOptionsValidator(message=None)[source]¶ Bases:
galaxy.tools.parameters.validation.ValidatorValidator that checks for empty select list
-
class
galaxy.tools.parameters.validation.RegexValidator(message, expression)[source]¶ Bases:
galaxy.tools.parameters.validation.ValidatorValidator that evaluates a regular expression
>>> from galaxy.tools.parameters import ToolParameter >>> p = ToolParameter.build( None, XML( ''' ... <param name="blah" type="text" size="10" value="10"> ... <validator type="regex" message="Not gonna happen">[Ff]oo</validator> ... </param> ... ''' ) ) >>> t = p.validate( "Foo" ) >>> t = p.validate( "foo" ) >>> t = p.validate( "Fop" ) Traceback (most recent call last): ... ValueError: Not gonna happen
-
class
galaxy.tools.parameters.validation.UnspecifiedBuildValidator(message=None)[source]¶ Bases:
galaxy.tools.parameters.validation.ValidatorValidator that checks for dbkey not equal to ‘?’