Skip to content

Commit

Permalink
Merge pull request #24 from rcsb/ro-4209
Browse files Browse the repository at this point in the history
RO-4209: Adjust LigandNeighborMappingExtractor in response to changes to rcsb_ligand_neighbors
  • Loading branch information
piehld authored Jul 25, 2024
2 parents 0375129 + a6c9ec1 commit f79d637
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,4 @@
Update unit tests and setuptools config
9-May-2024 V1.2 Adjust provider type exclusion input to accept a list of types
13-May-2024 V1.21 Update requirements; fix linting
17-Jul-2024 V1.22 Adjust LigandNeighborMappingExtractor
2 changes: 1 addition & 1 deletion rcsb/exdb/cli/__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.21"
__version__ = "1.22"
6 changes: 3 additions & 3 deletions rcsb/exdb/seq/LigandNeighborMappingExtractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Utilities to extract ligand neighbor mapping details from the exchange collections.
#
# Updates:
# 17-Jul-2024 dwp Stop fetching and including rcsb_ligand_neighbors.ligand_is_bound, since no longer populating that field
#
##
__docformat__ = "google en"
Expand Down Expand Up @@ -58,7 +59,6 @@ def __extractLigandNeighbors(self):
"rcsb_polymer_entity_instance_container_identifiers.entity_id",
"rcsb_polymer_entity_instance_container_identifiers.asym_id",
"rcsb_ligand_neighbors.ligand_comp_id",
"rcsb_ligand_neighbors.ligand_is_bound",
],
)
eCount = obEx.getCount()
Expand All @@ -71,8 +71,8 @@ def __extractLigandNeighbors(self):
entityId = peiD["rcsb_polymer_entity_instance_container_identifiers"]["entity_id"]
ky = entryId + "_" + entityId
for lnD in peiD["rcsb_ligand_neighbors"] if "rcsb_ligand_neighbors" in peiD else []:
if "ligand_comp_id" in lnD and "ligand_is_bound" in lnD:
rD.setdefault(ky, set()).add((lnD["ligand_comp_id"], lnD["ligand_is_bound"]))
if "ligand_comp_id" in lnD:
rD.setdefault(ky, set()).add(lnD["ligand_comp_id"])
else:
logger.warning("%s %s missing details lnD %r", entryId, entityId, lnD)
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion rcsb/exdb/seq/LigandNeighborMappingProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def getLigandNeighbors(self, rcsbEntityId):
list: [chem_comp_id, ... ]
"""
try:
return list(set([t[0] for t in self.__mapD["mapping"][rcsbEntityId.upper()]]))
return list(set([t for t in self.__mapD["mapping"][rcsbEntityId.upper()]]))
except Exception:
return []

Expand Down
2 changes: 2 additions & 0 deletions rcsb/exdb/tests/testLigandNeighborMappingProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ def testLigandNeighborMapping(self):
ok = crmP.testCache(minCount=2)
self.assertTrue(ok)
nL = crmP.getLigandNeighbors("3VFJ_2")
logger.info("ligand neighbor list nL %r", nL)
self.assertGreaterEqual(len(nL), 4)
self.assertGreater(len(nL[0]), 1)
#
except Exception as e:
logger.exception("Failing with %s", str(e))
Expand Down

0 comments on commit f79d637

Please sign in to comment.