Warning

This document is for an in-development version 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

extend base tool data table implementations with special implementations requiring full Galaxy dependencies (specifically the refgenie configuration client currently).

class galaxy.tools.data.RefgenieToolDataTable(config_element, tool_data_path, tool_data_path_files, from_shed_config=False, filename=None, other_config_dict=None)[source]

Bases: 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']
type_key: str = 'refgenie'
__init__(config_element, tool_data_path, tool_data_path_files, from_shed_config=False, filename=None, other_config_dict=None) None[source]
data: List[List[str]]
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.

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.

empty_field_value: str
empty_field_values: Dict[str | None, str]
filenames: Dict[str, FileNameInfoT]
class galaxy.tools.data.TabularToolDataField(data: Dict)[source]

Bases: Dictifiable

dict_collection_visible_keys: List[str] = []
__init__(data: Dict)[source]
get_base_path()[source]
get_base_dir()[source]
clean_base_dir(path)[source]
get_files()[source]
get_filesize_map(rm_base_dir=False)[source]
get_fingerprint()[source]
to_dict(view: str = 'collection', value_mapper: Dict[str, Callable] | None = None) Dict[str, Any][source]

Return item dictionary.

class galaxy.tools.data.TabularToolDataTable(config_element: Element, tool_data_path: str | PathLike | None, tool_data_path_files: ToolDataPathFiles, from_shed_config: bool = False, filename: str | PathLike | None = None, other_config_dict: StoresConfigFilePaths | None = None)[source]

Bases: ToolDataTable

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']
type_key: str = 'tabular'
__init__(config_element: Element, tool_data_path: str | PathLike | None, tool_data_path_files: ToolDataPathFiles, from_shed_config: bool = False, filename: str | PathLike | None = None, other_config_dict: StoresConfigFilePaths | None = None) None[source]
data: List[List[str]]
configure_and_load(config_element: Element, tool_data_path: str | PathLike | None, from_shed_config: bool = False, url_timeout: float = 10) None[source]

Configure and load table from an XML element.

merge_tool_data_table(other_table, allow_duplicates=True, persist=False, **kwd)[source]
handle_found_index_file(filename)[source]
get_fields() List[List[str]][source]
get_field(value)[source]
get_named_fields_list() List[Dict[str | int, str]][source]
get_version_fields()[source]
parse_column_spec(config_element: Element) None[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.

extend_data_with(filename: str, errors: List[str] | None = None) None[source]
parse_file_fields(filename: str, errors: List[str] | None = None, here: str = '__HERE__') List[List[str]][source]

Parse separated lines from file and return a list of tuples.

TODO: Allow named access to fields using the column names.

get_column_name_list() List[str | None][source]
get_entry(query_attr: str, query_val: str, return_attr: str, default: None = None)[source]

Returns table entry associated with a col/val pair.

get_entries(query_attr: str, query_val: str, return_attr: str, limit=None) List[source]

Returns table entries associated with a col/val pair.

get_filename_for_source(source: dict | RepoInfo | DataManager | None, default: str | None = None) str | None[source]
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
to_dict(view: str = 'collection', value_mapper: Dict[str, Callable] | None = None) Dict[str, Any][source]

Return item dictionary.

empty_field_value: str
empty_field_values: Dict[str | None, str]
filenames: Dict[str, FileNameInfoT]
class galaxy.tools.data.ToolDataTable(config_element: Element, tool_data_path: str | PathLike | None, tool_data_path_files: ToolDataPathFiles, from_shed_config: bool = False, filename: str | PathLike | None = None, other_config_dict: StoresConfigFilePaths | None = None)[source]

Bases: Dictifiable

type_key: str
data: List[List[str]]
classmethod from_dict(d)[source]
__init__(config_element: Element, tool_data_path: str | PathLike | None, tool_data_path_files: ToolDataPathFiles, from_shed_config: bool = False, filename: str | PathLike | None = None, other_config_dict: StoresConfigFilePaths | None = None) None[source]
empty_field_value: str
empty_field_values: Dict[str | None, str]
filenames: Dict[str, FileNameInfoT]
get_empty_field_by_name(name: str | None) str[source]
add_entry(entry: List[str] | Dict[str, str], allow_duplicates: bool = True, persist: bool = False, entry_source: dict | RepoInfo | DataManager | None = None, tool_data_file_path: str | None = None, use_first_file_path: bool = False, **kwd) int[source]
add_entries(entries: List[List[str]], allow_duplicates: bool = True, persist: bool = False, entry_source: dict | RepoInfo | DataManager | None = None, **kwd) int[source]
remove_entry(values)[source]
is_current_version(other_version)[source]
merge_tool_data_table(other_table: ToolDataTable, allow_duplicates: bool = True, persist: bool = False, **kwd) int[source]
reload_from_files() int[source]
class galaxy.tools.data.ToolDataTableManager(tool_data_path: str, config_filename: str | PathLike | List[str | PathLike] | None = None, tool_data_table_config_path_set=None, other_config_dict: StoresConfigFilePaths | None = None)[source]

Bases: ToolDataTableManager

tool_data_table_types = {'refgenie': <class 'galaxy.tools.data.RefgenieToolDataTable'>, 'tabular': <class 'galaxy.tool_util.data.TabularToolDataTable'>}
data_tables: Dict[str, ToolDataTable]