comparison ena_webin_cli.xml @ 1:1090ae5e7b29 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/ena_webin_cli commit 6f9ce1aba91681e831f2649fb36b74cc3d572eb3
author iuc
date Fri, 24 Oct 2025 08:03:03 +0000
parents 7f669682f4ac
children
comparison
equal deleted inserted replaced
0:7f669682f4ac 1:1090ae5e7b29
1 <tool id="ena_webin_cli" name="ENA Webin CLI" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" license="MIT" profile="24.2"> 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> 2 <description>Submission of consensus sequences to the European Nucleotide Archive (ENA)</description>
3 <macros> 3 <macros>
4 <token name="@TOOL_VERSION@">9.0.1</token> 4 <token name="@TOOL_VERSION@">9.0.1</token>
5 <token name="@VERSION_SUFFIX@">0</token> 5 <token name="@VERSION_SUFFIX@">1</token>
6 </macros> 6 </macros>
7 <requirements> 7 <requirements>
8 <requirement type="package" version="@TOOL_VERSION@">ena-webin-cli</requirement> 8 <requirement type="package" version="@TOOL_VERSION@">ena-webin-cli</requirement>
9 <requirement type="package" version="5.3">pyyaml</requirement> 9 <requirement type="package" version="5.3">pyyaml</requirement>
10 </requirements> 10 </requirements>
11 11
12 <command detect_errors="exit_code"><![CDATA[ 12 <command detect_errors="exit_code"><![CDATA[
13 ## ----------------------------------------------------------------------------- 13 ## -----------------------------------------------------------------------------
14 ## 1) Initialize log and credentials 14 ## 1) Initialize log and credentials
15 ## ----------------------------------------------------------------------------- 15 ## -----------------------------------------------------------------------------
16 echo "Initializing log and credentials";
16 17
17 ## Truncate (or create) the Galaxy-captured Webin-CLI log dataset. 18 ## Truncate (or create) the Galaxy-captured Webin-CLI log dataset.
18 : > "$webin_cli_log"; 19 : > "$webin_cli_log";
19 20
20 ## Default path where the <configfile name="credentials"> content will be written.
21 ## In dry-run we override this with a fake file so tests don’t require real creds.
22 #set $credentials = 'credentials'
23 #if $dry_run == "true":
24 #set $credentials = './test_fake_path'
25 touch $credentials;
26 echo "username:test_user" >> "$credentials";
27 echo "password:test_password" >> "$credentials";
28 #end if
29
30 ## Extract username/password from the credentials file. 21 ## Extract username/password from the credentials file.
31 ## NOTE: $webin_id appears in bash, so we escape it as \$webin_id. 22 ## NOTE: $webin_id appears in bash, so we escape it as \$webin_id.
32 webin_id=`grep 'username' $credentials | cut -d':' -f2,2`; 23 webin_id=`grep 'username' $credentials | cut -d':' -f2`;
33 if [ -z "\$webin_id" ]; then 24 if [ -z "\$webin_id" ]; then
34 ## Fail early with guidance if no username is present. 25 ## Fail early with guidance if no username is present.
35 echo "No ENA credentials defined. Set your credentials via: User -> Preferences -> Manage Information" >&2; 26 echo "No ENA credentials defined. Set your credentials via: User -> Preferences -> Manage Information" >&2;
36 exit 1; 27 exit 1;
37 else 28 else
38 ## Pull the password similarly. 29 ## Pull the password similarly.
39 password=`grep 'password' $credentials | cut -d':' -f2,2`; 30 password=`grep 'password' $credentials | cut -d':' -f2`;
40 fi; 31 fi;
41 32
42 ## ----------------------------------------------------------------------------- 33 ## -----------------------------------------------------------------------------
43 ## 2) Create a base manifest (fields common to all submissions) 34 ## 2) Create a base manifest (fields common to all submissions)
44 ## ----------------------------------------------------------------------------- 35 ## -----------------------------------------------------------------------------
36 echo "Creating a base manifest (fields common to all submissions)";
45 37
46 ## Name of the base manifest template (we append more fields later). 38 ## Name of the base manifest template (we append more fields later).
47 #set $manifest_base = 'manifest_base.tab' 39 #set $manifest_base = 'manifest_base.tab'
48 40
49 ## Working dirs: per-sample manifests and input sequences. 41 ## Working dirs: per-sample manifests and input sequences.
60 echo -e 'MOLECULETYPE\t$molecule_type' >> $manifest_base; 52 echo -e 'MOLECULETYPE\t$molecule_type' >> $manifest_base;
61 53
62 ## ----------------------------------------------------------------------------- 54 ## -----------------------------------------------------------------------------
63 ## 3) Build per-sample manifests depending on metadata workflow 55 ## 3) Build per-sample manifests depending on metadata workflow
64 ## ----------------------------------------------------------------------------- 56 ## -----------------------------------------------------------------------------
57 echo "Building per-sample manifests depending on metadata workflow";
65 58
66 #if $metadata_file_or_form.metadata_format == "file": 59 #if $metadata_file_or_form.metadata_format == "file":
67 ## --------------------------- FILE-DRIVEN WORKFLOW ------------------------ 60 ## --------------------------- FILE-DRIVEN WORKFLOW ------------------------
68 ## For each selected FASTA: 61 ## For each selected FASTA:
69 ## - if uncompressed (.fasta), gzip it into ./fasta/<name>.fasta.gz 62 ## - if uncompressed (.fasta), gzip it into ./fasta/<name>.fasta.gz
149 echo -e 'CHROMOSOME_LIST\t$chr_file_name' >> $generated_manifest; 142 echo -e 'CHROMOSOME_LIST\t$chr_file_name' >> $generated_manifest;
150 #end if 143 #end if
151 #end if 144 #end if
152 145
153 ## ----------------------------------------------------------------------------- 146 ## -----------------------------------------------------------------------------
154 ## 4) Prepare output directory and build CLI flags safely with Cheetah 147 ## 4) Prepare output directory and build CLI flags
155 ## ----------------------------------------------------------------------------- 148 ## -----------------------------------------------------------------------------
149 echo "Preparing output directory and build CLI flags";
156 150
157 ## Webin-CLI will write receipts/logs under this directory (we later tar it). 151 ## Webin-CLI will write receipts/logs under this directory (we later tar it).
158 #set $outputs_dir = 'outputs' 152 #set $outputs_dir = 'outputs'
159 mkdir -p "$outputs_dir"; 153 mkdir -p "$outputs_dir";
160 154
171 #end if 165 #end if
172 166
173 ## ----------------------------------------------------------------------------- 167 ## -----------------------------------------------------------------------------
174 ## 5) Execute Webin-CLI 168 ## 5) Execute Webin-CLI
175 ## ----------------------------------------------------------------------------- 169 ## -----------------------------------------------------------------------------
170 echo "Executing Webin-CLI";
176 171
177 #if $metadata_file_or_form.metadata_format == "file": 172 #if $metadata_file_or_form.metadata_format == "file":
178 ## Loop over each manifest written by process_input.py (submit_list.tab). 173 ## Loop over each manifest written by process_input.py (submit_list.tab).
179 while IFS= read -r line; do 174 while IFS= read -r line; do
180 ## Extract the manifest path (first whitespace-delimited field). 175 ## Extract the manifest path (first whitespace-delimited field).
182 177
183 ## Log which manifest we are submitting. 178 ## Log which manifest we are submitting.
184 echo "Submitting manifest \$manifest" >> "$webin_cli_log" 2>&1; 179 echo "Submitting manifest \$manifest" >> "$webin_cli_log" 2>&1;
185 180
186 ## Invoke Webin-CLI with computed flags. 181 ## Invoke Webin-CLI with computed flags.
187 ena-webin-cli -context genome -manifest "\$manifest" -userName "'\$webin_id'" -password "'\$password'" -centerName "'\$center_name'" -inputDir './fasta' $test_flag $action_flag -outputDir $outputs_dir >> '$webin_cli_log' 2>&1 || true; 182 ena-webin-cli -context genome -manifest "\$manifest" -userName "\$webin_id" -password "\$password" -centerName "\$center_name" -inputDir "./fasta" $test_flag $action_flag -outputDir $outputs_dir >> '$webin_cli_log' 2>&1 || true;
188 done < submit_list.tab; 183 done < submit_list.tab;
189 184
190 #else: 185 #else:
191 ## Single run in "form" mode with the one generated manifest. 186 ## Single run in "form" mode with the one generated manifest.
192 ena-webin-cli -context genome -manifest $generated_manifest -userName "'\$webin_id'" -password "'\$password'" -centerName "'\$center_name'" -inputDir ./ $test_flag $action_flag -outputDir $outputs_dir >> "$webin_cli_log" 2>&1 || true; 187 ena-webin-cli -context genome -manifest $generated_manifest -userName "\$webin_id" -password "\$password" -centerName "\$center_name" -inputDir "./" $test_flag $action_flag -outputDir $outputs_dir >> "$webin_cli_log" 2>&1 || true;
193 #end if 188 #end if
194 189
195 ## ----------------------------------------------------------------------------- 190 ## -----------------------------------------------------------------------------
196 ## 6) Package outputs for Galaxy 191 ## 6) Package outputs for Galaxy
197 ## ----------------------------------------------------------------------------- 192 ## -----------------------------------------------------------------------------
193 echo "Packaging outputs for Galaxy";
198 194
199 ## Tar up the Webin-CLI output directory so Galaxy can collect a single dataset. 195 ## Tar up the Webin-CLI output directory so Galaxy can collect a single dataset.
200 tar -cf $webin_cli_outputs $outputs_dir ; 196 tar -cf $webin_cli_outputs $outputs_dir ;
201 ]]></command> 197 ]]></command>
202 198
209 Pulls stored ENA Webin details (if set) from the Galaxy user preferences and writes 205 Pulls stored ENA Webin details (if set) from the Galaxy user preferences and writes
210 simple "username:..." and "password:..." lines. The command reads from this file. --> 206 simple "username:..." and "password:..." lines. The command reads from this file. -->
211 <configfile name="credentials"><![CDATA[ 207 <configfile name="credentials"><![CDATA[
212 #set $webin_id = $__user__.extra_preferences.get('ena_webin_account|webin_id', "").strip() 208 #set $webin_id = $__user__.extra_preferences.get('ena_webin_account|webin_id', "").strip()
213 #set $password = $__user__.extra_preferences.get('ena_webin_account|password', "").strip() 209 #set $password = $__user__.extra_preferences.get('ena_webin_account|password', "").strip()
214 #if $webin_id != "": 210 ## In dry-run we add fake creds when not provided.
215 username:$webin_id 211 #if $webin_id == "" and $dry_run == "true":
216 password:$password 212 #set $webin_id = "test-webin"
213 #set $password = "test-password"
214 #end if
215 #if $webin_id != "" :
216 username:$webin_id
217 password:$password
217 #end if 218 #end if
218 ]]></configfile> 219 ]]></configfile>
219 220
220 <!-- genome_fasta_files: 221 <!-- genome_fasta_files:
221 In "file" mode, build a JSON array containing the *element_identifier* (dataset name) 222 In "file" mode, build a JSON array containing the *element_identifier* (dataset name)
312 <param name="molecule_type" value="viral cRNA"/> 313 <param name="molecule_type" value="viral cRNA"/>
313 <param name="coverage" value="10000"/> 314 <param name="coverage" value="10000"/>
314 <conditional name="metadata_file_or_form"> 315 <conditional name="metadata_file_or_form">
315 <param name="metadata_format" value="form"/> 316 <param name="metadata_format" value="form"/>
316 <param name="assembly_name" value="Test assembly name"/> 317 <param name="assembly_name" value="Test assembly name"/>
317 <param name="study_accession" value="PRJEB49173"/> 318 <param name="study_accession" value="FAKE001"/>
318 <param name="sample_accession" value="SAMEA11953908"/> 319 <param name="sample_accession" value="FAKESAMP001"/>
319 <param name="sequencing_platform" value="Nanopore 0011"/> 320 <param name="sequencing_platform" value="Nanopore 0011"/>
320 <param name="description" value="Test Description"/> 321 <param name="description" value="Test Description"/>
321 <param name="center_name" value="Test center name"/> 322 <param name="center_name" value="Test center name"/>
322 <param name="genome_fasta" value="phiX2.fasta"/> 323 <param name="genome_fasta" value="phiX2.fasta"/>
323 </conditional> 324 </conditional>
347 <param name="molecule_type" value="genomic DNA"/> 348 <param name="molecule_type" value="genomic DNA"/>
348 <param name="coverage" value="10000"/> 349 <param name="coverage" value="10000"/>
349 <conditional name="metadata_file_or_form"> 350 <conditional name="metadata_file_or_form">
350 <param name="metadata_format" value="form"/> 351 <param name="metadata_format" value="form"/>
351 <param name="assembly_name" value="Test assembly name"/> 352 <param name="assembly_name" value="Test assembly name"/>
352 <param name="study_accession" value="PRJEB49173"/> 353 <param name="study_accession" value="FAKE001"/>
353 <param name="sample_accession" value="SAMEA11953908"/> 354 <param name="sample_accession" value="FAKESAMP001"/>
354 <param name="sequencing_platform" value="Nanopore 0011"/> 355 <param name="sequencing_platform" value="Nanopore 0011"/>
355 <param name="description" value="Test Description"/> 356 <param name="description" value="Test Description"/>
356 <param name="center_name" value="Test center name"/> 357 <param name="center_name" value="Test center name"/>
357 <param name="genome_fasta" value="phiX3.fasta"/> 358 <param name="genome_fasta" value="phiX3.fasta"/>
358 <param name="chr_list_file" value="phiX3.tsv"/> 359 <param name="chr_list_file" value="phiX3.tsv"/>