Skip to content

Commit

Permalink
Fix atom name conversion (DT|T):H5(#|%|*) should be mapped to H71/H72…
Browse files Browse the repository at this point in the history
…/H73, THM:H7(#|%|*) should be mapped to HM51/HM52/HM53 (8ht7)
  • Loading branch information
yokochi47 committed Nov 29, 2024
1 parent c10eba7 commit fffac99
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions wwpdb/utils/nmr/NEFTranslator/NEFTranslator.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@
from wwpdb.utils.nmr.CifToNmrStar import CifToNmrStar
from wwpdb.utils.nmr.mr.ParserListenerUtil import (ISOTOPE_NUMBERS_OF_NMR_OBS_NUCS,
ALLOWED_AMBIGUITY_CODES,
translateToStdResName)
translateToStdResName,
translateToStdAtomName)
except ImportError:
from nmr.AlignUtil import (LEN_LARGE_ASYM_ID, LOW_SEQ_COVERAGE,
emptyValue, trueValue, monDict3,
Expand All @@ -152,7 +153,8 @@
from nmr.CifToNmrStar import CifToNmrStar
from nmr.mr.ParserListenerUtil import (ISOTOPE_NUMBERS_OF_NMR_OBS_NUCS,
ALLOWED_AMBIGUITY_CODES,
translateToStdResName)
translateToStdResName,
translateToStdAtomName)


__package_name__ = 'wwpdb.utils.nmr'
Expand Down Expand Up @@ -6683,7 +6685,7 @@ def get_valid_star_atom_for_ligand_remap(self, comp_id, atom_id, coord_atom_site

if details is not None and comp_id not in monDict3 and self.__csStat.peptideLike(comp_id) and atom_id[0] in ('H', 'C', 'N', 'O', 'P')\
and len_atom_id > 1 and atom_id[1] in ('A', 'B', 'G', 'D', 'E', 'Z', 'H')\
and (atom_id[0] != 'H' or (atom_id[0] == 'H' and atom_id[-1] not in ('%', '#'))):
and (atom_id[0] != 'H' or (atom_id[0] == 'H' and atom_id[-1] not in ('%', '*'))):
grk_atoms = self.__ccU.getAtomsBasedOnGreekLetterSystem(comp_id, atom_id)
if len(grk_atoms) > 0:
atom_list = []
Expand Down Expand Up @@ -7011,6 +7013,10 @@ def get_valid_star_atom_in_xplor(self, comp_id, atom_id, details=None, leave_unm
if '#' in atom_id:
atom_id = atom_id.replace('#', '%')

if atom_id[-1] in ('%', '*') and atom_id[-2] != "'" and self.__csStat.getTypeOfCompId(comp_id)[1]:
atom_id = translateToStdAtomName(atom_id[:-1], refCompId=comp_id, ccU=self.__ccU) + atom_id[-1]
print(atom_id)

if atom_id[0] in ('1', '2', '3'):
atom_list, ambiguity_code, details = self.get_valid_star_atom(comp_id, atom_id, details, leave_unmatched, methyl_only)
if details is None:
Expand Down Expand Up @@ -7349,7 +7355,7 @@ def get_valid_star_atom(self, comp_id, atom_id, details=None, leave_unmatched=Tr

if details is not None and comp_id not in monDict3 and self.__csStat.peptideLike(comp_id) and atom_id[0] in ('H', 'C', 'N', 'O', 'P')\
and len_atom_id > 1 and atom_id[1] in ('A', 'B', 'G', 'D', 'E', 'Z', 'H')\
and (atom_id[0] != 'H' or (atom_id[0] == 'H' and atom_id[-1] not in ('%', '#'))):
and (atom_id[0] != 'H' or (atom_id[0] == 'H' and atom_id[-1] not in ('%', '*'))):
grk_atoms = self.__ccU.getAtomsBasedOnGreekLetterSystem(comp_id, atom_id)
if len(grk_atoms) > 0:
atom_list = []
Expand Down
4 changes: 2 additions & 2 deletions wwpdb/utils/nmr/mr/ParserListenerUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -2183,7 +2183,7 @@ def translateToStdAtomName(atomId, refCompId=None, refAtomIdList=None, ccU=None,
elif refCompId in ('DT', 'T') and atomId.startswith('H5'): # 2lsz
if atomId in ('H51', 'H52', 'H53'):
return 'H7' + atomId[-1]
if atomId in 'H5':
if atomId in ('H5', 'H5%', 'H5#', 'H5*'):
return 'H7'
elif refCompId in ('DT', 'T') and (atomId.startswith('C5') or atomId == 'CM'): # 7dju, 7pdu
return 'C7'
Expand All @@ -2193,7 +2193,7 @@ def translateToStdAtomName(atomId, refCompId=None, refAtomIdList=None, ccU=None,
if atomId.startswith('H7'):
if atomId in ('H71', 'H72', 'H73'):
return 'HM5' + atomId[-1]
if atomId in 'H7':
if atomId in ('H7', 'H7%', 'H7#', 'H7*'):
return 'HM5'
if atomId in ('C7', 'CM'): # 7png, 7pdu
return 'C5M'
Expand Down

0 comments on commit fffac99

Please sign in to comment.