Skip to content

Commit

Permalink
handle omics-level failures and missing metatranascriptome
Browse files Browse the repository at this point in the history
  • Loading branch information
mbthornton-lbl committed Feb 9, 2024
1 parent b7e787e commit aad9d77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion nmdc_automation/re_iding/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,15 @@ def update_metatranscriptome_activity_set(self, db_record: Dict,
Return a new Database instance with the metatranscriptome_activity_set
and its data objects updated to new IDs.
"""
metatranscriptome_records = db_record.get(METATRANSCRIPTOME_ACTIVITY_SET, [])
if not metatranscriptome_records:
logger.info(f"No metatranscriptome_activity_set found for {db_record[OMICS_PROCESSING_SET][0]['id']}")
return new_db
logger.info(f"Updating metatranscriptome_activity_set for "
f"{db_record[OMICS_PROCESSING_SET][0]['id']}")
new_omics_processing = new_db.omics_processing_set[0]

for metatranscriptome_rec in db_record.get(METATRANSCRIPTOME_ACTIVITY_SET, []):
for metatranscriptome_rec in metatranscriptome_records:
# old records have non-conforming type e.g. nmdc:MetaT,
# nmdc:metaT etc. - fix it
activity_type = "nmdc:MetatranscriptomeActivity"
Expand Down
5 changes: 4 additions & 1 deletion nmdc_automation/re_iding/scripts/re_id_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,12 @@ def extract_records(ctx, study_id, api_base_url):
if passing_records:
db.__setattr__(set_name, passing_records)

retrieved_databases.append(db)


if is_failed_data:
retrieved_failed_databases.append(db_failed)
else:
retrieved_databases.append(db)

json_data = json.loads(json_dumper.dumps(retrieved_databases, inject_type=False))
db_outfile = DATA_DIR.joinpath(f"{study_id}_associated_record_dump.json")
Expand Down

0 comments on commit aad9d77

Please sign in to comment.