Skip to content

Commit

Permalink
DAOTHER-1728, 9846, 8905, 3018, 3848: Force to reset 'pdbx_nmr_repres…
Browse files Browse the repository at this point in the history
…entative.conformer_id'
  • Loading branch information
yokochi47 committed Jan 10, 2025
1 parent 6e45bd7 commit 88fc93c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 33 deletions.
73 changes: 40 additions & 33 deletions wwpdb/utils/nmr/ann/OneDepAnnTasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,38 +186,38 @@ def __init__(self, verbose: bool, log: IO,
'nmrspectralpeaklist',
'nmrrefinement']

self.__cifRequirements = {'nmrsample': ["pdbx_nmr_sample_details",
"pdbx_nmr_exptl_sample",
"pdbx_nmr_exptl_sample_conditions"],
'nmrdatacollection': ["pdbx_nmr_spectrometer",
"pdbx_nmr_exptl",
"pdbx_nmr_sample_details",
"pdbx_nmr_exptl_sample_conditions"],
'nmrsoftware': ["pdbx_nmr_software",
"pdbx_nmr_software_task"],
'nmrchemshiftreference': ["pdbx_nmr_chem_shift_reference",
"pdbx_nmr_chem_shift_ref"],
'nmrchemshiftconnection': ["pdbx_nmr_assigned_chem_shift_list",
"pdbx_nmr_chem_shift_experiment",
"pdbx_nmr_chem_shift_reference",
"pdbx_nmr_systematic_chem_shift_offset",
"pdbx_nmr_chem_shift_software",
"pdbx_nmr_software",
"pdbx_nmr_exptl",
"pdbx_nmr_sample_details",
"pdbx_nmr_exptl_sample_conditions"],
'nmrconstraints': ["pdbx_nmr_constraint_file"],
'nmrspectralpeaklist': ["pdbx_nmr_spectral_peak_list",
"pdbx_nmr_spectral_dim",
"pdbx_nmr_spectral_peak_software",
"pdbx_nmr_exptl",
"pdbx_nmr_sample_details",
"pdbx_nmr_software"],
'nmrrefinement': ["pdbx_nmr_ensemble",
"pdbx_nmr_representative",
"pdbx_nmr_refine",
"pdbx_nmr_software",
"pdbx_initial_refinement_model"]
self.__cifRequirements = {'nmrsample': ['pdbx_nmr_sample_details',
'pdbx_nmr_exptl_sample',
'pdbx_nmr_exptl_sample_conditions'],
'nmrdatacollection': ['pdbx_nmr_spectrometer',
'pdbx_nmr_exptl',
'pdbx_nmr_sample_details',
'pdbx_nmr_exptl_sample_conditions'],
'nmrsoftware': ['pdbx_nmr_software',
'pdbx_nmr_software_task'],
'nmrchemshiftreference': ['pdbx_nmr_chem_shift_reference',
'pdbx_nmr_chem_shift_ref'],
'nmrchemshiftconnection': ['pdbx_nmr_assigned_chem_shift_list',
'pdbx_nmr_chem_shift_experiment',
'pdbx_nmr_chem_shift_reference',
'pdbx_nmr_systematic_chem_shift_offset',
'pdbx_nmr_chem_shift_software',
'pdbx_nmr_software',
'pdbx_nmr_exptl',
'pdbx_nmr_sample_details',
'pdbx_nmr_exptl_sample_conditions'],
'nmrconstraints': ['pdbx_nmr_constraint_file'],
'nmrspectralpeaklist': ['pdbx_nmr_spectral_peak_list',
'pdbx_nmr_spectral_dim',
'pdbx_nmr_spectral_peak_software',
'pdbx_nmr_exptl',
'pdbx_nmr_sample_details',
'pdbx_nmr_software'],
'nmrrefinement': ['pdbx_nmr_ensemble',
'pdbx_nmr_representative',
'pdbx_nmr_refine',
'pdbx_nmr_software',
'pdbx_initial_refinement_model']
}

self.__nmrIfCategories = set()
Expand Down Expand Up @@ -1703,9 +1703,13 @@ def replace_none(array, default: str = '.'):
if cR.hasCategory(cif_category):
row_list = cR.getRowList(cif_category)
if len(row_list) > 0:
cif_util.AddCategory(self.__entryId, cif_category, cR.getItemTags(cif_category))
item_tags = cR.getItemTags(cif_category)
cif_util.AddCategory(self.__entryId, cif_category, item_tags)
cif_util.InsertData(self.__entryId, cif_category, row_list)

# DAOTHER-3018, 3848: force to reset 'pdbx_nmr_representative.conformer_id'
cif_util.UpdateMultipleRowsValue(self.__entryId, 'pdbx_nmr_representative', 'conformer_id', '?')

try:
cif_util.WriteCif(file_path)
except Exception:
Expand Down Expand Up @@ -2197,6 +2201,9 @@ def replace_none(array, default: str = '.'):
# if len(cif_util.GetCategories()[self.__entryId]) == 0:
# return False

# DAOTHER-3018, 3848: force to reset 'pdbx_nmr_representative.conformer_id'
cif_util.UpdateMultipleRowsValue(self.__entryId, 'pdbx_nmr_representative', 'conformer_id', '?')

try:
cif_util.WriteCif(file_path)
except Exception:
Expand Down
13 changes: 13 additions & 0 deletions wwpdb/utils/nmr/io/mmCIFUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,19 @@ def GetAttributes(self, blockName: str, catName: str, ext: int = 1) -> List[str]
#
return catObj.getAttributeList()

def GetRowLength(self, blockName: str, catName: str, ext: int = 1) -> int:
""" Return length of rows of a given category.
"""
if blockName not in self.__dataMap:
return 0

catObj = self.__dataList[self.__dataMap[get_ext_block_name(blockName, ext)]].getObj(catName)

if not catObj:
return 0
#
return len(catObj.getRowList())

def GetRowList(self, blockName: str, catName: str, ext: int = 1) -> List[list]:
""" Get a list of list of a geven Data Block and Category
"""
Expand Down

0 comments on commit 88fc93c

Please sign in to comment.