0
|
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;
|
1
|
43 #if $min_gap_length:
|
|
44 echo -e "MINGAPLENGTH\t$min_gap_length" >> $manifest_base;
|
|
45 #end if
|
0
|
46 echo -e "MOLECULETYPE\t$molecule_type" >> $manifest_base;
|
|
47
|
|
48 #if $metadata_file_or_form.metadata_format == "file":
|
|
49 ## process the input tables, this creates an intermediate file with information
|
|
50 python3 '$__tool_directory__/process_input.py' $metadata_file_or_form.ena_receipt $genome_fasta './manifests' './fasta' $manifest_base;
|
|
51 center_name=`grep 'center_name' $metadata_file_or_form.ena_receipt | cut -f2,2 | tr -d '\n'`;
|
|
52 #else:
|
|
53 #set $generated_manifest='./manifests/generated_manifest.txt'
|
|
54 cp $manifest_base $generated_manifest
|
|
55 $study_id = $metadata_file_or_form.study_accession
|
|
56 $sample_id = $metadata_file_or_form.sample_accession
|
|
57 echo "STUDY\t$study_id" > $generated_manifest;
|
|
58 echo "SAMPLE\t$sample_id" >> $generated_manifest;
|
|
59 center_name=$metadata_file_or_form.center_name;
|
|
60 echo "ASSEMBLY_NAME\t$metadata_file_or_form.assembly_name" >> $generated_manifest;
|
|
61 echo "PLATFORM\t$platform_name" >> $generated_manifest;
|
|
62 #end if
|
|
63
|
|
64
|
|
65 #if $metadata_file_or_form.metadata_format == "file":
|
|
66 ## iterate over the list of manifest - fasta generated by the process_input
|
|
67 ## in case of errors, this list is empty
|
|
68 while read line; do
|
|
69 manifest=`echo \$line | cut -d' ' -f1,1`;
|
|
70 ena-webin-cli
|
|
71 -context genome
|
|
72 -userName \$webin_id
|
|
73 -password \$password
|
|
74 -centerName \$center_name
|
|
75 -manifest \$manifest
|
|
76 -inputDir "./fasta"
|
|
77 #if $dry_run == "true":
|
|
78 -validate
|
|
79 #end if
|
|
80 ;
|
|
81 done < submit_list.tab
|
|
82
|
|
83 #else:
|
|
84 gzip -c $genome_fasta > consensus.fasta.gz;
|
|
85 echo -e "FASTA\tconsensus.fasta.gz" >> $generated_manifest;
|
|
86 ena-webin-cli
|
|
87 -context genome
|
|
88 -userName \$webin_id
|
|
89 -password \$password
|
|
90 -centerName '\$center_name'
|
|
91 -manifest $generated_manifest
|
|
92 -inputDir "./"
|
|
93 #if $submit_test == "true":
|
|
94 -test
|
|
95 #end if
|
|
96 #if $dry_run == "true":
|
|
97 -validate
|
|
98 #else:
|
|
99 -submit
|
|
100 #end if
|
|
101 #end if
|
|
102 ]]></command>
|
|
103 <configfiles>
|
|
104 <configfile name="credentials"><![CDATA[
|
|
105 #set $webin_id = $__user__.extra_preferences.get('ena_webin_account|webin_id', "").strip()
|
|
106 #set $password = $__user__.extra_preferences.get('ena_webin_account|password', "").strip()
|
|
107 #if $webin_id != "":
|
|
108 username\t"$webin_id"
|
|
109 password\t"$password"
|
|
110 #end if
|
|
111 ]]></configfile>
|
|
112 </configfiles>
|
|
113 <inputs>
|
|
114 <param name="submit_test" type="boolean" default="False" label="Submit to test server" help="Suggested to test metadata format" />
|
|
115 <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."/>
|
|
116 <param name="genome_fasta" type="data" label="Select the consensus sequence assembly file" format="fasta"/>
|
|
117 <param name="assembly_type" type="select" label="Assembly type">
|
|
118 <option value="clone">Clone</option>
|
|
119 <option value="isolate">Isolate</option>
|
|
120 </param>
|
|
121 <param name="assembly_program" type="text" optional="False" label="Assembly program"/>
|
|
122 <param name="molecule_type" type="select" label="Molecule type">
|
|
123 <option value="genomic RNA" selected="True">genomic RNA</option>
|
|
124 <option value="viral cRNA">viral cRNA</option>
|
|
125 <option value="genomic DNA">genomic DNA</option>
|
|
126 </param>
|
|
127 <param name="coverage" type="float" optional="False" value="10000" label="Coverage"/>
|
|
128 <conditional name="metadata_file_or_form">
|
|
129 <param name="metadata_format" type="select" label="Select the method to load study and sample metadata">
|
|
130 <option value="file" selected="True">I used Galaxy ENA upload tool for raw data submission, parse my submission receipt</option>
|
|
131 <option value="form">Fill in required metadata for linking</option>
|
|
132 </param>
|
|
133 <when value="file">
|
|
134 <param type="data" format="txt" name="ena_receipt" label="Submission receipt obtained from ENA upload tool"/>
|
|
135 </when>
|
|
136 <when value="form">
|
|
137 <param name="assembly_name" type="text" optional="False" label="Assembly name"/>
|
|
138 <param name="study_accession" type="text" optional="False" label="Study accession or unique name (alias)"/>
|
|
139 <param name="sample_accession" type="text" optional="False" label="Sample accession or unique name (alias)"/>
|
|
140 <param name="sequencing_platform" type="text" optional="False" label="Sequencing platform"/>
|
|
141 <param name="description" type="text" optional="True" value="" label="Description" help="Free text description of the genome assembly (optional)"/>
|
|
142 <param name="center_name" type="text" optional="False" label="Center name"/>
|
|
143 </when>
|
|
144 </conditional>
|
1
|
145 <param name="min_gap_length" type="text" optional="True" label="Minimum gap length (optional)"/>
|
0
|
146 </inputs>
|
|
147 <outputs>
|
|
148 <collection name="generated_manifests" type="list" label="Generated manifests">
|
|
149 <!--<discover_datasets pattern="__name_and_ext__" directory="manifests" />-->
|
|
150 <discover_datasets pattern="(?P<designation>.+)\.manifest\.txt$" ext="txt" directory="manifests" />
|
|
151 </collection>
|
|
152 <collection name="manifests_reports" type="list" label="Manifests reports">
|
|
153 <!--[><discover_datasets pattern="__name_and_ext__" directory="manifests" /><]-->
|
|
154 <discover_datasets pattern="(?P<designation>.+)\.manifest\.txt\.report$" ext="txt" directory="manifests" />
|
|
155 </collection>
|
|
156 <data name="webin_cli_report" label="ENA submission receipt" format="txt" from_work_dir="manifests/webin-cli.report"/>
|
|
157 </outputs>
|
|
158 <help><![CDATA[
|
|
159 TODO: Fill in help.
|
|
160 ]]></help>
|
|
161 </tool>
|