Skip to content

Commit

Permalink
Convert protonated DC/C residue to valid DNR/CH, respectively (NEFTra…
Browse files Browse the repository at this point in the history
…nslator v3.6.3 relating DAOTHER-9198)
  • Loading branch information
yokochi47 committed Jul 1, 2024
1 parent d3c7de7 commit 0c6aa6b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
5 changes: 4 additions & 1 deletion wwpdb/utils/nmr/BMRBChemShiftStat.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ def loadStatFromCsvFile(self, file_name, primary_th, secondary_th=None, comp_id_
_atom_id = 'MG2'

elif _atom_id.endswith('"'):
_atom_id = _atom_id[:-1] + "'"
_atom_id = _atom_id[:-1] + "''"

# methyl proton group
if _atom_id.startswith('M'):
Expand Down Expand Up @@ -1712,6 +1712,9 @@ def checkAtomNomenclature(self, atom_id, comp_id=None, verbose=False):
if comp_id == 'DC' and atom_id == 'H3': # DAOTHER-9198
return True, 'DNR', 'HN3'

if comp_id == 'C' and atom_id == 'H3': # DAOTHER-9198 (RNA linking)
return True, 'CH', 'HN3'

if verbose:
self.__lfh.write(f"+BMRBChemShiftStat.checkAtomNomenclature() ++ Warning - {comp_id}:{atom_id} did not match with any atom in CCD, {_ref_atom_ids}\n")

Expand Down
36 changes: 35 additions & 1 deletion wwpdb/utils/nmr/NEFTranslator/NEFTranslator.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
# 11-Jun-2024 M. Yokochi - add support for ligand remapping in annotation process (v3.6.0, DAOTHER-9286)
# 28-Jun-2024 M. Yokochi - do not evaluate value in case of ValueError exception (v3.6.1, DAOTHER-9520)
# 28-Jun-2024 M. Yokochi - throw error for key items with empty value (v3.6.2, DAOTHER-9520, 2nd case)
# 01-Jul-2024 M. Yokochi - convert protonated DC/C to DNR/CH (v3.6.3)
##
""" Bi-directional translator between NEF and NMR-STAR
@author: Kumaran Baskaran, Masashi Yokochi
Expand Down Expand Up @@ -148,7 +149,7 @@


__package_name__ = 'wwpdb.utils.nmr'
__version__ = '3.6.2'
__version__ = '3.6.3'

__pynmrstar_v3_3_1__ = version.parse(pynmrstar.__version__) >= version.parse("3.3.1")
__pynmrstar_v3_2__ = version.parse(pynmrstar.__version__) >= version.parse("3.2.0")
Expand Down Expand Up @@ -1523,6 +1524,39 @@ def skip_empty_value_error(lp, idx):
alt_chain_id_set.add(row)
has_auth_asym_id = len(alt_chain_id_set) > 0

# convert protonated DC -> DNR, protonated C -> CH
if 'Atom_ID' in loop.tags and 'Auth_comp_ID' not in loop.tags\
and set(tags) & set(loop.tags) == set(tags):
pre_tag = copy.deepcopy(tags)
pre_tag.append('Atom_ID')
pre_seq_data = get_lp_tag(loop, pre_tag)
has_dc_h3 = has_c_h3 = False
dnr_set = set()
ch_set = set()
for row in pre_seq_data:
if row[1] == 'DC' and row[4] in ('H3', 'H3+'):
has_dc_h3 = True
seq_key = (row[0], row[3])
dnr_set.add(seq_key)
if row[1] == 'C' and row[4] in ('H3', 'H3+'):
has_c_h3 = True
seq_key = (row[0], row[3])
ch_set.add(seq_key)
if has_dc_h3:
comp_id_col = loop.tags.index('Comp_ID')
for idx, row in enumerate(pre_seq_data):
if row[1] == 'DC':
seq_key = (row[0], row[3])
if seq_key in dnr_set:
loop.data[idx][comp_id_col] = 'DNR'
if has_c_h3:
comp_id_col = loop.tags.index('Comp_ID')
for idx, row in enumerate(pre_seq_data):
if row[1] == 'C':
seq_key = (row[0], row[3])
if seq_key in ch_set:
loop.data[idx][comp_id_col] = 'CH'

if lp_category == '_Atom_chem_shift' and self.__remediation_mode and has_auth_asym_id\
and set(tags) & set(loop.tags) == set(tags) and set(tags__) & set(loop.tags) == set(tags__):
factor = max(len(alt_chain_id_set), 2) # 2lnh
Expand Down

0 comments on commit 0c6aa6b

Please sign in to comment.