Mercurial > repos > iuc > data_manager_funannotate
changeset 0:ef7f9e2f32f2 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_funannotate commit 9613152729099079c7465c3d5d42005ef22ca91e"
author | iuc |
---|---|
date | Thu, 26 Aug 2021 06:54:45 +0000 |
parents | |
children | 8dff71edbce5 |
files | data_manager/funannotate.py data_manager/funannotate.xml data_manager_conf.xml test-data/funannotate.loc tool-data/funannotate.loc.sample tool_data_table_conf.xml.sample tool_data_table_conf.xml.test |
diffstat | 7 files changed, 145 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/funannotate.py Thu Aug 26 06:54:45 2021 +0000 @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +import argparse +import json +import operator +import os +import subprocess +import sys +from datetime import datetime + + +if __name__ == "__main__": + + parser = argparse.ArgumentParser() + parser.add_argument('--partial', dest='partial', action='store_true', help='Only download a small subset of data (for testing)') + parser.add_argument("version_id") + parser.add_argument("datatable_name") + parser.add_argument("galaxy_datamanager_filename") + args = parser.parse_args() + + with open(args.galaxy_datamanager_filename) as fh: + config = json.load(fh) + + output_directory = config.get("output_data", [{}])[0].get("extra_files_path", None) + data_manager_dict = {} + data_manager_dict["data_tables"] = config.get("data_tables", {}) + data_manager_dict["data_tables"][args.datatable_name] = data_manager_dict[ + "data_tables" + ].get(args.datatable_name, []) + + os.mkdir(output_directory) + cmd_args = ['funannotate', 'setup', '-d', output_directory, '-b', 'all'] + if args.partial: + cmd_args += ['-i', 'merops', '-b', 'eukaryota'] + proc = subprocess.Popen(args=cmd_args, shell=False, cwd=output_directory) + return_code = proc.wait() + if return_code: + print("Error downloading Funannotate database.", file=sys.stderr) + sys.exit(return_code) + + version_id = datetime.today().strftime('%Y-%m-%d-%H%M%S') + + version = '1.0' + + data_manager_dict["data_tables"][args.datatable_name].append( + dict( + value=version_id, + description="Funannotate database %s" % version_id, + format_version=version, + path=output_directory, + ) + ) + + data_manager_dict["data_tables"][args.datatable_name].sort( + key=operator.itemgetter("value"), reverse=True + ) + with open(args.galaxy_datamanager_filename, "w") as fh: + json.dump(data_manager_dict, fh, indent=2, sort_keys=True)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/funannotate.xml Thu Aug 26 06:54:45 2021 +0000 @@ -0,0 +1,39 @@ +<tool id="data_manager_funannotate" name="Funannotate data manager" version="0.0.1" tool_type="manage_data" profile="20.01"> + <requirements> + <requirement type="package" version="1.8.7">funannotate</requirement> + </requirements> + <version_command>funannotate check --show-versions</version_command> + <command detect_errors="exit_code"><![CDATA[ +python '$__tool_directory__/funannotate.py' +$partial_data +\$(date +'%Y-%m-%d-%H%M%S') +'funannotate' +'${output_file}' + ]]></command> + <inputs> + <param name="partial_data" type="hidden" value="" help="Used for testing"/> + </inputs> + <outputs> + <data name="output_file" format="data_manager_json"/> + </outputs> + <tests> + <test> + <param name="partial_data" value="--partial"/> + <output name="output_file"> + <assert_contents> + <has_text text="Funannotate database "/> + <has_text text='"format_version": "1.0"'/> + </assert_contents> + </output> + </test> + </tests> + <help><![CDATA[ + This data managers fetches data from various databases for the funannotate + annotation tool and updates the funannotate data table. + + .. _funannotate: https://funannotate.readthedocs.io + ]]></help> + <citations> + <citation type="doi">10.5281/zenodo.4054262</citation> + </citations> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager_conf.xml Thu Aug 26 06:54:45 2021 +0000 @@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<data_managers> + <data_manager tool_file="data_manager/funannotate.xml" id="data_manager_funannotate"> + <data_table name="funannotate"> + <output> + <column name="value" /> + <column name="description" /> + <column name="format_version" /> + <column name="path" output_ref="output_file" > + <move type="directory" relativize_symlinks="True"> + <target base="${GALAXY_DATA_MANAGER_DATA_PATH}">funannotate/${value}</target> + </move> + <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/funannotate/${value}</value_translation> + <value_translation type="function">abspath</value_translation> + </column> + </output> + </data_table> + </data_manager> +</data_managers>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/funannotate.loc Thu Aug 26 06:54:45 2021 +0000 @@ -0,0 +1,9 @@ +# this is a tab separated file describing the location of funannotate databases used for the +# funannotate annotation tool +# +# the columns are: +# value description format_version path +# +# for example +# 2021-07-20-120000 Funannotate database 2021-07-20-120000 1.0 /tmp/database/funannotate/2021-07-20-120000 +# 2021-05-27-120000 Funannotate database 2021-05-27-120000 3.0 /tmp/database/funannotate/2021-05-27-120000
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool-data/funannotate.loc.sample Thu Aug 26 06:54:45 2021 +0000 @@ -0,0 +1,8 @@ +# this is a tab separated file describing the location of funannotate databases used for the +# funannotate annotation tool +# +# the columns are: +# value description format_version path +# +# for example +# 2021-07-20-120000 Funannotate database 2021-07-20-120000 1.0 /tmp/database/funannotate/funannotate/2021-07-20-120000
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.sample Thu Aug 26 06:54:45 2021 +0000 @@ -0,0 +1,6 @@ +<tables> + <table name="funannotate" comment_char="#" allow_duplicate_entries="False"> + <columns>value, description, format_version, path</columns> + <file path="tool-data/funannotate.loc" /> + </table> +</tables>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.test Thu Aug 26 06:54:45 2021 +0000 @@ -0,0 +1,6 @@ +<tables> + <table name="funannotate" comment_char="#" allow_duplicate_entries="False"> + <columns>value, description, format_version, path</columns> + <file path="${__HERE__}/test-data/funannotate.loc" /> + </table> +</tables>