From 9ee892025ff4b816e6c5f6811e1a71eda5e9879f Mon Sep 17 00:00:00 2001 From: yokochi47 Date: Wed, 22 Jan 2025 14:25:46 +0900 Subject: [PATCH] DAOTHER-8905: Remediate _NMR_spectrometer_view.Name --- wwpdb/utils/nmr/ann/BMRBAnnTasks.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/wwpdb/utils/nmr/ann/BMRBAnnTasks.py b/wwpdb/utils/nmr/ann/BMRBAnnTasks.py index 873b294d..430dd8ed 100644 --- a/wwpdb/utils/nmr/ann/BMRBAnnTasks.py +++ b/wwpdb/utils/nmr/ann/BMRBAnnTasks.py @@ -2699,6 +2699,9 @@ def is_natural_abundance(isotopic_labeling: str): if get_first_sf_tag(sf, 'Name') in emptyValue: has_eff_sf_tag = False + if len(get_first_sf_tag(sf, 'Sf_framecode')) == 0: + has_eff_sf_tag = False + entry_info_sf = sf.category == 'entry_information' list_id_tag = alt_list_id_tag = None @@ -2742,8 +2745,28 @@ def is_natural_abundance(isotopic_labeling: str): if 'Name' in lp.tags: if row[lp.tags.index('Name')] in emptyValue: - empty_row_idx.append(idx) - continue + if lp.category != '_NMR_spectrometer_view': + empty_row_idx.append(idx) + continue + + try: + vendor = row[lp.tags.index('Manufacturer')] + model = row[lp.tags.index('Model')] + field = row[lp.tags.index('Field_strength')] + if vendor in emptyValue\ + or model in emptyValue\ + or field in emptyValue: + empty_row_idx.append(idx) + continue + except ValueError: + empty_row_idx.append(idx) + continue + + for parent_sf in master_entry.get_saveframes_by_tag_and_value('_NMR_spectrometer.Manufacturer', vendor): + if get_first_sf_tag(parent_sf, 'Model') == model\ + and get_first_sf_tag(parent_sf, 'Field_strength', field) == field: + row[lp.tags.index('Name')] = get_first_sf_tag(parent_sf, 'Sf_framecode') + break if lp.category == '_Assembly_db_link': if 'Accession_code' in lp.tags and row[lp.tags.index('Accession_code')] in emptyValue: