Skip to content

Commit

Permalink
get_fast_mapping refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
stsouko committed Mar 11, 2021
1 parent a3a3484 commit dda0457
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions CGRtools/containers/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,20 +414,15 @@ def __xor__(self, other):
"""
return self.compose(other)

def get_fast_mapping(self, other: 'MoleculeContainer', *, threshold: int = 16) -> Optional[Dict[int, int]]:
def get_fast_mapping(self, other: 'MoleculeContainer') -> Optional[Dict[int, int]]:
"""
Get self to other fast (suboptimal) structure mapping.
Only one possible atoms mapping returned.
Effective only for big molecules.
:param threshold: molecules less than `size` atoms processed by .get_mapping
"""
if isinstance(other, MoleculeContainer):
if len(self) != len(other):
return
if len(self) < threshold:
return next(self.get_mapping(other), None)

ss, so = self._smiles(self.atoms_order.get, _return_order=True)
os, oo = other._smiles(other.atoms_order.get, _return_order=True)
if ss != os:
Expand Down

0 comments on commit dda0457

Please sign in to comment.