Mercurial > repos > ieguinoa > ena_webin_cli
view ena_consensus_submit.xml @ 2:1ecd8ce07db4 draft
Uploaded
author | ieguinoa |
---|---|
date | Fri, 04 Feb 2022 15:52:45 +0000 |
parents | f24eb2f2cb0c |
children | 7d751b5943b0 |
line wrap: on
line source
<tool id="ena_consensus_submit" name="Submit consensus sequence to ENA" version="@VERSION@" python_template_version="3.5"> <macros> <token name="@VERSION@">4.3.0</token> </macros> <requirements> <requirement type="package" version="@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 $test_submit == "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": ## 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 './manifests' './fasta' $manifest_base; 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; #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`; ena-webin-cli -context genome -userName "'\$webin_id'" -password "'\$password'" -centerName "'\$center_name'" -manifest \$manifest -inputDir './fasta' #if $dry_run == "true": -validate #end if -outputDir $outputs_dir >> $webin_cli_log ; done < submit_list.tab #else: gzip -c $genome_fasta > consensus.fasta.gz; echo -e 'FASTA\tconsensus.fasta.gz' >> $generated_manifest; 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 ; ##cp ./genome/$metadata_file_or_form.assembly_name/validate/webin-cli.report $validate_output #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> </configfiles> <inputs> <param name="test_submit" type="hidden" value="False" /> <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." /> <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)"/> <param name="genome_fasta" type="data" label="Select the consensus sequence assembly file" format="fasta"/> <param name="assembly_type" type="select" label="Assembly type"> <option value="clone">Clone</option> <option value="isolate">Isolate</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"/> <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">(Beta) 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"/> </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 or unique name (alias)"/> <param name="sample_accession" type="text" optional="False" label="Sample accession or unique name (alias)"/> <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"/> </when> </conditional> <param name="min_gap_length" type="text" optional="True" label="Minimum gap length (optional)"/> </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="test_submit" value="True" /> <param name="genome_fasta" value="phiX2.fasta"/> <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"/> </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> </tests> <help><![CDATA[ TODO: Fill in help. ]]></help> </tool>