Skip to content

minor fixes from latests ENA and SPP changes #3472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,6 @@ notebooks/*/*.tsv.gz

# jupyter notebooks input data
notebooks/resource-allocation/data

# ignore plugin SQL injection file
qiita_db/support_files/patches/test_db_sql/91.sql
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why shouldn't the patch file go into git? Does it have sensitive info in it or something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question! Patch 91.sql doesn't actually exist, see https://github.com/qiita-spots/qiita/blob/master/CONTRIBUTING.md#patch-91sql. However, this can be used to "inject" SQL for extra plugin testing, like https://github.com/qiita-spots/qp-knight-lab-processing/blob/main/tests/qiita-sql/91.sql. Note that raw/non-testing deployment will never hit this as the patching starts in 92.

24 changes: 14 additions & 10 deletions qiita_pet/handlers/study_handlers/prep_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,22 @@ def get(self):
res['alert_message'] = url_escape(res['alert_message'])
res['user_level'] = current_user.level
if res['creation_job'] is not None:
fp = res['creation_job'].parameters.values['sample_sheet']
res['creation_job_filename'] = fp['filename']
res['creation_job_filename_body'] = fp['body']
params = res['creation_job'].parameters.values
summary = None
if res['creation_job'].status == 'success':
if res['creation_job'].outputs:
# [0] is the id, [1] is the filepath
_file = res['creation_job'].outputs[
'output'].html_summary_fp[1]
summary = relpath(_file, qiita_config.base_data_dir)
if 'sample_sheet' in params:
fp = params['sample_sheet']
res['creation_job_filename'] = fp['filename']
res['creation_job_filename_body'] = fp['body']
if res['creation_job'].status == 'success':
if res['creation_job'].outputs:
# [0] is the id, [1] is the filepath
_file = res['creation_job'].outputs[
'output'].html_summary_fp[1]
summary = relpath(_file, qiita_config.base_data_dir)
else:
res['creation_job_filename'] = None
res['creation_job_filename_body'] = None
res['creation_job_artifact_summary'] = summary
# res['']
res['human_reads_filter_method'] = None
a = PrepTemplate(prep_id).artifact
if a is not None:
Expand Down
12 changes: 9 additions & 3 deletions qiita_ware/ebi.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
from qiita_db.processing_job import _system_call as system_call


ENA_COLS_TO_FIX = {
'country': 'geographic location (country and/or sea)',
'collection_date': 'collection date'
}


def clean_whitespace(text):
"""Standardizes whitespaces so there is only one space separating tokens

Expand Down Expand Up @@ -406,9 +412,9 @@ def generate_sample_xml(self, samples=None, ignore_columns=None):

for sample_name in sorted(samples):
sample_info = dict(self.samples[sample_name])
if 'country' in sample_info.keys():
nname = 'geographic location (country and/or sea)'
sample_info[nname] = sample_info['country']
for qname, ename in ENA_COLS_TO_FIX.items():
if qname in sample_info.keys():
sample_info[ename] = sample_info[qname]

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