Skip to content
Snippets Groups Projects
Verified Commit 9ddc4b1c authored by Xavier Robin's avatar Xavier Robin
Browse files

fix: compute chain mapping only once

parent b5ec0d9e
Branches
Tags
No related merge requests found
......@@ -278,6 +278,7 @@ class LigandScorer:
# lazily precomputed variables
self._binding_sites = {}
self.__model_mapping = None
@property
def chain_mapper(self):
......@@ -291,6 +292,13 @@ class LigandScorer:
resnum_alignments=self.resnum_alignments)
return self._chain_mapper
@property
def _model_mapping(self):
"""Get the global chain mapping for the model."""
if self.__model_mapping is None:
self.__model_mapping = self.chain_mapper.GetMapping(self.model)
return self.__model_mapping
@staticmethod
def _extract_ligands(entity):
"""Extract ligands from entity. Return a list of residues.
......@@ -453,10 +461,9 @@ class LigandScorer:
# Find the representations
if self.global_chain_mapping:
mapping_res = self.chain_mapper.GetMapping(self.model)
self._binding_sites[ligand.hash_code] = self.chain_mapper.GetRepr(
ref_bs, self.model, inclusion_radius=self.lddt_lp_radius,
global_mapping = mapping_res)
global_mapping = self._model_mapping)
else:
self._binding_sites[ligand.hash_code] = self.chain_mapper.GetRepr(
ref_bs, self.model, inclusion_radius=self.lddt_lp_radius,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment