Mercurial > repos > iuc > ena_webin_cli
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ena_webin_cli.xml Tue Aug 05 11:53:57 2025 +0000 @@ -0,0 +1,279 @@ +<tool id="ena_webin_cli" name="ENA Webin CLI" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" license="MIT" profile="24.2"> + <description>Submission of consensus sequences to the European Nucleotide Archive (ENA)</description> + <macros> + <token name="@TOOL_VERSION@">8.1.1</token> + <token name="@VERSION_SUFFIX@">0</token> + </macros> + <requirements> + <requirement type="package" version="@TOOL_VERSION@">ena-webin-cli</requirement> + <requirement type="package" version="1.76">biopython</requirement> + <requirement type="package" version="5.3">pyyaml</requirement> + </requirements> + <command detect_errors="exit_code"><![CDATA[ +#if $dry_run == "True": + #set $credentials='./test_fake_path'; + touch $credentials; + echo "username:test_user" >> $credentials; + echo "password:test_password" >> $credentials; +#end if + +webin_id=`grep 'username' $credentials | cut -d':' -f2,2`; +if [ "\$webin_id" = "" ]; then + ## No credentials in user defined preferences + ## Fallback to global defined credentials (if exist) + #import os + #if os.path.isfile(os.environ.get('GALAXY_ENA_SECRETS', '')): + credentials_path=\${GALAXY_ENA_SECRETS}; + webin_id=`grep 'username' \$GALAXY_ENA_SECRETS | cut -d':' -f2,2` | sed -e 's/^[[:space:]]*//'`; + password=`grep 'password' \$GALAXY_ENA_SECRETS | cut -d':' -f2,2` | sed -e 's/^[[:space:]]*//'`; + if [ "\$webin_id" = "" ]; then + echo "No global credentials defined. Check your GALAXY_ENA_SECRETS file or set your credentials via: User -> Preferences -> Manage Information"; + exit 1; + fi; + #else: + echo "No ENA credentials defined. Set your credentials via: User -> Preferences -> Manage Information"; + exit 1; + #end if +else + password=`grep 'password' $credentials | cut -d':' -f2,2`; +fi; + + +## create a manifest base file with the parameters that are identical for all sequences that will be submited (if submitting a multifasta) +#set $manifest_base = 'manifest_base.tab' +mkdir manifests; +mkdir fasta; + +echo -e 'ASSEMBLY_TYPE\t$assembly_type' > $manifest_base; +echo -e 'COVERAGE\t$coverage' >> $manifest_base; +echo -e 'PROGRAM\t$assembly_program' >> $manifest_base; +#if $min_gap_length: + echo -e 'MINGAPLENGTH\t$min_gap_length' >> $manifest_base; +#end if +echo -e 'MOLECULETYPE\t$molecule_type' >> $manifest_base; + +#if $metadata_file_or_form.metadata_format == "file": + #import re + #for $file in $metadata_file_or_form.genome_fasta: + #if $file.is_of_type('fasta'): + #set $full_name = $file.element_identifier + '.gz' + gzip -c '$file' > './fasta/$full_name'; + #else: + ln -s '$file' './fasta/$file.element_identifier'; + #end if + + #end for + ## process the input tables, this creates an intermediate file with information + python3 '$__tool_directory__/process_input.py' $metadata_file_or_form.ena_receipt $genome_fasta_files './manifests' $manifest_base >> $webin_cli_log; + center_name=`grep 'center_name' $metadata_file_or_form.ena_receipt | cut -f2,2 | tr -d '\n'`; +#else: + #set $generated_manifest='./manifests/generated_manifest.txt' + cp $manifest_base $generated_manifest; + #set $study_id = $metadata_file_or_form.study_accession + #set $sample_id = $metadata_file_or_form.sample_accession + echo -e 'STUDY\t$study_id' >> $generated_manifest; + echo -e 'SAMPLE\t$sample_id' >> $generated_manifest; + center_name='$metadata_file_or_form.center_name'; + echo -e 'NAME\t$metadata_file_or_form.assembly_name' >> $generated_manifest; + echo -e 'PLATFORM\t$metadata_file_or_form.sequencing_platform' >> $generated_manifest; + #if $metadata_file_or_form.genome_fasta.is_of_type('fasta'): + gzip -c $metadata_file_or_form.genome_fasta > consensus.fasta.gz; + #else: + ln -s $metadata_file_or_form.genome_fasta consensus.fasta.gz; + #end if + echo -e 'FASTA\tconsensus.fasta.gz' >> $generated_manifest; +#end if + +#set $outputs_dir = 'outputs' +mkdir $outputs_dir; +#if $metadata_file_or_form.metadata_format == "file": + ## iterate over the list of manifest - fasta generated by the process_input + ## in case of errors, this list is empty + while read line; do + manifest=`echo \$line | cut -d' ' -f1,1`; + echo "Submitting manifest \$manifest" >> $webin_cli_log; + ena-webin-cli + -context genome + -userName "'\$webin_id'" + -password "'\$password'" + -centerName "'\$center_name'" + -manifest \$manifest + -inputDir './fasta' + #if $submit_test == "true": + -test + #end if + #if $dry_run == "true": + -validate + #else: + -submit + #end if + -outputDir $outputs_dir + >> $webin_cli_log; + done < submit_list.tab; + +#else: + ena-webin-cli + #if $submit_test == "true": + -test + #end if + #if $dry_run == "true": + -validate + #else: + -submit + #end if + -context genome + -manifest $generated_manifest + -password "'\$password'" + -userName "'\$webin_id'" + -inputDir "./" + -centerName "'\$center_name'" + -outputDir $outputs_dir + >> $webin_cli_log ; +#end if +tar -cf $webin_cli_outputs $outputs_dir ; +]]></command> + <configfiles> + <configfile name="credentials"><![CDATA[ +#set $webin_id = $__user__.extra_preferences.get('ena_webin_account|webin_id', "").strip() +#set $password = $__user__.extra_preferences.get('ena_webin_account|password', "").strip() +#if $webin_id != "": + username:$webin_id + password:$password +#end if + + ]]></configfile> + <configfile name="genome_fasta_files"> +#import json +#import re +#if $metadata_file_or_form.metadata_format == "file": + #set $fasta_files_list = list() + #for $file in $metadata_file_or_form.genome_fasta: + $fasta_files_list.append(str($file.element_identifier)) + #end for + #echo json.dumps($fasta_files_list) +#end if + </configfile> + </configfiles> +<inputs> + <param name="assembly_type" type="select" label="Assembly type"> + <option value="clone">Clone</option> + <option value="isolate">Isolate</option> + <option value="COVID-19 outbreak">COVID-19 outbreak</option> + </param> + <param name="assembly_program" type="text" optional="False" label="Assembly program"/> + <param name="molecule_type" type="select" label="Molecule type"> + <option value="genomic RNA" selected="True">genomic RNA</option> + <option value="viral cRNA">viral cRNA</option> + <option value="genomic DNA">genomic DNA</option> + </param> + <param name="coverage" type="float" optional="False" value="10000" label="Coverage"/> + <param name="min_gap_length" type="text" optional="True" label="Minimum gap length (optional)"/> + <conditional name="metadata_file_or_form"> + <param name="metadata_format" type="select" label="Select the method to load study and sample metadata"> + <option value="form" selected="True">Fill in required submission metadata</option> + <option value="file">I used the Galaxy ENA upload tool to submit the raw data: parse the received submission receipt</option> + </param> + <when value="file"> + <param type="data" format="txt" name="ena_receipt" label="Submission receipt obtained from ENA upload tool"/> + <param name="genome_fasta" type="data" label="Select the consensus sequence assembly files or a collection of them" format="fasta,fasta.gz" multiple="true"/> + </when> + <when value="form"> + <param name="assembly_name" type="text" optional="False" label="Assembly name"/> + <param name="study_accession" type="text" optional="False" label="Study accession"/> + <param name="sample_accession" type="text" optional="False" label="Sample accession"/> + <param name="sequencing_platform" type="text" optional="False" label="Sequencing platform"/> + <param name="description" type="text" optional="True" value="" label="Description" help="Free text description of the genome assembly (optional)"/> + <param name="center_name" type="text" optional="False" label="Center name"/> + <param name="genome_fasta" type="data" label="Select the consensus sequence assembly file" format="fasta,fasta.gz"/> + </when> + </conditional> + <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/." /> + <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)"/> + </inputs> + <outputs> + <collection name="generated_manifests" type="list" label="Generated manifests"> + <discover_datasets pattern="(?P<designation>.+)\.txt" ext="txt" directory="manifests/"/> + </collection> + <data name="webin_cli_log" label="ENA submission log" format="txt"/> + <data name="webin_cli_outputs" label="Webin cli outputs" format="tar"/> + + </outputs> + <tests> + <test> + <param name="submit_test" value="true" /> + <param name="dry_run" value="true" /> + <param name="assembly_type" value="isolate"/> + <param name="assembly_program" value="Test assembly program"/> + <param name="molecule_type" value="viral cRNA"/> + <param name="coverage" value="10000"/> + <conditional name="metadata_file_or_form"> + <param name="metadata_format" value="form"/> + <param name="assembly_name" value="Test assembly name"/> + <param name="study_accession" value="PRJEB49173"/> + <param name="sample_accession" value="SAMEA11953908"/> + <param name="sequencing_platform" value="Nanopore 0011"/> + <param name="description" value="Test Description"/> + <param name="center_name" value="Test center name"/> + <param name="genome_fasta" value="phiX2.fasta"/> + </conditional> + <param name="min_gap_length" value="30"/> + <output name="webin_cli_log"> + <assert_contents> + <has_n_lines n="4"/> + <has_text_matching expression="ERROR: Invalid submission account user name or password."/> + </assert_contents> + </output> + </test> + <test> + <param name="submit_test" value="true" /> + <param name="dry_run" value="true" /> + <param name="assembly_type" value="isolate"/> + <param name="assembly_program" value="Test assembly program"/> + <param name="molecule_type" value="viral cRNA"/> + <param name="coverage" value="10000"/> + <conditional name="metadata_file_or_form"> + <param name="metadata_format" value="file"/> + <param name="ena_receipt" value="receipt_sample_noPhiX.txt"/> + <param name="genome_fasta" value="phiX2.fasta.gz,sample_alias_001.fasta.gz"/> + </conditional> + <param name="min_gap_length" value="30"/> + <output name="webin_cli_log"> + <assert_contents> + <has_text_matching expression="Processing phiX2"/> + <has_text_matching expression="No metadata found for sample phiX2"/> + <has_text_matching expression="Processing sample_alias_001"/> + <has_text_matching expression="Submitting manifest ./manifests/sample_alias_001.manifest.txt"/> + <has_text_matching expression="ERROR: Invalid submission account user name or password. Please try enclosing your password in single quotes."/> + </assert_contents> + </output> + </test> + <test> + <param name="submit_test" value="true" /> + <param name="dry_run" value="true" /> + <param name="assembly_type" value="isolate"/> + <param name="assembly_program" value="Test assembly program"/> + <param name="molecule_type" value="viral cRNA"/> + <param name="coverage" value="10000"/> + <conditional name="metadata_file_or_form"> + <param name="metadata_format" value="file"/> + <param name="ena_receipt" value="receipt_sample.txt"/> + <param name="genome_fasta" value="sample_alias_001.fasta.gz"/> + </conditional> + <param name="min_gap_length" value="30"/> + <output name="webin_cli_log"> + <assert_contents> + <has_text_matching expression="ERROR: Invalid submission account user name or password. Please try enclosing your password in single quotes."/> + </assert_contents> + </output> + </test> + </tests> + <help><![CDATA[ + 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). + + .. class:: warningmark + + 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> + <citations> + <citation type="doi">10.1093/nar/gkac1051</citation> + </citations> +</tool> \ No newline at end of file
