From fee9f60a0eda52fd3a9db755396d9d5df36f0583 Mon Sep 17 00:00:00 2001 From: yokochi47 Date: Fri, 19 Apr 2024 19:07:37 +0900 Subject: [PATCH] DAOTHER-9317: Fix IndexError exception of the previsou commits --- wwpdb/utils/nmr/BMRBChemShiftStat.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wwpdb/utils/nmr/BMRBChemShiftStat.py b/wwpdb/utils/nmr/BMRBChemShiftStat.py index dd9209954..a016677c2 100644 --- a/wwpdb/utils/nmr/BMRBChemShiftStat.py +++ b/wwpdb/utils/nmr/BMRBChemShiftStat.py @@ -928,7 +928,8 @@ def loadStatFromCsvFile(self, file_name, primary_th, secondary_th=None, comp_id_ # DAOTHER-9317: representative methyl group elif any(rep_methyl_proton.startswith(_atom_id) for rep_methyl_proton in rep_methyl_protons - if rep_methyl_proton != _atom_id and 0 <= len(rep_methyl_proton) - len(_atom_id) <= 1 and _atom_id not in non_rep_methyl_protons): + if rep_methyl_proton != _atom_id and 0 <= len(rep_methyl_proton) - len(_atom_id) <= 1 + and _atom_id not in non_rep_methyl_protons): rep_methyl_proton = next(rep_methyl_proton for rep_methyl_proton in rep_methyl_protons if rep_methyl_proton.startswith(_atom_id)) @@ -1030,7 +1031,8 @@ def loadStatFromCsvFile(self, file_name, primary_th, secondary_th=None, comp_id_ # DAOTHER-9317: general methylene/amino group elif any(rep_methylene_proton.startswith(_atom_id) for rep_methylene_proton in rep_methylene_protons - if rep_methylene_proton != _atom_id and 0 <= len(rep_methylene_proton) - len(_atom_id) <= 1 and _atom_id not in non_rep_methylene_protons): + if rep_methylene_proton != _atom_id and 0 <= len(rep_methylene_proton) - len(_atom_id) <= 1 + and _atom_id not in non_rep_methylene_protons): rep_methylene_proton = next(rep_methylene_proton for rep_methylene_proton in rep_methylene_protons if rep_methylene_proton.startswith(_atom_id)) @@ -2005,6 +2007,8 @@ def getAtomLikeNameSet(self, excl_minor_atom=False, primary=False, minimum_len=1 ambig_code = self.getMaxAmbigCodeWoSetId(comp_id, name) if name in methyl_list: + if len(name) < 3: + continue _name = name[:-1] if _name[0] == 'H': name_set.add('M' + _name[1:]) @@ -2021,6 +2025,8 @@ def getAtomLikeNameSet(self, excl_minor_atom=False, primary=False, minimum_len=1 elif ambig_code >= 2: geminal_name = self.getGeminalAtom(comp_id, name) if geminal_name is not None: + if len(name) < 3: + continue _name = name[:-1] if _name[0] == 'H': name_set.add('Q' + _name[1:])