Mercurial > repos > iuc > data_manager_funannotate_options
changeset 0:e22da646fed7 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/data_managers/data_manager_funannotate commit 0b6712733bce2e4ec6b276a6dec9c7b4bff5a5cd
author | iuc |
---|---|
date | Sun, 09 Mar 2025 09:34:24 +0000 (5 weeks ago) |
parents | |
children | |
files | data_manager/extract.py data_manager/funannotate_options.xml data_manager_conf.xml test-data/funannotate.loc test-data/funannotate_options.loc tool-data/funannotate.loc.sample tool-data/funannotate_options.loc.sample tool_data_table_conf.xml.sample tool_data_table_conf.xml.test |
diffstat | 9 files changed, 179 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/extract.py Sun Mar 09 09:34:24 2025 +0000 @@ -0,0 +1,49 @@ +import json +import os +import sys + +fun_db = sys.argv[1] +fun_db_value = sys.argv[2] +dmjson = sys.argv[3] + +content = [] +# get options for parameter --busco_db +# which are just the subfolders of the db dir (minus outgroups/ and trained_species/) +# https://github.com/nextgenusfs/funannotate/blob/8cc40728fee61566fdf736c1f2292e14cc117660/funannotate/predict.py#L319 +for d in os.scandir(fun_db): + if not d.is_dir(): + continue + if d.name in ['outgroups', 'trained_species']: + continue + if not os.path.exists(os.path.join(d, "dataset.cfg")): + continue + name = d.name.replace("_", " ").capitalize() + content.append({'value': d.name, 'name': name, 'select': 'busco_db', 'db_value': fun_db_value}) + +# --busco_seed_species +# trained_species +for d in os.scandir(os.path.join(fun_db, "trained_species")): + if not d.is_dir(): + continue + if not os.path.exists(os.path.join(d, "info.json")): + continue + name = d.name.replace("_", " ").capitalize() + content.append({'value': d.name, 'name': name, 'select': 'trained_species', 'db_value': fun_db_value}) + +# --busco_seed_species +# outgroups +for f in os.scandir(os.path.join(fun_db, "outgroups")): + if f.is_dir(): + continue + if not f.name.endswith("_buscos.fa"): + continue + value = f.name[:-10] + name = ' - '.join([x.replace("_", " ").capitalize() for x in value.split('.')]) + content.append({'value': value, 'name': name, 'select': 'outgroup', 'db_value': fun_db_value}) + +with open(dmjson, "w") as fh: + json.dump({"data_tables": {"funannotate_options": content}}, fh) + +print(f'{len([c for c in content if c["select"]=="busco_db"])} x busco_db\n') +print(f'{len([c for c in content if c["select"]=="trained_species"])} x trained_species\n') +print(f'{len([c for c in content if c["select"]=="outgroup"])} x outgroup\n')
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/funannotate_options.xml Sun Mar 09 09:34:24 2025 +0000 @@ -0,0 +1,61 @@ +<tool id="data_manager_funannotate_options" name="Funannotate options data manager" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" tool_type="manage_data" profile="20.01"> + <macros> + <token name="@TOOL_VERSION@">1.8.15</token> + <token name="@VERSION_SUFFIX@">0</token> + </macros> + <requirements> + <requirement type="package" version="@TOOL_VERSION@">funannotate</requirement> + </requirements> + <version_command>funannotate check --show-versions</version_command> + <command detect_errors="exit_code"><![CDATA[ + #if $test: + funannotate setup -d ./test/ -i busco busco_outgroups -b eukaryota > /dev/null && + #set db_path="./test" + #else + #set db_path=$database.fields.path + #end if + python '$__tool_directory__/extract.py' '$db_path' '$database' '$output_file' + ]]></command> + <inputs> + <param name="test" type="hidden" value="" help="Used for testing"/> + <param name="database" label="Funannotate database" type="select"> + <options from_data_table="funannotate"> + <column name="value" index="0" /> + <column name="name" index="1" /> + <column name="path" index="3" /> + <filter type="sort_by" column="0" reverse_sort_order="true"/> + <!-- <filter type="static_value" column="2" value="1.0" /> --> + </options> + </param> + </inputs> + <outputs> + <data name="output_file" format="data_manager_json"/> + </outputs> + <tests> + <test> + <param name="test" value="true"/> + <param name="database" value="test"/> + <output name="output_file"> + <assert_contents> + <has_text text="busco_db" n="1"/> + <has_text text="outgroup" n="6"/> + <has_text text="trained_species" n="166"/> + </assert_contents> + </output> + <assert_stdout> + <has_line line="1 x busco_db"/> + <has_line line="166 x trained_species"/> + <has_line line="6 x outgroup"/> + </assert_stdout> + </test> + </tests> + <help><![CDATA[ + This data managers determines the options available in the select parameters of the funannotate tool + for a given funannotate DB in 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 Sun Mar 09 09:34:24 2025 +0000 @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<data_managers> + <data_manager tool_file="data_manager/funannotate_options.xml" id="data_manager_funannotate_options"> + <data_table name="funannotate_options"> + <output> + <column name="value" /> + <column name="name" /> + <column name="select" /> + <column name="db_value"/> + </output> + </data_table> + </data_manager> +</data_managers>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/funannotate.loc Sun Mar 09 09:34:24 2025 +0000 @@ -0,0 +1,10 @@ +# 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 +test Funannotate database Test 1.0 ./test/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/funannotate_options.loc Sun Mar 09 09:34:24 2025 +0000 @@ -0,0 +1,9 @@ +# this is a tab separated file describing options available for selects in the funannotate tool +# these options are derived separetely for each funannotate DB +# +# the columns are: +# value name select db_value +# +# db_value is the ID of the funannotate DB +# value and name are the value and name to be used +# select describes the command line parameter / select for which the values can be used \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool-data/funannotate.loc.sample Sun Mar 09 09:34:24 2025 +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/funannotate_options.loc.sample Sun Mar 09 09:34:24 2025 +0000 @@ -0,0 +1,9 @@ +# this is a tab separated file describing options available for selects in the funannotate tool +# these options are derived separetely for each funannotate DB +# +# the columns are: +# value name select db_value +# +# db_value is the ID of the funannotate DB +# value and name are the value and name to be used +# select describes the command line parameter / select for which the values can be used \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.sample Sun Mar 09 09:34:24 2025 +0000 @@ -0,0 +1,10 @@ +<tables> + <table name="funannotate" comment_char="#" allow_duplicate_entries="False"> + <columns>value, description, format_version, path</columns> + <file path="tool-data/funannotate.loc" /> + </table> + <table name="funannotate_options" comment_char="#" allow_duplicate_entries="False"> + <columns>value, name, select, db_value</columns> + <file path="tool-data/funannotate_options.loc" /> + </table> +</tables>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.test Sun Mar 09 09:34:24 2025 +0000 @@ -0,0 +1,10 @@ +<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> + <table name="funannotate_options" comment_char="#" allow_duplicate_entries="False"> + <columns>value, name, select, db_value</columns> + <file path="${__HERE__}/test-data/funannotate_options.loc" /> + </table> +</tables>