diff ena_upload.xml @ 2:2f7a70c0d3ab draft default tip

Uploaded
author ieguinoa
date Mon, 21 Feb 2022 14:22:53 +0000
parents 5d59238cd3f4
children
line wrap: on
line diff
--- a/ena_upload.xml	Wed Feb 02 17:30:12 2022 +0000
+++ b/ena_upload.xml	Mon Feb 21 14:22:53 2022 +0000
@@ -26,6 +26,10 @@
 #if $action_options.input_format_conditional.input_format == "build_tables":
   python '$__tool_directory__/extract_tables.py' --action $action_options.action --out_dir ./submission_files --studies $studies_json;
 #end if
+        
+credentials_path='test_fake_path';
+echo "username: test_user" > \$credentials_path;
+echo "password: test_password" >> \$credentials_path;
 
 
 #if $action_options.input_format_conditional.input_format == "build_tables":
@@ -65,13 +69,6 @@
     fi;
 #end if
 
-#if $action_options.test_submit == "True" or $action_options.test_submit_parameters.dry_run == "true":
-    credentials_path='test_fake_path';
-    #if $action_options.test_submit_parameters.dry_run == "true" and $action_options.input_format_conditional.input_format == "excel_tables":
-        echo "username: test_user" > \$credentials_path;
-        echo "password: test_password" >> \$credentials_path;
-    #end if
-#end if
 
 ## create the list of files to upload and make the symlinks 
 #import re      
@@ -173,8 +170,6 @@
     #end if
 #end if
 
-
-#if $action_options.test_submit_parameters.dry_run == "false" or $action_options.input_format_conditional.input_format == "excel_tables":
 #if $action_options.action == "add":
 ena-upload-cli
     --tool 'ena-upload-cli v@VERSION@ @ Galaxy'
@@ -215,6 +210,8 @@
     >> '$output';
 #end if
 
+
+
 #if $action_options.action == "modify":
     ena-upload-cli
     --tool 'ena-upload-cli v@VERSION@ @ Galaxy'
@@ -251,27 +248,28 @@
 #end if
     >> '$output';
 #end if
-    #if $action_options.test_submit_parameters.dry_run == "false":
-        echo -e 'center_name\t$action_options.center' >> '$output';
-        echo -e 'action_option\t$action_options.action' >> '$output';
-        #if $action_options.input_format_conditional.input_format == "build_tables":
-            cp $studies_table_path_updated $studies_table_out 2>/dev/null;
-            cp $samples_table_path_updated $samples_table_out 2>/dev/null;
-            cp $experiments_table_path_updated $experiments_table_out 2>/dev/null;
-            cp $runs_table_path_updated $runs_table_out 2>/dev/null;
-        #end if
-    #else
-        ## for the excel input case, copy the upload-cli generated tables to the output files
-        ## this applies for both draft and real submissions
-        cp './ENA_template_experiment_updated.tsv' $experiments_table_out;
-        cp './ENA_template_sample_updated.tsv' $samples_table_out;
-        cp './ENA_template_study_updated.tsv' $studies_table_out;
-        cp './ENA_template_run_updated.tsv' $runs_table_out;
-    #end if
-#else:
-    exit 0;
+
+#if $action_options.test_submit_parameters.dry_run == "false":
+    echo -e 'center_name\t$action_options.center' >> '$output';
+    echo -e 'action_option\t$action_options.action' >> '$output';
+#end if
+        
+## copy updated files
+#if $action_options.input_format_conditional.input_format == "excel_tables":
+    ## for the excel input case, copy the upload-cli generated tables to the output files
+    ## this applies for both draft and real submissions
+    cp './ENA_template_experiment_updated.tsv' $experiments_table_out;
+    cp './ENA_template_sample_updated.tsv' $samples_table_out;
+    cp './ENA_template_study_updated.tsv' $studies_table_out;
+    cp './ENA_template_run_updated.tsv' $runs_table_out;
+#else
+    cp $studies_table_path_updated $studies_table_out 2>/dev/null;
+    cp $samples_table_path_updated $samples_table_out 2>/dev/null;
+    cp $experiments_table_path_updated $experiments_table_out 2>/dev/null;
+    cp $runs_table_path_updated $runs_table_out 2>/dev/null;
 #end if
 
