@@ -159,7 +159,7 @@ def construct_xml(schema, stream, xsd):
159
159
return xml_file
160
160
161
161
162
- def actors (template_path ):
162
+ def actors (template_path , vir ):
163
163
''':return: the filenames of schema definitions and templates
164
164
'''
165
165
@@ -173,19 +173,25 @@ def add_path(dic, path):
173
173
'submission' : 'SRA.submission.xsd' ,
174
174
'sample' : 'SRA.sample.xsd' ,
175
175
'study' : 'SRA.study.xsd' }
176
-
177
- templates = {'run' : 'ENA_template_runs.xml' ,
178
- 'experiment' : 'ENA_template_experiments.xml' ,
179
- 'submission' : 'ENA_template_submission.xml' ,
180
- 'sample' : 'ENA_template_samples.xml' ,
181
- 'study' : 'ENA_template_studies.xml' }
176
+ if vir :
177
+ templates = {'run' : 'ENA_template_runs.xml' ,
178
+ 'experiment' : 'ENA_template_experiments.xml' ,
179
+ 'submission' : 'ENA_template_submission.xml' ,
180
+ 'sample' : 'ENA_template_vir_sample.xml' ,
181
+ 'study' : 'ENA_template_studies.xml' }
182
+ else :
183
+ templates = {'run' : 'ENA_template_runs.xml' ,
184
+ 'experiment' : 'ENA_template_experiments.xml' ,
185
+ 'submission' : 'ENA_template_submission.xml' ,
186
+ 'sample' : 'ENA_template_samples.xml' ,
187
+ 'study' : 'ENA_template_studies.xml' }
182
188
183
189
xsds = add_path (xsds , template_path )
184
190
185
191
return xsds , templates
186
192
187
193
188
- def run_construct (template_path , schema_targets , center ):
194
+ def run_construct (template_path , schema_targets , center , vir ):
189
195
'''construct XMLs for schema in schema_targets
190
196
191
197
:param schema_targets: dictionary of 'schema:targets' generated
@@ -196,7 +202,7 @@ def run_construct(template_path, schema_targets, center):
196
202
:return schema_xmls: dictionary of 'schema:filename'
197
203
'''
198
204
199
- xsds , templates = actors (template_path )
205
+ xsds , templates = actors (template_path , vir )
200
206
201
207
schema_xmls = {}
202
208
@@ -211,7 +217,7 @@ def run_construct(template_path, schema_targets, center):
211
217
return schema_xmls
212
218
213
219
214
- def construct_submission (template_path , action , submission_input , center ):
220
+ def construct_submission (template_path , action , submission_input , center , vir ):
215
221
'''construct XML for submission
216
222
217
223
:param action: action for submission -
@@ -224,7 +230,7 @@ def construct_submission(template_path, action, submission_input, center):
224
230
:return submission_xml: filename of submission XML
225
231
'''
226
232
227
- xsds , templates = actors (template_path )
233
+ xsds , templates = actors (template_path , vir )
228
234
229
235
template = templates ['submission' ]
230
236
loader = TemplateLoader (search_path = template_path )
@@ -569,6 +575,8 @@ def process_args():
569
575
help = '.secret file containing the password of your Webin account' )
570
576
571
577
parser .add_argument ('-d' , '--dev' , help = "Flag to use the dev/sandbox endpoint of ENA." , action = "store_true" )
578
+
579
+ parser .add_argument ('--vir' , help = "Flag to use the viral sample template." , action = "store_true" )
572
580
573
581
args = parser .parse_args ()
574
582
@@ -621,6 +629,7 @@ def main ():
621
629
action = args .action .upper ()
622
630
center = args .center_name
623
631
dev = args .dev
632
+ vir = args .vir
624
633
webin_id = args .webin_id
625
634
password = ""
626
635
@@ -695,18 +704,18 @@ def main ():
695
704
# when ADD/MODIFY,
696
705
# requires source XMLs for 'run', 'experiment', 'sample', 'experiment'
697
706
# schema_xmls record XMLs for all these schema and following 'submission'
698
- schema_xmls = run_construct (template_path , schema_targets , center )
707
+ schema_xmls = run_construct (template_path , schema_targets , center , vir )
699
708
700
709
submission_xml = construct_submission (template_path , action ,
701
- schema_xmls , center )
710
+ schema_xmls , center , vir )
702
711
703
712
elif action in ['CANCEL' , 'RELEASE' ]:
704
713
# when CANCEL/RELEASE, only accessions needed
705
714
# schema_xmls only used to record the following 'submission'
706
715
schema_xmls = {}
707
716
708
717
submission_xml = construct_submission (template_path , action ,
709
- schema_targets , center )
718
+ schema_targets , center , vir )
710
719
711
720
schema_xmls ['submission' ] = submission_xml
712
721
0 commit comments