Mercurial > repos > ieguinoa > ena_webin_cli
comparison ena_consensus_submit.xml @ 0:e25357392813 draft
Uploaded
author | ieguinoa |
---|---|
date | Tue, 18 May 2021 16:30:52 +0000 |
parents | |
children | f24eb2f2cb0c |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e25357392813 |
---|---|
1 <tool id="ena_consensus_submit" name="Submit consensus sequence to ENA" version="0.1.0" python_template_version="3.5"> | |
2 <macros> | |
3 <token name="@VERSION@">3.7.0</token> | |
4 </macros> | |
5 <requirements> | |
6 <requirement type="package" version="@VERSION@">ena-webin-cli</requirement> | |
7 <requirement type="package" version="1.76">biopython</requirement> | |
8 <requirement type="package" version="5.3">pyyaml</requirement> | |
9 </requirements> | |
10 <command detect_errors="exit_code"><![CDATA[ | |
11 | |
12 webin_id=`grep 'username' $credentials | cut -f2,2`; | |
13 if [ "\$webin_id" = "" ]; then | |
14 ## No credentials in user defined preferences | |
15 ## Fallback to global defined credentials (if exist) | |
16 #import os | |
17 #if os.path.isfile(os.environ.get('GALAXY_ENA_SECRETS', '')): | |
18 credentials_path=\${GALAXY_ENA_SECRETS}; | |
19 webin_id=`grep 'username' \$GALAXY_ENA_SECRETS | cut -d' ' -f2,2`; | |
20 password=`grep 'password' \$GALAXY_ENA_SECRETS | cut -d' ' -f2,2`; | |
21 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"; | |
23 exit 1; | |
24 fi; | |
25 #else: | |
26 echo "No ENA credentials defined. Set your credentials via: User -> Preferences -> Manage Information"; | |
27 exit 1; | |
28 #end if | |
29 else | |
30 password=`grep 'password' $credentials | cut -f2,2`; | |
31 fi; | |
32 | |
33 ## if it is still running at this point then the webin_id and password are set | |
34 | |
35 ## create a manifaste 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' | |
37 mkdir manifests; | |
38 mkdir fasta; | |
39 | |
40 echo -e "ASSEMBLY_TYPE\t$assembly_type" >> $manifest_base; | |
41 echo -e "COVERAGE\t$coverage" >> $manifest_base; | |
42 echo -e "PROGRAM\t$assembly_program" >> $manifest_base; | |
43 echo -e "MINGAPLENGTH\t$min_gap_length" >> $manifest_base; | |
44 echo -e "MOLECULETYPE\t$molecule_type" >> $manifest_base; | |
45 | |
46 #if $metadata_file_or_form.metadata_format == "file": | |
47 ## process the input tables, this creates an intermediate file with information | |
48 python3 '$__tool_directory__/process_input.py' $metadata_file_or_form.ena_receipt $genome_fasta './manifests' './fasta' $manifest_base; | |
49 center_name=`grep 'center_name' $metadata_file_or_form.ena_receipt | cut -f2,2 | tr -d '\n'`; | |
50 #else: | |
51 #set $generated_manifest='./manifests/generated_manifest.txt' | |
52 cp $manifest_base $generated_manifest | |
53 $study_id = $metadata_file_or_form.study_accession | |
54 $sample_id = $metadata_file_or_form.sample_accession | |
55 echo "STUDY\t$study_id" > $generated_manifest; | |
56 echo "SAMPLE\t$sample_id" >> $generated_manifest; | |
57 center_name=$metadata_file_or_form.center_name; | |
58 echo "ASSEMBLY_NAME\t$metadata_file_or_form.assembly_name" >> $generated_manifest; | |
59 echo "PLATFORM\t$platform_name" >> $generated_manifest; | |
60 #end if | |
61 | |
62 | |
63 #if $metadata_file_or_form.metadata_format == "file": | |
64 ## iterate over the list of manifest - fasta generated by the process_input | |
65 ## in case of errors, this list is empty | |
66 while read line; do | |
67 manifest=`echo \$line | cut -d' ' -f1,1`; | |
68 ena-webin-cli | |
69 -context genome | |
70 -userName \$webin_id | |
71 -password \$password | |
72 -centerName \$center_name | |
73 -manifest \$manifest | |
74 -inputDir "./fasta" | |
75 #if $dry_run == "true": | |
76 -validate | |
77 #end if | |
78 ; | |
79 done < submit_list.tab | |
80 | |
81 #else: | |
82 gzip -c $genome_fasta > consensus.fasta.gz; | |
83 echo -e "FASTA\tconsensus.fasta.gz" >> $generated_manifest; | |
84 ena-webin-cli | |
85 -context genome | |
86 -userName \$webin_id | |
87 -password \$password | |
88 -centerName '\$center_name' | |
89 -manifest $generated_manifest | |
90 -inputDir "./" | |
91 #if $submit_test == "true": | |
92 -test | |
93 #end if | |
94 #if $dry_run == "true": | |
95 -validate | |
96 #else: | |
97 -submit | |
98 #end if | |
99 #end if | |
100 ]]></command> | |
101 <configfiles> | |
102 <configfile name="credentials"><![CDATA[ | |
103 #set $webin_id = $__user__.extra_preferences.get('ena_webin_account|webin_id', "").strip() | |
104 #set $password = $__user__.extra_preferences.get('ena_webin_account|password', "").strip() | |
105 #if $webin_id != "": | |
106 username\t"$webin_id" | |
107 password\t"$password" | |
108 #end if | |
109 ]]></configfile> | |
110 </configfiles> | |
111 <inputs> | |
112 <param name="submit_test" type="boolean" default="False" label="Submit to test server" help="Suggested to test metadata format" /> | |
113 <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."/> | |
114 <param name="genome_fasta" type="data" label="Select the consensus sequence assembly file" format="fasta"/> | |
115 <param name="assembly_type" type="select" label="Assembly type"> | |
116 <option value="clone">Clone</option> | |
117 <option value="isolate">Isolate</option> | |
118 </param> | |
119 <param name="assembly_program" type="text" optional="False" label="Assembly program"/> | |
120 <param name="molecule_type" type="select" label="Molecule type"> | |
121 <option value="genomic RNA" selected="True">genomic RNA</option> | |
122 <option value="viral cRNA">viral cRNA</option> | |
123 <option value="genomic DNA">genomic DNA</option> | |
124 </param> | |
125 <param name="min_gap_length" type="text" optional="True" label="Minimum gap length"/> | |
126 <param name="coverage" type="float" optional="False" value="10000" label="Coverage"/> | |
127 <conditional name="metadata_file_or_form"> | |
128 <param name="metadata_format" type="select" label="Select the method to load study and sample metadata"> | |
129 <option value="file" selected="True">I used Galaxy ENA upload tool for raw data submission, parse my submission receipt</option> | |
130 <option value="form">Fill in required metadata for linking</option> | |
131 </param> | |
132 <when value="file"> | |
133 <param type="data" format="txt" name="ena_receipt" label="Submission receipt obtained from ENA upload tool"/> | |
134 </when> | |
135 <when value="form"> | |
136 <param name="assembly_name" type="text" optional="False" label="Assembly name"/> | |
137 <param name="study_accession" type="text" optional="False" label="Study accession or unique name (alias)"/> | |
138 <param name="sample_accession" type="text" optional="False" label="Sample accession or unique name (alias)"/> | |
139 <param name="sequencing_platform" type="text" optional="False" label="Sequencing platform"/> | |
140 <param name="description" type="text" optional="True" value="" label="Description" help="Free text description of the genome assembly (optional)"/> | |
141 <param name="center_name" type="text" optional="False" label="Center name"/> | |
142 </when> | |
143 </conditional> | |
144 </inputs> | |
145 <outputs> | |
146 <collection name="generated_manifests" type="list" label="Generated manifests"> | |
147 <!--<discover_datasets pattern="__name_and_ext__" directory="manifests" />--> | |
148 <discover_datasets pattern="(?P<designation>.+)\.manifest\.txt$" ext="txt" directory="manifests" /> | |
149 </collection> | |
150 <collection name="manifests_reports" type="list" label="Manifests reports"> | |
151 <!--[><discover_datasets pattern="__name_and_ext__" directory="manifests" /><]--> | |
152 <discover_datasets pattern="(?P<designation>.+)\.manifest\.txt\.report$" ext="txt" directory="manifests" /> | |
153 </collection> | |
154 <data name="webin_cli_report" label="ENA submission receipt" format="txt" from_work_dir="manifests/webin-cli.report"/> | |
155 </outputs> | |
156 <help><![CDATA[ | |
157 TODO: Fill in help. | |
158 ]]></help> | |
159 </tool> |