Skip to content

Commit

Permalink
Merge pull request #74 from rcsb/ro-3958
Browse files Browse the repository at this point in the history
V1.21 Turn on GlyGen annotations loading
  • Loading branch information
piehld authored Apr 2, 2024
2 parents bdc9959 + 68d11fb commit e7b7679
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 41 deletions.
3 changes: 2 additions & 1 deletion HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,5 @@
Create separate providerType names 'pdbx_core' and 'pdbx_comp_model_core' to limit loading of unnecessary
resources for each dataset (via providerTypeExclude)
26-Mar-2024 - V1.20 Add GlyGen annotation 'type' to polymer entity instances, but temporarily turn off loading
Fix incremental update method for NeighborInteractionWorkflow
Fix incremental update method for NeighborInteractionWorkflow
1-Apr-2024 - V1.21 Turn on GlyGen annotations loading
79 changes: 40 additions & 39 deletions rcsb/utils/dictionary/DictMethodEntityInstanceHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# 19-Mar-2024 dwp Add GlyGen annotations to polymer entity instances with glycosylation sites;
# Don't run 'buildInstanceLigandNeighbors' or 'buildInstanceTargetNeighbors' for CSMs (no neighbor data available)
# 26-Mar-2024 dwp Add "type" to GlyGen annotations, but temporarily turn off loading
# 1-Apr-2024 dwp Turn on GlyGen annotations loading
##
"""
This helper class implements methods supporting entity-instance-level functions in the RCSB dictionary extension.
Expand Down Expand Up @@ -2117,45 +2118,45 @@ def buildEntityInstanceAnnotations(self, dataContainer, catName, **kwargs):
ii += 1
#
# GlyGen
# ggP = rP.getResource("GlyGenProvider instance") if rP else None
# if ggP:
# gS = set()
# version = ggP.getVersion()
# ggD = ggP.getGlycoproteins()
# for asymId, authAsymId in asymAuthIdD.items():
# if instTypeD[asymId] not in ["polymer"]:
# continue
# entityId = asymIdD[asymId]
# logger.debug("entryId %r entityId %r, asymId %r", entryId, entityId, asymId)
# instConnL = self.__commonU.getInstanceConnections(dataContainer)
# for cD in instConnL:
# if "role" in cD and cD["role"] in ["C-Mannosylation", "N-Glycosylation", "O-Glycosylation", "S-Glycosylation"]:
# if asymId == cD["connect_target_label_asym_id"] or asymId == cD["connect_partner_label_asym_id"]:
# # Get UniProt IDs from rcsb_polymer_entity_align
# # Note that this requires `addPolymerEntityReferenceAlignments` to be run before `buildEntityInstanceAnnotations` (in methods dictionary)
# unpIdL = self.__commonU.getPolymerEntityReferenceAlignments(dataContainer, entityId, "UniProt")
# unpIdL = [aD["reference_database_accession"] for aD in unpIdL]
# logger.debug("unpIdL %r", unpIdL)
# for unpId in unpIdL:
# if ggP.hasGlycoprotein(unpId):
# ggId = unpId + "-" + ggD[unpId]
# gTup = (entryId, entityId, asymId, authAsymId, ggId)
# logger.debug("gTup %r", gTup)
# gS.add(gTup)

# for (entryId, entityId, asymId, authAsymId, ggId) in gS:
# logger.debug("adding to cObj: %r %r %r %r %r", entryId, entityId, asymId, authAsymId, ggId)
# cObj.setValue(ii + 1, "ordinal", ii)
# cObj.setValue(entryId, "entry_id", ii)
# cObj.setValue(entityId, "entity_id", ii)
# cObj.setValue(asymId, "asym_id", ii)
# cObj.setValue(authAsymId, "auth_asym_id", ii)
# cObj.setValue("GlyGen", "type", ii)
# cObj.setValue(ggId, "annotation_id", ii)
# cObj.setValue("GlyGen", "provenance_source", ii)
# cObj.setValue(version, "assignment_version", ii)
# #
# ii += 1
ggP = rP.getResource("GlyGenProvider instance") if rP else None
if ggP:
gS = set()
version = ggP.getVersion()
ggD = ggP.getGlycoproteins()
for asymId, authAsymId in asymAuthIdD.items():
if instTypeD[asymId] not in ["polymer"]:
continue
entityId = asymIdD[asymId]
logger.debug("entryId %r entityId %r, asymId %r", entryId, entityId, asymId)
instConnL = self.__commonU.getInstanceConnections(dataContainer)
for cD in instConnL:
if "role" in cD and cD["role"] in ["C-Mannosylation", "N-Glycosylation", "O-Glycosylation", "S-Glycosylation"]:
if asymId == cD["connect_target_label_asym_id"] or asymId == cD["connect_partner_label_asym_id"]:
# Get UniProt IDs from rcsb_polymer_entity_align
# Note that this requires `addPolymerEntityReferenceAlignments` to be run before `buildEntityInstanceAnnotations` (in methods dictionary)
unpIdL = self.__commonU.getPolymerEntityReferenceAlignments(dataContainer, entityId, "UniProt")
unpIdL = [aD["reference_database_accession"] for aD in unpIdL]
logger.debug("unpIdL %r", unpIdL)
for unpId in unpIdL:
if ggP.hasGlycoprotein(unpId):
ggId = unpId + "-" + ggD[unpId]
gTup = (entryId, entityId, asymId, authAsymId, ggId)
logger.debug("gTup %r", gTup)
gS.add(gTup)

for (entryId, entityId, asymId, authAsymId, ggId) in gS:
logger.debug("adding to cObj: %r %r %r %r %r", entryId, entityId, asymId, authAsymId, ggId)
cObj.setValue(ii + 1, "ordinal", ii)
cObj.setValue(entryId, "entry_id", ii)
cObj.setValue(entityId, "entity_id", ii)
cObj.setValue(asymId, "asym_id", ii)
cObj.setValue(authAsymId, "auth_asym_id", ii)
cObj.setValue("GlyGen", "type", ii)
cObj.setValue(ggId, "annotation_id", ii)
cObj.setValue("GlyGen", "provenance_source", ii)
cObj.setValue(version, "assignment_version", ii)
#
ii += 1
#
# Glycosylation annotations
jj = 1
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.20"
__version__ = "1.21"

0 comments on commit e7b7679

Please sign in to comment.