Skip to content

Commit

Permalink
V1.23 Tweak to BIRD citation method; update setuptools config
Browse files Browse the repository at this point in the history
  • Loading branch information
piehld committed May 9, 2024
1 parent 39f5e0e commit 9810ad3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
3 changes: 2 additions & 1 deletion HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,5 @@
26-Mar-2024 - V1.20 Add GlyGen annotation 'type' to polymer entity instances, but temporarily turn off loading
Fix incremental update method for NeighborInteractionWorkflow
1-Apr-2024 - V1.21 Turn on GlyGen annotations loading
3-May-2024 - V1.22 Adjust BIRD citation method in DictMethodChemRefHelper
3-May-2024 - V1.22 Adjust BIRD citation method in DictMethodChemRefHelper
9-May-2024 - V1.23 Tweak to above update (V1.22); update setuptools config
26 changes: 20 additions & 6 deletions rcsb/utils/dictionary/DictMethodChemRefHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ def addChemCompDescriptor(self, dataContainer, catName, **kwargs):

def renameCitationCategory(self, dataContainer, catName, **kwargs):
"""Rename citation and citation author categories.
Note that this method is run twice: once for catName 'rcsb_bird_citation', and once for 'rcsb_bird_citation_author'
Args:
dataContainer (object): mmif.api.DataContainer object instance
Expand All @@ -807,22 +808,35 @@ def renameCitationCategory(self, dataContainer, catName, **kwargs):
"""
try:
_ = kwargs
ok = False
logger.debug("Starting with %r %r", dataContainer.getName(), catName)
#
catDestSrcMap = {
"rcsb_bird_citation": "citation",
"rcsb_bird_citation_author": "citation_author",
}
#
if not (dataContainer.exists("chem_comp") and dataContainer.exists("pdbx_chem_comp_identifier")):
return False
containerName = dataContainer.getName()
if not containerName.upper().startswith("PRD_"):
return False
#
if catName not in catDestSrcMap:
logger.error("Unsupported catName %r", catName)
return False
#
# Copy target categories to new name
if dataContainer.exists("citation"):
dataContainer.copy("citation", "rcsb_bird_citation")
if dataContainer.exists("citation_author"):
dataContainer.copy("citation_author", "rcsb_bird_citation_author")
return True
ccId = dataContainer.getObj("chem_comp").getValue("id", 0)
srcCat = catDestSrcMap[catName]
logger.debug("Working on containerName %r ccId %r srcCatName %r catName %r", containerName, ccId, srcCat, catName)
if dataContainer.exists(srcCat) and not dataContainer.exists(catName):
ok = dataContainer.copy(srcCat, catName)
if not ok:
logger.error("Failed for containerName %r ccId %r srcCatName %r catName %r", containerName, ccId, srcCat, catName)
return ok
except Exception as e:
logger.exception("For %s failing with %s", catName, str(e))

return False

def addChemCompSynonyms(self, dataContainer, catName, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion rcsb/utils/dictionary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
__author__ = "John Westbrook"
__email__ = "[email protected]"
__license__ = "Apache 2.0"
__version__ = "1.22"
__version__ = "1.23"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
universal=1

[metadata]
description-file = README.md
description_file = README.md

0 comments on commit 9810ad3

Please sign in to comment.