comparison ena_webin_cli.xml @ 0:c9f87770ba8f draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/ena_webin_cli commit 35b4a063e227ea4a2440e23c4df5c27e42c077cb
author iuc
date Tue, 05 Aug 2025 11:53:57 +0000
parents
children 93fac0ae859f
comparison
equal deleted inserted replaced
-1:000000000000 0:c9f87770ba8f
1 <tool id="ena_webin_cli" name="ENA Webin CLI" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" license="MIT" profile="24.2">
2 <description>Submission of consensus sequences to the European Nucleotide Archive (ENA)</description>
3 <macros>
4 <token name="@TOOL_VERSION@">8.1.1</token>
5 <token name="@VERSION_SUFFIX@">0</token>
6 </macros>
7 <requirements>
8 <requirement type="package" version="@TOOL_VERSION@">ena-webin-cli</requirement>
9 <requirement type="package" version="1.76">biopython</requirement>
10 <requirement type="package" version="5.3">pyyaml</requirement>
11 </requirements>
12 <command detect_errors="exit_code"><![CDATA[
13 #if $dry_run == "True":
14 #set $credentials='./test_fake_path';
15 touch $credentials;
16 echo "username:test_user" >> $credentials;
17 echo "password:test_password" >> $credentials;
18 #end if
19
20 webin_id=`grep 'username' $credentials | cut -d':' -f2,2`;
21 if [ "\$webin_id" = "" ]; then
22 ## No credentials in user defined preferences
23 ## Fallback to global defined credentials (if exist)
24 #import os
25 #if os.path.isfile(os.environ.get('GALAXY_ENA_SECRETS', '')):
26 credentials_path=\${GALAXY_ENA_SECRETS};
27 webin_id=`grep 'username' \$GALAXY_ENA_SECRETS | cut -d':' -f2,2` | sed -e 's/^[[:space:]]*//'`;
28 password=`grep 'password' \$GALAXY_ENA_SECRETS | cut -d':' -f2,2` | sed -e 's/^[[:space:]]*//'`;
29 if [ "\$webin_id" = "" ]; then
30 echo "No global credentials defined. Check your GALAXY_ENA_SECRETS file or set your credentials via: User -> Preferences -> Manage Information";
31 exit 1;
32 fi;
33 #else:
34 echo "No ENA credentials defined. Set your credentials via: User -> Preferences -> Manage Information";
35 exit 1;
36 #end if
37 else
38 password=`grep 'password' $credentials | cut -d':' -f2,2`;
39 fi;
40
41
42 ## create a manifest base file with the parameters that are identical for all sequences that will be submited (if submitting a multifasta)
43 #set $manifest_base = 'manifest_base.tab'
44 mkdir manifests;
45 mkdir fasta;
46
47 echo -e 'ASSEMBLY_TYPE\t$assembly_type' > $manifest_base;
48 echo -e 'COVERAGE\t$coverage' >> $manifest_base;
49 echo -e 'PROGRAM\t$assembly_program' >> $manifest_base;
50 #if $min_gap_length:
51 echo -e 'MINGAPLENGTH\t$min_gap_length' >> $manifest_base;
52 #end if
53 echo -e 'MOLECULETYPE\t$molecule_type' >> $manifest_base;
54
55 #if $metadata_file_or_form.metadata_format == "file":
56 #import re
57 #for $file in $metadata_file_or_form.genome_fasta:
58 #if $file.is_of_type('fasta'):
59 #set $full_name = $file.element_identifier + '.gz'
60 gzip -c '$file' > './fasta/$full_name';
61 #else:
62 ln -s '$file' './fasta/$file.element_identifier';
63 #end if
64
65 #end for
66 ## process the input tables, this creates an intermediate file with information
67 python3 '$__tool_directory__/process_input.py' $metadata_file_or_form.ena_receipt $genome_fasta_files './manifests' $manifest_base >> $webin_cli_log;
68 center_name=`grep 'center_name' $metadata_file_or_form.ena_receipt | cut -f2,2 | tr -d '\n'`;
69 #else:
70 #set $generated_manifest='./manifests/generated_manifest.txt'
71 cp $manifest_base $generated_manifest;
72 #set $study_id = $metadata_file_or_form.study_accession
73 #set $sample_id = $metadata_file_or_form.sample_accession
74 echo -e 'STUDY\t$study_id' >> $generated_manifest;
75 echo -e 'SAMPLE\t$sample_id' >> $generated_manifest;
76 center_name='$metadata_file_or_form.center_name';
77 echo -e 'NAME\t$metadata_file_or_form.assembly_name' >> $generated_manifest;
78 echo -e 'PLATFORM\t$metadata_file_or_form.sequencing_platform' >> $generated_manifest;
79 #if $metadata_file_or_form.genome_fasta.is_of_type('fasta'):
80 gzip -c $metadata_file_or_form.genome_fasta > consensus.fasta.gz;
81 #else:
82 ln -s $metadata_file_or_form.genome_fasta consensus.fasta.gz;
83 #end if
84 echo -e 'FASTA\tconsensus.fasta.gz' >> $generated_manifest;
85 #end if
86
87 #set $outputs_dir = 'outputs'
88 mkdir $outputs_dir;
89 #if $metadata_file_or_form.metadata_format == "file":
90 ## iterate over the list of manifest - fasta generated by the process_input
91 ## in case of errors, this list is empty
92 while read line; do
93 manifest=`echo \$line | cut -d' ' -f1,1`;
94 echo "Submitting manifest \$manifest" >> $webin_cli_log;
95 ena-webin-cli
96 -context genome
97 -userName "'\$webin_id'"
98 -password "'\$password'"
99 -centerName "'\$center_name'"
100 -manifest \$manifest
101 -inputDir './fasta'
102 #if $submit_test == "true":
103 -test
104 #end if
105 #if $dry_run == "true":
106 -validate
107 #else:
108 -submit
109 #end if
110 -outputDir $outputs_dir
111 >> $webin_cli_log;
112 done < submit_list.tab;
113
114 #else:
115 ena-webin-cli
116 #if $submit_test == "true":
117 -test
118 #end if
119 #if $dry_run == "true":
120 -validate
121 #else:
122 -submit
123 #end if
124 -context genome
125 -manifest $generated_manifest
126 -password "'\$password'"
127 -userName "'\$webin_id'"
128 -inputDir "./"
129 -centerName "'\$center_name'"
130 -outputDir $outputs_dir
131 >> $webin_cli_log ;
132 #end if
133 tar -cf $webin_cli_outputs $outputs_dir ;
134 ]]></command>
135 <configfiles>
136 <configfile name="credentials"><![CDATA[
137 #set $webin_id = $__user__.extra_preferences.get('ena_webin_account|webin_id', "").strip()
138 #set $password = $__user__.extra_preferences.get('ena_webin_account|password', "").strip()
139 #if $webin_id != "":
140 username:$webin_id
141 password:$password
142 #end if
143
144 ]]></configfile>
145 <configfile name="genome_fasta_files">
146 #import json
147 #import re
148 #if $metadata_file_or_form.metadata_format == "file":
149 #set $fasta_files_list = list()
150 #for $file in $metadata_file_or_form.genome_fasta:
151 $fasta_files_list.append(str($file.element_identifier))
152 #end for
153 #echo json.dumps($fasta_files_list)
154 #end if
155 </configfile>
156 </configfiles>
157 <inputs>
158 <param name="assembly_type" type="select" label="Assembly type">
159 <option value="clone">Clone</option>
160 <option value="isolate">Isolate</option>
161 <option value="COVID-19 outbreak">COVID-19 outbreak</option>
162 </param>
163 <param name="assembly_program" type="text" optional="False" label="Assembly program"/>
164 <param name="molecule_type" type="select" label="Molecule type">
165 <option value="genomic RNA" selected="True">genomic RNA</option>
166 <option value="viral cRNA">viral cRNA</option>
167 <option value="genomic DNA">genomic DNA</option>
168 </param>
169 <param name="coverage" type="float" optional="False" value="10000" label="Coverage"/>
170 <param name="min_gap_length" type="text" optional="True" label="Minimum gap length (optional)"/>
171 <conditional name="metadata_file_or_form">
172 <param name="metadata_format" type="select" label="Select the method to load study and sample metadata">
173 <option value="form" selected="True">Fill in required submission metadata</option>
174 <option value="file">I used the Galaxy ENA upload tool to submit the raw data: parse the received submission receipt</option>
175 </param>
176 <when value="file">
177 <param type="data" format="txt" name="ena_receipt" label="Submission receipt obtained from ENA upload tool"/>
178 <param name="genome_fasta" type="data" label="Select the consensus sequence assembly files or a collection of them" format="fasta,fasta.gz" multiple="true"/>
179 </when>
180 <when value="form">
181 <param name="assembly_name" type="text" optional="False" label="Assembly name"/>
182 <param name="study_accession" type="text" optional="False" label="Study accession"/>
183 <param name="sample_accession" type="text" optional="False" label="Sample accession"/>
184 <param name="sequencing_platform" type="text" optional="False" label="Sequencing platform"/>
185 <param name="description" type="text" optional="True" value="" label="Description" help="Free text description of the genome assembly (optional)"/>
186 <param name="center_name" type="text" optional="False" label="Center name"/>
187 <param name="genome_fasta" type="data" label="Select the consensus sequence assembly file" format="fasta,fasta.gz"/>
188 </when>
189 </conditional>
190 <param name="submit_test" type="boolean" truevalue="true" falsevalue="false" label="Submit to ENA test server" help="Uploads to the test server of ENA will not be made public and will be removed automatically in 24 hours. Performing a preliminary test upload is advised to check for errors with metadata structure. You can find these uploads at https://wwwdev.ebi.ac.uk/ena/." />
191 <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)"/>
192 </inputs>
193 <outputs>
194 <collection name="generated_manifests" type="list" label="Generated manifests">
195 <discover_datasets pattern="(?P&lt;designation&gt;.+)\.txt" ext="txt" directory="manifests/"/>
196 </collection>
197 <data name="webin_cli_log" label="ENA submission log" format="txt"/>
198 <data name="webin_cli_outputs" label="Webin cli outputs" format="tar"/>
199
200 </outputs>
201 <tests>
202 <test>
203 <param name="submit_test" value="true" />
204 <param name="dry_run" value="true" />
205 <param name="assembly_type" value="isolate"/>
206 <param name="assembly_program" value="Test assembly program"/>
207 <param name="molecule_type" value="viral cRNA"/>
208 <param name="coverage" value="10000"/>
209 <conditional name="metadata_file_or_form">
210 <param name="metadata_format" value="form"/>
211 <param name="assembly_name" value="Test assembly name"/>
212 <param name="study_accession" value="PRJEB49173"/>
213 <param name="sample_accession" value="SAMEA11953908"/>
214 <param name="sequencing_platform" value="Nanopore 0011"/>
215 <param name="description" value="Test Description"/>
216 <param name="center_name" value="Test center name"/>
217 <param name="genome_fasta" value="phiX2.fasta"/>
218 </conditional>
219 <param name="min_gap_length" value="30"/>
220 <output name="webin_cli_log">
221 <assert_contents>
222 <has_n_lines n="4"/>
223 <has_text_matching expression="ERROR: Invalid submission account user name or password."/>
224 </assert_contents>
225 </output>
226 </test>
227 <test>
228 <param name="submit_test" value="true" />
229 <param name="dry_run" value="true" />
230 <param name="assembly_type" value="isolate"/>
231 <param name="assembly_program" value="Test assembly program"/>
232 <param name="molecule_type" value="viral cRNA"/>
233 <param name="coverage" value="10000"/>
234 <conditional name="metadata_file_or_form">
235 <param name="metadata_format" value="file"/>
236 <param name="ena_receipt" value="receipt_sample_noPhiX.txt"/>
237 <param name="genome_fasta" value="phiX2.fasta.gz,sample_alias_001.fasta.gz"/>
238 </conditional>
239 <param name="min_gap_length" value="30"/>
240 <output name="webin_cli_log">
241 <assert_contents>
242 <has_text_matching expression="Processing phiX2"/>
243 <has_text_matching expression="No metadata found for sample phiX2"/>
244 <has_text_matching expression="Processing sample_alias_001"/>
245 <has_text_matching expression="Submitting manifest ./manifests/sample_alias_001.manifest.txt"/>
246 <has_text_matching expression="ERROR: Invalid submission account user name or password. Please try enclosing your password in single quotes."/>
247 </assert_contents>
248 </output>
249 </test>
250 <test>
251 <param name="submit_test" value="true" />
252 <param name="dry_run" value="true" />
253 <param name="assembly_type" value="isolate"/>
254 <param name="assembly_program" value="Test assembly program"/>
255 <param name="molecule_type" value="viral cRNA"/>
256 <param name="coverage" value="10000"/>
257 <conditional name="metadata_file_or_form">
258 <param name="metadata_format" value="file"/>
259 <param name="ena_receipt" value="receipt_sample.txt"/>
260 <param name="genome_fasta" value="sample_alias_001.fasta.gz"/>
261 </conditional>
262 <param name="min_gap_length" value="30"/>
263 <output name="webin_cli_log">
264 <assert_contents>
265 <has_text_matching expression="ERROR: Invalid submission account user name or password. Please try enclosing your password in single quotes."/>
266 </assert_contents>
267 </output>
268 </test>
269 </tests>
270 <help><![CDATA[
271 This tool is a wrapper for the ENA Webin CLI submission tool (https://ena-docs.readthedocs.io/en/latest/submit/general-guide/webin-cli.html).
272
273 .. class:: warningmark
274
275 The ENA upload tool won't work unless you have provided an ENA Webin ID in User > Preferences > Manage Information > ENA Webin account details.]]></help>
276 <citations>
277 <citation type="doi">10.1093/nar/gkac1051</citation>
278 </citations>
279 </tool>