Warning
This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
galaxy.tools.data package¶
Manage tool data tables, which store (at the application level) data that is used by tools, for example in the generation of dynamic options. Tables are loaded and stored by names which tools use to refer to them. This allows users to configure data tables for a local Galaxy instance without needing to modify the tool configurations.
- class galaxy.tools.data.ToolDataPathFiles(tool_data_path)[source]¶
Bases:
object
- property tool_data_path_files¶
- class galaxy.tools.data.ToolDataTableManager(tool_data_path, config_filename=None, tool_data_table_config_path_set=None, other_config_dict=None)[source]¶
Bases:
galaxy.util.dictifiable.Dictifiable
Manages a collection of tool data tables
- __init__(tool_data_path, config_filename=None, tool_data_table_config_path_set=None, other_config_dict=None)[source]¶
- load_from_config_file(config_filename, tool_data_path, from_shed_config=False)[source]¶
This method is called under 3 conditions:
When the ToolDataTableManager is initialized (see __init__ above).
Just after the ToolDataTableManager is initialized and the additional entries defined by shed_tool_data_table_conf.xml are being loaded into the ToolDataTableManager.data_tables.
When a tool shed repository that includes a tool_data_table_conf.xml.sample file is being installed into a local Galaxy instance. In this case, we have 2 entry types to handle, files whose root tag is <tables>, for example:
- add_new_entries_from_config_file(config_filename, tool_data_path, shed_tool_data_table_config, persist=False)[source]¶
This method is called when a tool shed repository that includes a tool_data_table_conf.xml.sample file is being installed into a local galaxy instance. We have 2 cases to handle, files whose root tag is <tables>, for example:
<tables> <!-- Location of Tmap files --> <table name="tmap_indexes" comment_char="#"> <columns>value, dbkey, name, path</columns> <file path="tool-data/tmap_index.loc" /> </table> </tables>
and files whose root tag is <table>, for example:
<!-- Location of Tmap files --> <table name="tmap_indexes" comment_char="#"> <columns>value, dbkey, name, path</columns> <file path="tool-data/tmap_index.loc" /> </table>
- to_xml_file(shed_tool_data_table_config, new_elems=None, remove_elems=None)[source]¶
Write the current in-memory version of the shed_tool_data_table_conf.xml file to disk. remove_elems are removed before new_elems are added.
- class galaxy.tools.data.ToolDataTable(config_element, tool_data_path, from_shed_config=False, filename=None, tool_data_path_files=None, other_config_dict=None)[source]¶
Bases:
object
- classmethod from_elem(table_elem, tool_data_path, from_shed_config, filename, tool_data_path_files, other_config_dict=None)[source]¶
- __init__(config_element, tool_data_path, from_shed_config=False, filename=None, tool_data_path_files=None, other_config_dict=None)[source]¶
- class galaxy.tools.data.TabularToolDataTable(config_element, tool_data_path, from_shed_config=False, filename=None, tool_data_path_files=None, other_config_dict=None)[source]¶
Bases:
galaxy.tools.data.ToolDataTable
,galaxy.util.dictifiable.Dictifiable
Data stored in a tabular / separated value format on disk, allows multiple files to be merged but all must have the same column definitions:
<table type="tabular" name="test"> <column name='...' index = '...' /> <file path="..." /> <file path="..." /> </table>
- dict_collection_visible_keys = ['name']¶
- dict_element_visible_keys = ['name', 'fields']¶
- dict_export_visible_keys = ['name', 'data', 'largest_index', 'columns', 'missing_index_file']¶
- __init__(config_element, tool_data_path, from_shed_config=False, filename=None, tool_data_path_files=None, other_config_dict=None)[source]¶
- configure_and_load(config_element, tool_data_path, from_shed_config=False, url_timeout=10)[source]¶
Configure and load table from an XML element.
- merge_tool_data_table(other_table, allow_duplicates=True, persist=False, entry_source=None, **kwd)[source]¶
- parse_column_spec(config_element)[source]¶
Parse column definitions, which can either be a set of ‘column’ elements with a name and index (as in dynamic options config), or a shorthand comma separated list of names in order as the text of a ‘column_names’ element.
A column named ‘value’ is required.
- parse_file_fields(filename, errors=None, here='__HERE__')[source]¶
Parse separated lines from file and return a list of tuples.
TODO: Allow named access to fields using the column names.
- get_entry(query_attr, query_val, return_attr, default=None)[source]¶
Returns table entry associated with a col/val pair.
- get_entries(query_attr, query_val, return_attr, default=None, limit=None)[source]¶
Returns table entry associated with a col/val pair.
- filter_file_fields(loc_file, values)[source]¶
Reads separated lines from file and print back only the lines that pass a filter.
- property xml_string¶
- class galaxy.tools.data.RefgenieToolDataTable(config_element, tool_data_path, from_shed_config=False, filename=None, tool_data_path_files=None, other_config_dict=None)[source]¶
Bases:
galaxy.tools.data.TabularToolDataTable
Data stored in refgenie
<table name="all_fasta" type="refgenie" asset="fasta" > <file path="refgenie.yml" /> <field name="value" template="true">${__REFGENIE_UUID__}</field> <field name="dbkey" template="true">${__REFGENIE_GENOME__}</field> <field name="name" template="true">${__REFGENIE_DISPLAY_NAME__}</field> <field name="path" template="true">${__REFGENIE_ASSET__}</field> </table>
- dict_collection_visible_keys = ['name']¶
- dict_element_visible_keys = ['name', 'fields']¶
- dict_export_visible_keys = ['name', 'data', 'rg_asset', 'largest_index', 'columns', 'missing_index_file']¶
- __init__(config_element, tool_data_path, from_shed_config=False, filename=None, tool_data_path_files=None, other_config_dict=None)[source]¶
- configure_and_load(config_element, tool_data_path, from_shed_config=False, url_timeout=10)[source]¶
Configure and load table from an XML element.
- parse_column_spec(config_element)[source]¶
Parse column definitions, which can either be a set of ‘column’ elements with a name and index (as in dynamic options config), or a shorthand comma separated list of names in order as the text of a ‘column_names’ element.
A column named ‘value’ is required.