+python '$__tool_directory__/dump_yaml.py' $studies_table_out $samples_table_out $experiments_table_out $runs_table_out >> $output;
 ]]></command>
     <configfiles>
         <configfile name="credentials"><![CDATA[
@@ -453,6 +451,15 @@
                     <has_line_matching expression="r_20201007_026\te_20201007_026\tC026_exp5_clean.fastq.gz\tFASTQ(.*)"/>
                 </assert_contents>
             </output>
+            <output name="output">
+                <assert_contents>
+                    <has_line_matching expression="YAML -------------"/>
+                    <has_line_matching expression="ENA_experiment:"/>
+                    <has_line_matching expression="ENA_sample:"/>
+                    <has_line_matching expression="ENA_study:"/>
+                    <has_line_matching expression="ENA_run:"/>
+                </assert_contents>
+            </output>
         </test>
         <!--Test 3: excel input of NON-VIRAL samples-->
         <test>
@@ -549,7 +556,7 @@
                 </section>
                 <conditional name="input_format_conditional">
                     <param name="input_format" value="build_tables"/>
-                    <param name="add_extension" value="true"/>
+                    <param name="add_extension" value="false"/>
                     <conditional name="conditional_viral_metadata">
                         <param name="viral_sample" value="False"/>
                         <repeat name="rep_study">
@@ -561,7 +568,7 @@
                                 <param name="sample_title" value="Test Sample title"/>
                                 <param name="sample_description" value="Test Sample description"/>
                                 <param name="scientific_name" value="Test Sample scientific name"/>
-                                <param name="tax_id" value="Test Sample tax_id"/>
+                                <param name="tax_id" value="2697049"/>
                                 <repeat name="rep_experiment">
                                     <param name="experiment_title" value="Test experiment title"/>
                                     <param name="experiment_design" value="Test experiment design description"/>
@@ -574,7 +581,7 @@
                                     <param name="platform" value="ILLUMINA"/>
                                     <param name="instrument_model" value="Illumina HiSeq 4000"/>
                                     <repeat name="rep_runs">
-                                        <param name="upload_files" value="1.fastqsanger.gz,sample.fq" ftype="fastqsanger"/>
+                                        <param name="upload_files" value="1.fastqsanger.gz,sample.fq" ftype="fastqsanger.gz"/>
                                     </repeat>
                                 </repeat>
                             </repeat>
@@ -632,7 +639,7 @@
                                 <param name="sample_title" value="Test Sample title"/>
                                 <param name="sample_description" value="Test Sample description"/>
                                 <param name="scientific_name" value="Test Sample scientific name"/>
-                                <param name="tax_id" value="Test Sample tax_id"/>
+                                <param name="tax_id" value="2697049"/>
                                 <repeat name="rep_experiment">
                                     <param name="experiment_title" value="Test experiment title"/>
                                     <param name="experiment_design" value="Test experiment design description"/>
@@ -660,16 +667,16 @@
         </test>
         <!--Test 7: with submit_test to skip credentials checksRUN failing build tables from user input fields NON-VIRAL samples
             also tests compression of uncompressed inputs and adding the .gz suffix -->
-        <test expect_failure="true">
+        <test expect_failure="false">
             <conditional name="action_options">
                 <param name="action" value="add"/>
                 <section name="test_submit_parameters">
                     <param name="submit_dev" value="true" />
-                    <param name="dry_run" value="false" />
+                    <param name="dry_run" value="true" />
                 </section>
                 <param name="test_submit" value="True"/>
                 <conditional name="input_format_conditional">
-                    <param name="add_extension" value="true"/>
+                    <param name="add_extension" value="false"/>
                     <param name="input_format" value="build_tables"/>
                     <conditional name="conditional_viral_metadata">
                         <param name="viral_sample" value="false"/>
@@ -682,7 +689,7 @@
                                 <param name="sample_title" value="Test Sample title"/>
                                 <param name="sample_description" value="Test Sample description"/>
                                 <param name="scientific_name" value="Test Sample scientific name"/>
-                                <param name="tax_id" value="Test Sample tax_id"/>
+                                <param name="tax_id" value="2697049"/>
                                 <repeat name="rep_experiment">
                                     <param name="experiment_title" value="Test experiment title"/>
                                     <param name="experiment_design" value="Test experiment design description"/>
@@ -696,7 +703,7 @@
                                     <param name="instrument_model" value="Illumina HiSeq 4000"/>
                                     <repeat name="rep_runs">
                                         <param name="run_base_name" value="run_from_hospital_X"/>
-                                        <param name="upload_files" value="sample.fq,sample.fq" ftype="fastqsanger"/>
+                                        <param name="upload_files" value="1.fastqsanger.gz,2.fastqsanger.gz" ftype="fastqsanger.gz"/>
                                     </repeat>
                                 </repeat>
                             </repeat>
@@ -707,25 +714,22 @@
             <param name="center" value="Some research center"/>
             <assert_command>
                 <has_text_matching expression="ena-upload-cli"/>
-                <has_text_matching expression="--data 'sample.fq.fastq.gz' 'sample.fq.fastq.gz'"/>
+                <has_text_matching expression="--data '1.fastqsanger.gz' '2.fastqsanger.gz'"/>
                 <has_text_matching expression="--action 'add' --center 'Some research center'"/>
                 <not_has_text text="modify" />
             </assert_command>
-            <assert_stderr>
-                <has_text_matching expression="Oops, the file test_fake_path does not exist"/>
-            </assert_stderr>
         </test>
         <!--Test 8: viral submission - User input metadata - Add extension = False-->
-        <test expect_failure="true">
+        <test expect_failure="false">
             <conditional name="action_options">
                 <param name="action" value="add"/>
                 <section name="test_submit_parameters">
                     <param name="submit_dev" value="false" />
-                    <param name="dry_run" value="false" />
+                    <param name="dry_run" value="true" />
                 </section>
                 <param name="test_submit" value="True"/>
                 <conditional name="input_format_conditional">
-                    <param name="add_extension" value="False"/>
+                    <param name="add_extension" value="false"/>
                     <param name="input_format" value="build_tables"/>
                     <conditional name="conditional_viral_metadata">
                         <param name="viral_sample" value="true"/>
@@ -738,7 +742,7 @@
                                 <param name="sample_title" value="Test Sample title"/>
                                 <param name="sample_description" value="Test Sample description"/>
                                 <param name="scientific_name" value="Test Sample scientific name"/>
-                                <param name="tax_id" value="Test Sample tax_id"/>
+                                <param name="tax_id" value="2697049"/>
                                 <param name="collection_date" value="2020"/>
                                 <param name="geo_location_country" value="Belgium"/>
                                 <param name="host_common_name" value="Human"/>
@@ -777,21 +781,18 @@
                 <has_text_matching expression="--action 'add' --center 'Some research center'"/>
                 <has_text_matching expression="--checklist ERC000033"/>
             </assert_command>
-            <assert_stderr>
-                <has_text_matching expression="Oops, the file test_fake_path does not exist"/>
-            </assert_stderr>
         </test>
         <!--Test 9: modify option and auto compression - viral submission - User input metadata-->
-        <test expect_failure="true">
+        <test expect_failure="false">
             <conditional name="action_options">
                 <param name="action" value="modify"/>
                 <section name="test_submit_parameters">
                     <param name="submit_dev" value="false" />
-                    <param name="dry_run" value="false" />
+                    <param name="dry_run" value="true" />
                 </section>
                 <param name="test_submit" value="True"/>
                 <conditional name="input_format_conditional">
-                    <param name="add_extension" value="False"/>
+                    <param name="add_extension" value="fasle"/>
                     <param name="input_format" value="build_tables"/>
                     <conditional name="conditional_viral_metadata">
                         <param name="viral_sample" value="True"/>
@@ -804,7 +805,7 @@
                                 <param name="sample_title" value="Test Sample title"/>
                                 <param name="sample_description" value="Test Sample description"/>
                                 <param name="scientific_name" value="Test Sample scientific name"/>
-                                <param name="tax_id" value="Test Sample tax_id"/>
+                                <param name="tax_id" value="2697049"/>
                                 <param name="collection_date" value="2020"/>
                                 <param name="geo_location_country" value="Belgium"/>
                                 <param name="host_common_name" value="Human"/>
@@ -828,7 +829,7 @@
                                     <param name="instrument_model" value="Illumina HiSeq 4000"/>
                                     <repeat name="rep_runs">
                                         <param name="run_base_name" value="run_from_hospital_X"/>
-                                        <param name="upload_files" value="sample.fq" ftype="fastqsanger"/>
+                                        <param name="upload_files" value="1.fastqsanger.gz" ftype="fastqsanger.gz"/>
                                     </repeat>
                                 </repeat>
                             </repeat>
@@ -839,21 +840,17 @@
             <param name="center" value="Some research center"/>
             <assert_command>
                 <has_text_matching expression="ena-upload-cli"/>
-                <has_text_matching expression="--data 'sample.fq.gz'"/>
+                <has_text_matching expression="--data '1.fastqsanger.gz'"/>
                 <has_text_matching expression="--action 'modify' --center 'Some research center'"/>
                 <has_text_matching expression="--checklist ERC000033"/>
                 <not_has_text text="add" />
             </assert_command>
-            <assert_stderr>
-                <has_text_matching expression="Oops, the file test_fake_path does not exist"/>
-            </assert_stderr>
         </test>
     </tests>
     <help><![CDATA[
         This is a wrapper for the ENA upload tool in https://github.com/usegalaxy-eu/ena-upload-cli
         The input metadata can be submitted following the tabular format of the templates in https://github.com/usegalaxy-eu/ena-upload-cli/tree/master/example_tables
-        It is also possible to submit an excel file by following the template in https://drive.google.com/file/d/1ncC22--tW2v-EI-te_r86sAZujIPAjlX/view?usp=sharing
-        For viral submissions a larger set of metadata is required, you can find the template in https://drive.google.com/file/d/1Gx78GKh58PmRjdmJ05DBbpObAL-3oUFX/view?usp=sharing
+        It is also possible to submit an excel file by following the template in https://github.com/ELIXIR-Belgium/ENA-metadata-templates
     ]]></help>
     <citations>
     </citations>