Skip to content

Commit 061c965

Browse files
authored
minor fixes from latests ENA and SPP changes (#3472)
1 parent bc90600 commit 061c965

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,6 @@ notebooks/*/*.tsv.gz
7575

7676
# jupyter notebooks input data
7777
notebooks/resource-allocation/data
78+
79+
# ignore plugin SQL injection file
80+
qiita_db/support_files/patches/test_db_sql/91.sql

qiita_pet/handlers/study_handlers/prep_template.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,22 @@ def get(self):
7777
res['alert_message'] = url_escape(res['alert_message'])
7878
res['user_level'] = current_user.level
7979
if res['creation_job'] is not None:
80-
fp = res['creation_job'].parameters.values['sample_sheet']
81-
res['creation_job_filename'] = fp['filename']
82-
res['creation_job_filename_body'] = fp['body']
80+
params = res['creation_job'].parameters.values
8381
summary = None
84-
if res['creation_job'].status == 'success':
85-
if res['creation_job'].outputs:
86-
# [0] is the id, [1] is the filepath
87-
_file = res['creation_job'].outputs[
88-
'output'].html_summary_fp[1]
89-
summary = relpath(_file, qiita_config.base_data_dir)
82+
if 'sample_sheet' in params:
83+
fp = params['sample_sheet']
84+
res['creation_job_filename'] = fp['filename']
85+
res['creation_job_filename_body'] = fp['body']
86+
if res['creation_job'].status == 'success':
87+
if res['creation_job'].outputs:
88+
# [0] is the id, [1] is the filepath
89+
_file = res['creation_job'].outputs[
90+
'output'].html_summary_fp[1]
91+
summary = relpath(_file, qiita_config.base_data_dir)
92+
else:
93+
res['creation_job_filename'] = None
94+
res['creation_job_filename_body'] = None
9095
res['creation_job_artifact_summary'] = summary
91-
# res['']
9296
res['human_reads_filter_method'] = None
9397
a = PrepTemplate(prep_id).artifact
9498
if a is not None:

qiita_ware/ebi.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
from qiita_db.processing_job import _system_call as system_call
3434

3535

36+
ENA_COLS_TO_FIX = {
37+
'country': 'geographic location (country and/or sea)',
38+
'collection_date': 'collection date'
39+
}
40+
41+
3642
def clean_whitespace(text):
3743
"""Standardizes whitespaces so there is only one space separating tokens
3844
@@ -407,9 +413,9 @@ def generate_sample_xml(self, samples=None, ignore_columns=None):
407413

408414
for sample_name in sorted(samples):
409415
sample_info = dict(self.samples[sample_name])
410-
if 'country' in sample_info.keys():
411-
nname = 'geographic location (country and/or sea)'
412-
sample_info[nname] = sample_info['country']
416+
for qname, ename in ENA_COLS_TO_FIX.items():
417+
if qname in sample_info.keys():
418+
sample_info[ename] = sample_info[qname]
413419

414420
sample_accession = self._ebi_sample_accessions[sample_name]
415421
if self.action in ('ADD', 'VALIDATE'):

0 commit comments

Comments
 (0)