This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ena_upload.xml
214 lines (207 loc) · 12.4 KB
/
ena_upload.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<tool id="ena_upload" name="ENA Upload tool" version="0.2" python_template_version="3.5">
<macros>
<token name="@VERSION@">0.2.2</token>
<import>samples_macros.xml</import>
</macros>
<requirements>
<requirement type="package" version="@VERSION@">ena-upload-cli</requirement>
<requirement type="package" version="1.2.0">xlrd</requirement>
</requirements>
<command detect_errors="exit_code"><![CDATA[
cwd=\$(pwd);
#set webin_id = os.environ.get('WEBIN_ID', None)
#set webin_secret = os.environ.get('WEBIN_SECRET', None)
#set working_dir = os.getcwd()
#set $dry_run_option = "False"
#set viral_submission = "False"
#if $action_options.input_format_conditional.input_format == "build_tables":
python $__tool_directory__/extract_tables.py --out_dir \$cwd --studies $studies_json;
#set $studies_table_path = "$cwd/studies.tsv"
#set $samples_table_path = "$cwd/samples.tsv"
#set $experiments_table_path = "$cwd/experiments.tsv"
#set $runs_table_path = "$cwd/runs.tsv"
#end if
#if $action_options.input_format_conditional.input_format == "excel_tables":
python $__tool_directory__/process_xlsx.py
#if $action_options.input_format_conditional.viral_submission == "true":
--vir
#end if
--form $action_options.input_format_conditional.xlsx_file --out_dir . ;
#set $studies_table_path = "$cwd/studies.tsv"
#set $samples_table_path = "$cwd/samples.tsv"
#set $experiments_table_path = "$cwd/experiments.tsv"
#set $runs_table_path = "$cwd/runs.tsv"
#if $action_options.input_format_conditional.dry_run == "true":
#set $dry_run_option = "True"
#end if
#end if
#if $action_options.input_format_conditional.input_format != "user_generated_tables":
cp $studies_table_path $studies_table_out;
cp $samples_table_path $samples_table_out;
cp $experiments_table_path $experiments_table_out;
cp $runs_table_path $runs_table_out;
#if $action_options.input_format_conditional.dry_run == "true":
#set $dry_run_option = "True"
#end if
#end if
## create the list of files to upload and make the symlinks
#set $files_to_upload = list()
#if $action_options.input_format_conditional.input_format == "build_tables":
#for $study in $action_options.input_format_conditional.conditional_viral_metadata.rep_study:
#for $sample in $study.rep_sample:
#for $experiment in $sample.rep_experiment:
#for $run in $experiment.rep_runs:
#for $file in $run.upload_files:
ln -s $file $file.element_identifier;
$files_to_upload.append(str($file.element_identifier))
#end for
#end for
#end for
#end for
#end for
#else:
#for $file in $action_options.input_format_conditional.data:
ln -s $file $file.element_identifier;
$files_to_upload.append(str($file.element_identifier))
#end for
#end if
#if $dry_run_option == "False":
ena-upload-cli
--tool 'ena-upload-cli v@VERSION@ @ Galaxy'
--action 'add'
--center '$action_options.center'
--webin_id '$webin_id'
--secret '$webin_secret'
--data
#for $dataset in $files_to_upload:
$dataset
#end for
#if $action_options.input_format_conditional.input_format == "user_generated_tables":
--experiment $action_options.input_format_conditional.experiments_users_table
--study $action_options.input_format_conditional.studies_users_table
--run $action_options.input_format_conditional.runs_users_table
--sample $action_options.input_format_conditional.samples_users_table
#if $action_options.input_format_conditional.viral_submission == "true":
--vir
#end if
#else:
--experiment $experiments_table_path
--study $studies_table_path
--run $runs_table_path
--sample $samples_table_path
#if $action_options.input_format_conditional.input_format == "build_tables":
#if $action_options.input_format_conditional.conditional_viral_metadata.viral_sample == "true":
--vir
#end if
#else:
#if $action_options.input_format_conditional.viral_submission == "true":
--vir
#end if
#end if
#end if
#if $action_options.submit_dev == "true":
-d
#end if
> $output
#end if
]]></command>
<configfiles>
<configfile name="studies_json">
#import json
#if $action_options.input_format_conditional.input_format == "build_tables":
#set $files_to_upload = list()
#set $studies = list()
#for $study in $action_options.input_format_conditional.conditional_viral_metadata.rep_study:
#set samples = list()
#for $sample in $study.rep_sample:
#set experiments = list()
#for $experiment in $sample.rep_experiment:
#set runs = list()
#for $run in $experiment.rep_runs:
#set run_files = list()
#for $file in $run.upload_files:
$run_files.append(str($file.element_identifier))
#end for
$runs.append($run_files)
#end for
$experiments.append({'title':str($experiment.experiment_title),'experiment_design':str($experiment.experiment_design),'library_strategy':str($experiment.library_strategy),'library_source':str($experiment.library_source),'library_selection':str($experiment.library_selection),'library_layout':str($experiment.library_layout),'insert_size':str($experiment.insert_size),'library_construction_protocol':str($experiment.library_construction_protocol),'platform':str($experiment.platform),'instrument_model':str($experiment.instrument_model),'runs':$runs})
#end for
#if $action_options.input_format_conditional.conditional_viral_metadata.viral_sample == "true":
$samples.append({'title':str($sample.sample_title),'description':str($sample.sample_description),'tax_name':str($sample.scientific_name),'tax_id':str($sample.tax_id),'collection_date':str($sample.collection_date),'geo_location':str($sample.geo_location_country),'host_common_name':str($sample.host_common_name),'host_subject_id':str($sample.host_subject_id),'host_health_state':str($sample.host_health_state),'host_sex':str($sample.host_sex),'host_scientific_name':str($sample.host_scientific_name),'collector_name':str($sample.collector_name),'collecting_institution':str($sample.collecting_institution),'isolate':str($sample.isolate),'experiments':$experiments})
#else:
$samples.append({'title':str($sample.sample_title),'description':str($sample.sample_description),'tax_name':str($sample.scientific_name),'tax_id':str($sample.tax_id),'experiments':$experiments})
#end if
#end for
$studies.append({'title':str($study.study_title),'type':str($study.study_type),'abstract':str($study.study_abstract),'pubmed_id':str($study.study_pubmed_id),'samples':$samples})
#end for
#echo $json.dumps($studies)
#end if
</configfile>
</configfiles>
<inputs>
<conditional name="action_options">
<param name="action" type="select" label="Action to execute">
<option value="add" selected="True">Add new data</option>
<option value="modify">Modify metadata</option>
</param>
<when value="add">
<param name="submit_dev" type="boolean" label="Submit to test ENA server?" help="By selecting yes the reads will be submitted " />
<conditional name="input_format_conditional">
<param name="input_format" type="select" label="Would you like to submit pregenerated table files or interactively define the input structures?">
<option value="user_generated_tables" selected="False">User generated tables of studies/experiments/runs/samples</option>
<option value="excel_tables" selected="False">User generated metadata tables based on Excel templates</option>
<option value="build_tables" selected="True">Interactive generation of studies structure from dataset</option>
</param>
<when value="excel_tables">
<param name="viral_submission" type="boolean" label="Does your submission data belong to a viral sample?" help="If you select yes then your data will be submitted using the ENA virus pathogen reporting standard checklist (see: https://ena-browser-docs.readthedocs.io/en/latest/help_and_guides/sars-cov-2-submissions.html)" />
<param name="dry_run" type="boolean" label="Print the tables but do not submit the datasets" help="If yes is selected then NO submission will be performed."/>
<param name="xlsx_file" type="data" format="xlsx" label="File based on templates here:"/>
<param name="data" type="data" format="fastqsanger.gz,fastqsanger.bz2,fastq.gz,fastq.bz2" multiple="true" label="Select all datasets to upload" help="Compressed reads files listed in the runs table"/>
</when>
<when value="user_generated_tables">
<param name="viral_submission" type="boolean" label="Does your submission data belong to a viral sample?" help="If you select yes then your data will be submitted using the ENA virus pathogen reporting standard checklist (see: https://ena-browser-docs.readthedocs.io/en/latest/help_and_guides/sars-cov-2-submissions.html)" />
<param name="data" type="data" format="fastqsanger.gz,fastqsanger.bz2,fastq.gz,fastq.bz2" multiple="true" label="Select all datasets to upload" help="Compressed reads files listed in the runs table"/>
<param name="studies_users_table" type="data" format="tabular" multiple="false" label="Studies table" help="Studies metadata file"/>
<param name="samples_users_table" type="data" format="tabular" multiple="false" label="Samples table" help="Samples metadata file"/>
<param name="experiments_users_table" type="data" format="tabular" multiple="false" label="Experiments table" help="Experiments metadata file"/>
<param name="runs_users_table" type="data" format="tabular" multiple="false" label="Runs table" help="Runs metadata file"/>
</when>
<when value="build_tables">
<param name="dry_run" type="boolean" label="Print the tables but do not submit the datasets" help="If yes is selected then NO submission will be performed."/>
<conditional name="conditional_viral_metadata">
<param name="viral_sample" type="boolean" label="Does your submission contains viral samples?" />
<when value="true">
<expand macro="viral_samples" />
</when>
<when value="false">
<expand macro="nonviral_samples" />
</when>
</conditional>
</when>
</conditional>
<param name="center" type="text" optional="False" label="Affiliation center"/>
</when>
<when value="modify">
<param name="modify_first" type="text" label="Mofification of submitted data is not yet possible"/>
</when>
</conditional>
</inputs>
<outputs>
<data name="output" format="data" label="${tool.name} on ${on_string}: Upload summary"/>
<data name="studies_table_out" format="tabular" label="Studies table">
<filter> action_options['input_format_conditional']['input_format'] == "build_tables" or action_options['input_format_conditional']['input_format'] == "excel_tables"</filter>
</data>
<data name="samples_table_out" format="tabular" label="Samples table">
<filter> action_options['input_format_conditional']['input_format'] == "build_tables" or action_options['input_format_conditional']['input_format'] == "excel_tables"</filter>
</data>
<data name="experiments_table_out" format="tabular" label="Experiments table">
<filter> action_options['input_format_conditional']['input_format'] == "build_tables" or action_options['input_format_conditional']['input_format'] == "excel_tables"</filter>
</data>
<data name="runs_table_out" format="tabular" label="Runs table">
<filter> action_options['input_format_conditional']['input_format'] == "build_tables" or action_options['input_format_conditional']['input_format'] == "excel_tables"</filter>
</data>
</outputs>
<help><![CDATA[
TODO: Fill in help.
]]></help>
</tool>