comparison ena_consensus_submit.xml @ 2:1ecd8ce07db4 draft

Uploaded
author ieguinoa
date Fri, 04 Feb 2022 15:52:45 +0000
parents f24eb2f2cb0c
children 7d751b5943b0
comparison
equal deleted inserted replaced
1:f24eb2f2cb0c 2:1ecd8ce07db4
1 <tool id="ena_consensus_submit" name="Submit consensus sequence to ENA" version="0.1.0" python_template_version="3.5"> 1 <tool id="ena_consensus_submit" name="Submit consensus sequence to ENA" version="@VERSION@" python_template_version="3.5">
2 <macros> 2 <macros>
3 <token name="@VERSION@">3.7.0</token> 3 <token name="@VERSION@">4.3.0</token>
4 </macros> 4 </macros>
5 <requirements> 5 <requirements>
6 <requirement type="package" version="@VERSION@">ena-webin-cli</requirement> 6 <requirement type="package" version="@VERSION@">ena-webin-cli</requirement>
7 <requirement type="package" version="1.76">biopython</requirement> 7 <requirement type="package" version="1.76">biopython</requirement>
8 <requirement type="package" version="5.3">pyyaml</requirement> 8 <requirement type="package" version="5.3">pyyaml</requirement>
9 </requirements> 9 </requirements>
10 <command detect_errors="exit_code"><![CDATA[ 10 <command detect_errors="exit_code"><![CDATA[
11 #if $test_submit == "True":
12 #set $credentials='./test_fake_path';
13 touch $credentials;
14 echo "username:test_user" >> $credentials;
15 echo "password:test_password" >> $credentials;
16 #end if
11 17
12 webin_id=`grep 'username' $credentials | cut -f2,2`; 18 webin_id=`grep 'username' $credentials | cut -d':' -f2,2`;
13 if [ "\$webin_id" = "" ]; then 19 if [ "\$webin_id" = "" ]; then
14 ## No credentials in user defined preferences 20 ## No credentials in user defined preferences
15 ## Fallback to global defined credentials (if exist) 21 ## Fallback to global defined credentials (if exist)
16 #import os 22 #import os
17 #if os.path.isfile(os.environ.get('GALAXY_ENA_SECRETS', '')): 23 #if os.path.isfile(os.environ.get('GALAXY_ENA_SECRETS', '')):
18 credentials_path=\${GALAXY_ENA_SECRETS}; 24 credentials_path=\${GALAXY_ENA_SECRETS};
19 webin_id=`grep 'username' \$GALAXY_ENA_SECRETS | cut -d' ' -f2,2`; 25 webin_id=`grep 'username' \$GALAXY_ENA_SECRETS | cut -d':' -f2,2` | sed -e 's/^[[:space:]]*//'`;
20 password=`grep 'password' \$GALAXY_ENA_SECRETS | cut -d' ' -f2,2`; 26 password=`grep 'password' \$GALAXY_ENA_SECRETS | cut -d':' -f2,2` | sed -e 's/^[[:space:]]*//'`;
21 if [ "\$webin_id" = "" ]; then 27 if [ "\$webin_id" = "" ]; then
22 echo "No global credentials defined. Check your GALAXY_ENA_SECRETS file or set your credentials via: User -> Preferences -> Manage Information"; 28 echo "No global credentials defined. Check your GALAXY_ENA_SECRETS file or set your credentials via: User -> Preferences -> Manage Information";
23 exit 1; 29 exit 1;
24 fi; 30 fi;
25 #else: 31 #else:
26 echo "No ENA credentials defined. Set your credentials via: User -> Preferences -> Manage Information"; 32 echo "No ENA credentials defined. Set your credentials via: User -> Preferences -> Manage Information";
27 exit 1; 33 exit 1;
28 #end if 34 #end if
29 else 35 else
30 password=`grep 'password' $credentials | cut -f2,2`; 36 password=`grep 'password' $credentials | cut -d':' -f2,2`;
31 fi; 37 fi;
32 38
33 ## if it is still running at this point then the webin_id and password are set
34 39
35 ## create a manifaste base file with the parameters that are identical for all sequences that will be submited (if submitting a multifasta) 40 ## create a manifest base file with the parameters that are identical for all sequences that will be submited (if submitting a multifasta)
36 #set $manifest_base = 'manifest_base.tab' 41 #set $manifest_base = 'manifest_base.tab'
37 mkdir manifests; 42 mkdir manifests;
38 mkdir fasta; 43 mkdir fasta;
39 44
40 echo -e "ASSEMBLY_TYPE\t$assembly_type" >> $manifest_base; 45 echo -e 'ASSEMBLY_TYPE\t$assembly_type' > $manifest_base;
41 echo -e "COVERAGE\t$coverage" >> $manifest_base; 46 echo -e 'COVERAGE\t$coverage' >> $manifest_base;
42 echo -e "PROGRAM\t$assembly_program" >> $manifest_base; 47 echo -e 'PROGRAM\t$assembly_program' >> $manifest_base;
43 #if $min_gap_length: 48 #if $min_gap_length:
44 echo -e "MINGAPLENGTH\t$min_gap_length" >> $manifest_base; 49 echo -e 'MINGAPLENGTH\t$min_gap_length' >> $manifest_base;
45 #end if 50 #end if
46 echo -e "MOLECULETYPE\t$molecule_type" >> $manifest_base; 51 echo -e 'MOLECULETYPE\t$molecule_type' >> $manifest_base;
47 52
48 #if $metadata_file_or_form.metadata_format == "file": 53 #if $metadata_file_or_form.metadata_format == "file":
49 ## process the input tables, this creates an intermediate file with information 54 ## process the input tables, this creates an intermediate file with information
50 python3 '$__tool_directory__/process_input.py' $metadata_file_or_form.ena_receipt $genome_fasta './manifests' './fasta' $manifest_base; 55 python3 '$__tool_directory__/process_input.py' $metadata_file_or_form.ena_receipt $genome_fasta './manifests' './fasta' $manifest_base;
51 center_name=`grep 'center_name' $metadata_file_or_form.ena_receipt | cut -f2,2 | tr -d '\n'`; 56 center_name=`grep 'center_name' $metadata_file_or_form.ena_receipt | cut -f2,2 | tr -d '\n'`;
52 #else: 57 #else:
53 #set $generated_manifest='./manifests/generated_manifest.txt' 58 #set $generated_manifest='./manifests/generated_manifest.txt'
54 cp $manifest_base $generated_manifest 59 cp $manifest_base $generated_manifest;
55 $study_id = $metadata_file_or_form.study_accession 60 #set $study_id = $metadata_file_or_form.study_accession
56 $sample_id = $metadata_file_or_form.sample_accession 61 #set $sample_id = $metadata_file_or_form.sample_accession
57 echo "STUDY\t$study_id" > $generated_manifest; 62 echo -e 'STUDY\t$study_id' >> $generated_manifest;
58 echo "SAMPLE\t$sample_id" >> $generated_manifest; 63 echo -e 'SAMPLE\t$sample_id' >> $generated_manifest;
59 center_name=$metadata_file_or_form.center_name; 64 center_name='$metadata_file_or_form.center_name';
60 echo "ASSEMBLY_NAME\t$metadata_file_or_form.assembly_name" >> $generated_manifest; 65 echo -e 'NAME\t$metadata_file_or_form.assembly_name' >> $generated_manifest;
61 echo "PLATFORM\t$platform_name" >> $generated_manifest; 66 echo -e 'PLATFORM\t$metadata_file_or_form.sequencing_platform' >> $generated_manifest;
62 #end if 67 #end if
63
64 68
69 #set $outputs_dir = 'outputs'
70 mkdir $outputs_dir;
65 #if $metadata_file_or_form.metadata_format == "file": 71 #if $metadata_file_or_form.metadata_format == "file":
66 ## iterate over the list of manifest - fasta generated by the process_input 72 ## iterate over the list of manifest - fasta generated by the process_input
67 ## in case of errors, this list is empty 73 ## in case of errors, this list is empty
68 while read line; do 74 while read line; do
69 manifest=`echo \$line | cut -d' ' -f1,1`; 75 manifest=`echo \$line | cut -d' ' -f1,1`;
70 ena-webin-cli 76 ena-webin-cli
71 -context genome 77 -context genome
72 -userName \$webin_id 78 -userName "'\$webin_id'"
73 -password \$password 79 -password "'\$password'"
74 -centerName \$center_name 80 -centerName "'\$center_name'"
75 -manifest \$manifest 81 -manifest \$manifest
76 -inputDir "./fasta" 82 -inputDir './fasta'
77 #if $dry_run == "true": 83 #if $dry_run == "true":
78 -validate 84 -validate
79 #end if 85 #end if
80 ; 86 -outputDir $outputs_dir
87 >> $webin_cli_log ;
81 done < submit_list.tab 88 done < submit_list.tab
82 89
83 #else: 90 #else:
84 gzip -c $genome_fasta > consensus.fasta.gz; 91 gzip -c $genome_fasta > consensus.fasta.gz;
85 echo -e "FASTA\tconsensus.fasta.gz" >> $generated_manifest; 92 echo -e 'FASTA\tconsensus.fasta.gz' >> $generated_manifest;
86 ena-webin-cli 93 ena-webin-cli
87 -context genome
88 -userName \$webin_id
89 -password \$password
90 -centerName '\$center_name'
91 -manifest $generated_manifest
92 -inputDir "./"
93 #if $submit_test == "true": 94 #if $submit_test == "true":
94 -test 95 -test
95 #end if 96 #end if
96 #if $dry_run == "true": 97 #if $dry_run == "true":
97 -validate 98 -validate
98 #else: 99 #else:
99 -submit 100 -submit
100 #end if 101 #end if
102 -context genome
103 -manifest $generated_manifest
104 -password "'\$password'"
105 -userName "'\$webin_id'"
106 -inputDir "./"
107 -centerName "'\$center_name'"
108 -outputDir $outputs_dir
109 >> $webin_cli_log ;
110 ##cp ./genome/$metadata_file_or_form.assembly_name/validate/webin-cli.report $validate_output
101 #end if 111 #end if
112 tar -cf $webin_cli_outputs $outputs_dir;
102 ]]></command> 113 ]]></command>
103 <configfiles> 114 <configfiles>
104 <configfile name="credentials"><![CDATA[ 115 <configfile name="credentials"><![CDATA[
105 #set $webin_id = $__user__.extra_preferences.get('ena_webin_account|webin_id', "").strip() 116 #set $webin_id = $__user__.extra_preferences.get('ena_webin_account|webin_id', "").strip()
106 #set $password = $__user__.extra_preferences.get('ena_webin_account|password', "").strip() 117 #set $password = $__user__.extra_preferences.get('ena_webin_account|password', "").strip()
107 #if $webin_id != "": 118 #if $webin_id != "":
108 username\t"$webin_id" 119 username:$webin_id
109 password\t"$password" 120 password:$password
110 #end if 121 #end if
122
111 ]]></configfile> 123 ]]></configfile>
112 </configfiles> 124 </configfiles>
113 <inputs> 125 <inputs>
114 <param name="submit_test" type="boolean" default="False" label="Submit to test server" help="Suggested to test metadata format" /> 126 <param name="test_submit" type="hidden" value="False" />
115 <param name="dry_run" type="boolean" default="False" label="Validate files and metadata but do not submit" help="Generate input files and run Webin-CLI with -validate option."/> 127 <param name="submit_test" type="boolean" truevalue="true" falsevalue="false" label="Submit to test server" help="use Webin test service instead of the production service. Please note that the Webin upload area is shared between test and production services, and that test submission files will not be archived." />
128 <param name="dry_run" type="boolean" truevalue="true" falsevalue="false" label="Validate files and metadata but do not submit" help="Generate input files and run Webin-CLI with -validate option. If 'No' is selected then it will validate and submit (-submit flag)"/>
116 <param name="genome_fasta" type="data" label="Select the consensus sequence assembly file" format="fasta"/> 129 <param name="genome_fasta" type="data" label="Select the consensus sequence assembly file" format="fasta"/>
117 <param name="assembly_type" type="select" label="Assembly type"> 130 <param name="assembly_type" type="select" label="Assembly type">
118 <option value="clone">Clone</option> 131 <option value="clone">Clone</option>
119 <option value="isolate">Isolate</option> 132 <option value="isolate">Isolate</option>
120 </param> 133 </param>
125 <option value="genomic DNA">genomic DNA</option> 138 <option value="genomic DNA">genomic DNA</option>
126 </param> 139 </param>
127 <param name="coverage" type="float" optional="False" value="10000" label="Coverage"/> 140 <param name="coverage" type="float" optional="False" value="10000" label="Coverage"/>
128 <conditional name="metadata_file_or_form"> 141 <conditional name="metadata_file_or_form">
129 <param name="metadata_format" type="select" label="Select the method to load study and sample metadata"> 142 <param name="metadata_format" type="select" label="Select the method to load study and sample metadata">
130 <option value="file" selected="True">I used Galaxy ENA upload tool for raw data submission, parse my submission receipt</option> 143 <option value="form" selected="True">Fill in required submission metadata</option>
131 <option value="form">Fill in required metadata for linking</option> 144 <option value="file">(Beta) I used the Galaxy ENA upload tool to submit the raw data: parse the received submission receipt</option>
132 </param> 145 </param>
133 <when value="file"> 146 <when value="file">
134 <param type="data" format="txt" name="ena_receipt" label="Submission receipt obtained from ENA upload tool"/> 147 <param type="data" format="txt" name="ena_receipt" label="Submission receipt obtained from ENA upload tool"/>
135 </when> 148 </when>
136 <when value="form"> 149 <when value="form">
144 </conditional> 157 </conditional>
145 <param name="min_gap_length" type="text" optional="True" label="Minimum gap length (optional)"/> 158 <param name="min_gap_length" type="text" optional="True" label="Minimum gap length (optional)"/>
146 </inputs> 159 </inputs>
147 <outputs> 160 <outputs>
148 <collection name="generated_manifests" type="list" label="Generated manifests"> 161 <collection name="generated_manifests" type="list" label="Generated manifests">
149 <!--<discover_datasets pattern="__name_and_ext__" directory="manifests" />--> 162 <discover_datasets pattern="(?P&lt;designation&gt;.+)\.txt" ext="txt" directory="manifests/"/>
150 <discover_datasets pattern="(?P&lt;designation&gt;.+)\.manifest\.txt$" ext="txt" directory="manifests" />
151 </collection> 163 </collection>
152 <collection name="manifests_reports" type="list" label="Manifests reports"> 164 <data name="webin_cli_log" label="ENA submission log" format="txt"/>
153 <!--[><discover_datasets pattern="__name_and_ext__" directory="manifests" /><]--> 165 <data name="webin_cli_outputs" label="Webin cli outputs" format="tar"/>
154 <discover_datasets pattern="(?P&lt;designation&gt;.+)\.manifest\.txt\.report$" ext="txt" directory="manifests" /> 166
155 </collection>
156 <data name="webin_cli_report" label="ENA submission receipt" format="txt" from_work_dir="manifests/webin-cli.report"/>
157 </outputs> 167 </outputs>
168 <tests>
169 <test>
170 <param name="submit_test" value="true" />
171 <param name="dry_run" value="true" />
172 <param name="test_submit" value="True" />
173 <param name="genome_fasta" value="phiX2.fasta"/>
174 <param name="assembly_type" value="isolate"/>
175 <param name="assembly_program" value="Test assembly program"/>
176 <param name="molecule_type" value="viral cRNA"/>
177 <param name="coverage" value="10000"/>
178 <conditional name="metadata_file_or_form">
179 <param name="metadata_format" value="form"/>
180 <param name="assembly_name" value="Test assembly name"/>
181 <param name="study_accession" value="PRJEB49173"/>
182 <param name="sample_accession" value="SAMEA11953908"/>
183 <param name="sequencing_platform" value="Nanopore 0011"/>
184 <param name="description" value="Test Description"/>
185 <param name="center_name" value="Test center name"/>
186 </conditional>
187 <param name="min_gap_length" value="30"/>
188 <output name="webin_cli_log">
189 <assert_contents>
190 <has_n_lines n="4"/>
191 <has_text_matching expression="ERROR: Invalid submission account user name or password."/>
192 </assert_contents>
193 </output>
194 </test>
195 </tests>
158 <help><![CDATA[ 196 <help><![CDATA[
159 TODO: Fill in help. 197 TODO: Fill in help.
160 ]]></help> 198 ]]></help>
161 </tool> 199 </tool>