Skip to content

Commit

Permalink
DAOTHER-9063: Fix counting of restraints on NMR constraints page to b…
Browse files Browse the repository at this point in the history
…e consistent with validation report
  • Loading branch information
yokochi47 committed Apr 3, 2024
1 parent 1932371 commit decc0ee
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions wwpdb/utils/nmr/NmrDpUtility.py
Original file line number Diff line number Diff line change
Expand Up @@ -52280,7 +52280,7 @@ def __mergeLegacyCsAndMr(self):
Dihedral_angle_tot_num = 0
if content_subtype in self.__mr_sf_dict_holder:
for sf_item in self.__mr_sf_dict_holder[content_subtype]:
Dihedral_angle_tot_num += len(sf_item['loop'])
Dihedral_angle_tot_num += sf_item['id']

if Dihedral_angle_tot_num > 0:
cst_sf.add_tag('Dihedral_angle_tot_num', Dihedral_angle_tot_num)
Expand Down Expand Up @@ -52899,7 +52899,7 @@ def __mergeLegacyCsAndMr(self):
Derived_coupling_const_tot_num = 0
if content_subtype in self.__mr_sf_dict_holder:
for sf_item in self.__mr_sf_dict_holder[content_subtype]:
Derived_coupling_const_tot_num += len(sf_item['loop'])
Derived_coupling_const_tot_num += sf_item['id']

if Derived_coupling_const_tot_num > 0:
cst_sf.add_tag('Derived_coupling_const_tot_num', Derived_coupling_const_tot_num)
Expand All @@ -52909,7 +52909,7 @@ def __mergeLegacyCsAndMr(self):
Derived_CACB_chem_shift_tot_num = 0
if content_subtype in self.__mr_sf_dict_holder:
for sf_item in self.__mr_sf_dict_holder[content_subtype]:
Derived_CACB_chem_shift_tot_num += len(sf_item['loop'])
Derived_CACB_chem_shift_tot_num += sf_item['id']

if Derived_CACB_chem_shift_tot_num > 0:
cst_sf.add_tag('Derived_CACB_chem_shift_tot_num', Derived_CACB_chem_shift_tot_num)
Expand All @@ -52919,7 +52919,7 @@ def __mergeLegacyCsAndMr(self):
Derived_1H_chem_shift_tot_num = 0
if content_subtype in self.__mr_sf_dict_holder:
for sf_item in self.__mr_sf_dict_holder[content_subtype]:
Derived_1H_chem_shift_tot_num += len(sf_item['loop'])
Derived_1H_chem_shift_tot_num += sf_item['id']

if Derived_1H_chem_shift_tot_num > 0:
cst_sf.add_tag('Derived_1H_chem_shift_tot_num', Derived_1H_chem_shift_tot_num)
Expand All @@ -52936,7 +52936,7 @@ def __mergeLegacyCsAndMr(self):
constraint_type = get_first_sf_tag(sf, 'Constraint_type')
if constraint_type != 'photo cidnp':
continue
Derived_photo_cidnps_tot_num += len(sf_item['loop'])
Derived_photo_cidnps_tot_num += sf_item['id']

if Derived_photo_cidnps_tot_num > 0:
cst_sf.add_tag('Derived_photo_cidnps_tot_num', Derived_photo_cidnps_tot_num)
Expand All @@ -52951,7 +52951,7 @@ def __mergeLegacyCsAndMr(self):
constraint_type = get_first_sf_tag(sf, 'Constraint_type')
if constraint_type != 'paramagnetic relaxation':
continue
Derived_paramag_relax_tot_num += len(sf_item['loop'])
Derived_paramag_relax_tot_num += sf_item['id']

if Derived_paramag_relax_tot_num > 0:
cst_sf.add_tag('Derived_paramag_relax_tot_num', Derived_paramag_relax_tot_num)
Expand Down Expand Up @@ -53113,10 +53113,25 @@ def __mergeLegacyCsAndMr(self):
if constraint_subtype is not None and constraint_subtype == 'RDC':
constraint_type = 'residual dipolar coupling'
constraint_subsubtype = sf_item.get('constraint_subsubtype')

