changeset 13:cd0196536dfd draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_fetch_genome_dbkeys_all_fasta commit 57d05675396f0b44265fb4dbc8f9f891c6073219
author iuc
date Thu, 05 Dec 2024 06:47:24 +0000
parents 545a0f7663ef
children
files data_manager/data_manager_fetch_genome_all_fasta_dbkeys.py data_manager/data_manager_fetch_genome_all_fasta_dbkeys.xml data_manager_conf.xml test-data/fetch_data_manager.1.data_manager_json test-data/fetch_data_manager.2.data_manager_json test-data/phiX174.data_manager_json
diffstat 6 files changed, 27 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/data_manager/data_manager_fetch_genome_all_fasta_dbkeys.py	Thu Dec 05 22:10:12 2019 +0000
+++ b/data_manager/data_manager_fetch_genome_all_fasta_dbkeys.py	Thu Dec 05 06:47:24 2024 +0000
@@ -279,6 +279,8 @@
                            target_directory=target_directory,
                            dbkey=dbkey,
                            dbkey_name=dbkey_name,
+                           sequence_id=sequence_id,
+                           sequence_name=sequence_name,
                            fasta_filename=fasta_filename)
     _add_data_table_entry(data_manager_dict,
                           data_table_entry=dict(value=sequence_id, dbkey=dbkey, name=sequence_name, path=os.path.basename(fasta_filename)),
@@ -286,11 +288,11 @@
     return fasta_filename
 
 
-def add_dbkey_to_table(data_manager_dict, target_directory, dbkey, dbkey_name, fasta_filename):
+def add_dbkey_to_table(data_manager_dict, target_directory, dbkey, dbkey_name, sequence_id, sequence_name, fasta_filename):
     # do len calc here
-    len_base_name = "%s.len" % (dbkey)
+    len_base_name = f"{sequence_id}.len"
     compute_fasta_length(fasta_filename, os.path.join(target_directory, len_base_name), keep_first_word=True)
-    dbkey_dict = dict(value=dbkey, name=dbkey_name, len_path=len_base_name)
+    dbkey_dict = dict(dbkey=dbkey, value=sequence_id, name=sequence_name, len_path=len_base_name)
     _add_data_table_entry(data_manager_dict,
                           data_table_entry=dbkey_dict,
                           data_table_name='__dbkeys__')
@@ -345,7 +347,7 @@
         if isinstance(input_filename, list):
             fasta_readers = [get_stream_reader(open(filename, 'rb'), tmp_dir) for filename in input_filename]
         else:
-            fasta_readers = get_stream_reader(open(input_filename), tmp_dir)
+            fasta_readers = get_stream_reader(open(input_filename, 'rb'), tmp_dir)
         return fasta_readers
     for data_table_name, data_table_entry in data_table_entries:
         if data_table_entry:
--- a/data_manager/data_manager_fetch_genome_all_fasta_dbkeys.xml	Thu Dec 05 22:10:12 2019 +0000
+++ b/data_manager/data_manager_fetch_genome_all_fasta_dbkeys.xml	Thu Dec 05 06:47:24 2024 +0000
@@ -1,7 +1,7 @@
-<tool id="data_manager_fetch_genome_all_fasta_dbkey" name="Create DBKey and Reference Genome" version="0.0.4" tool_type="manage_data" profile="19.01">
+<tool id="data_manager_fetch_genome_all_fasta_dbkey" name="Create DBKey and Reference Genome" version="0.0.5" tool_type="manage_data" profile="23.0">
     <description>fetching</description>
     <requirements>
-        <requirement type="package" version="3.7">python</requirement>
+        <requirement type="package" version="3.11">python</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
        python '$__tool_directory__/data_manager_fetch_genome_all_fasta_dbkeys.py'
@@ -83,12 +83,23 @@
         <test>
             <param name="dbkey" value="phiX174"/>
             <param name="dbkey_source|dbkey_source_selector" value="new"/>
+            <param name="dbkey_source|dbkey_name" value="phiX174 dbkey name"/>
             <param name="sequence_name" value="phiX174 sequence name"/>
-            <param name="sequence_id" value="phix174"/>
             <param name="reference_source_selector" value="history"/>
             <param name="input_fasta" value="phiX174.fasta"/>
             <param name="sort_selector" value="as_is"/>
-            <output name="out_file" file="phiX174.data_manager_json"/>
+            <output name="out_file" file="fetch_data_manager.1.data_manager_json"/>
+        </test>
+        <test>
+            <param name="dbkey" value="phiX174"/>
+            <param name="dbkey_source|dbkey_source_selector" value="new"/>
+            <param name="dbkey_source|dbkey_name" value="phiX174 dbkey name"/>
+            <param name="sequence_name" value="phiX174 Variant 1 sequence name"/>
+            <param name="sequence_id" value="phiX174Variant1"/>
+            <param name="reference_source_selector" value="history"/>
+            <param name="input_fasta" value="phiX174.fasta"/>
+            <param name="sort_selector" value="as_is"/>
+            <output name="out_file" file="fetch_data_manager.2.data_manager_json"/>
         </test>
     </tests>
     <help>
--- a/data_manager_conf.xml	Thu Dec 05 22:10:12 2019 +0000
+++ b/data_manager_conf.xml	Thu Dec 05 06:47:24 2024 +0000
@@ -10,9 +10,9 @@
                 <column name="path" output_ref="out_file" >
                     <move type="file">
                         <source>${path}</source>
-                        <target base="${GALAXY_DATA_MANAGER_DATA_PATH}">${dbkey}/seq/${path}</target>
+                        <target base="${GALAXY_DATA_MANAGER_DATA_PATH}">genomes/${dbkey}/seq/${path}</target>
                     </move>
-                    <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/${dbkey}/seq/${path}</value_translation>
+                    <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/genomes/${dbkey}/seq/${path}</value_translation>
                     <value_translation type="function">abspath</value_translation>
                 </column>
             </output>
@@ -24,9 +24,9 @@
                 <column name="len_path" output_ref="out_file" >
                     <move type="file">
                         <source>${len_path}</source>
-                        <target base="${GALAXY_DATA_MANAGER_DATA_PATH}">${value}/len/${len_path}</target>
+                        <target base="${GALAXY_DATA_MANAGER_DATA_PATH}">genomes/${dbkey}/len/${len_path}</target>
                     </move>
-                    <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/${value}/len/${len_path}</value_translation>
+                    <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/genomes/${dbkey}/len/${len_path}</value_translation>
                     <value_translation type="function">abspath</value_translation>
                 </column>
             </output>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/fetch_data_manager.1.data_manager_json	Thu Dec 05 06:47:24 2024 +0000
@@ -0,0 +1,1 @@
+{"data_tables": {"__dbkeys__": [{"dbkey": "phiX174", "len_path": "phiX174.len", "name": "phiX174 sequence name", "value": "phiX174"}], "all_fasta": [{"dbkey": "phiX174", "name": "phiX174 sequence name", "path": "phiX174.fa", "value": "phiX174"}]}}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/fetch_data_manager.2.data_manager_json	Thu Dec 05 06:47:24 2024 +0000
@@ -0,0 +1,1 @@
+{"data_tables": {"__dbkeys__": [{"dbkey": "phiX174", "len_path": "phiX174Variant1.len", "name": "phiX174 Variant 1 sequence name", "value": "phiX174Variant1"}], "all_fasta": [{"dbkey": "phiX174", "name": "phiX174 Variant 1 sequence name", "path": "phiX174Variant1.fa", "value": "phiX174Variant1"}]}}
\ No newline at end of file
--- a/test-data/phiX174.data_manager_json	Thu Dec 05 22:10:12 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-{"data_tables": {"__dbkeys__": [{"len_path": "phiX174.len", "name": "phiX174", "value": "phiX174"}], "all_fasta": [{"dbkey": "phiX174", "name": "phiX174 sequence name", "path": "phix174.fa", "value": "phix174"}]}}
\ No newline at end of file