id_col = sf_item['loop'].tags.index('ID')

count = 0
prev_id = -1
for _row in sf_item['loop']:
_id = int(_row[id_col])
if _id == prev_id:
continue
prev_id = _id
count += 1

sf_item['id'] = count

row[6], row[7], row[8], row[9] =\
constraint_type, constraint_subtype, constraint_subsubtype, sf_item['id']
row[10], row[11] = 1, self.__entry_id

print(row)
cf_loop.add_data(row)

ext_mr_sf_holder = []
Expand Down Expand Up @@ -54750,7 +54765,6 @@ def __updateConstraintStats(self):
id_col = lp.tags.index('ID')

count = 0

prev_id = -1
for row in lp:
_id = int(row[id_col])
Expand All @@ -54769,7 +54783,7 @@ def __updateConstraintStats(self):
for sf in master_entry.get_saveframes_by_category(sf_category):
sf_framecode = get_first_sf_tag(sf, 'sf_framecode')
if 'constraint_subtype' in sf_item[sf_framecode] and sf_item[sf_framecode]['constraint_subtype'] == 'hydrogen bond':
H_bonds_constrained_tot_num += len(sf_item[sf_framecode]['loop'])
H_bonds_constrained_tot_num += sf_item[sf_framecode]['id']

if H_bonds_constrained_tot_num > 0:
cst_sf.add_tag('H_bonds_constrained_tot_num', H_bonds_constrained_tot_num)
Expand All @@ -54778,7 +54792,7 @@ def __updateConstraintStats(self):
for sf in master_entry.get_saveframes_by_category(sf_category):
sf_framecode = get_first_sf_tag(sf, 'sf_framecode')
if 'constraint_subtype' in sf_item[sf_framecode] and sf_item[sf_framecode]['constraint_subtype'] == 'disulfide bond':
SS_bonds_constrained_tot_num += len(sf_item[sf_framecode]['loop'])
SS_bonds_constrained_tot_num += sf_item[sf_framecode]['id']

if SS_bonds_constrained_tot_num > 0:
cst_sf.add_tag('SS_bonds_constrained_tot_num', SS_bonds_constrained_tot_num)
Expand All @@ -54787,7 +54801,7 @@ def __updateConstraintStats(self):
for sf in master_entry.get_saveframes_by_category(sf_category):
sf_framecode = get_first_sf_tag(sf, 'sf_framecode')
if 'constraint_subtype' in sf_item[sf_framecode] and sf_item[sf_framecode]['constraint_subtype'] == 'photo cidnp':
Derived_photo_cidnps_tot_num += len(sf_item[sf_framecode]['loop'])
Derived_photo_cidnps_tot_num += sf_item[sf_framecode]['id']

if Derived_photo_cidnps_tot_num > 0:
cst_sf.add_tag('Derived_photo_cidnps_tot_num', Derived_photo_cidnps_tot_num)
Expand All @@ -54796,7 +54810,7 @@ def __updateConstraintStats(self):
for sf in master_entry.get_saveframes_by_category(sf_category):
sf_framecode = get_first_sf_tag(sf, 'sf_framecode')
if 'constraint_subtype' in sf_item[sf_framecode] and sf_item[sf_framecode]['constraint_subtype'] == 'paramagnetic relaxation':
Derived_paramag_relax_tot_num += len(sf_item[sf_framecode]['loop'])
Derived_paramag_relax_tot_num += sf_item[sf_framecode]['id']

if Derived_paramag_relax_tot_num > 0:
cst_sf.add_tag('Derived_paramag_relax_tot_num', Derived_paramag_relax_tot_num)
Expand Down

0 comments on commit decc0ee

Please sign in to comment.