Open cstein opened 6 years ago
Another option is to make the underlying molecule agnostic to the representation:
class MoleculeBase(object):
def __init__(self, filename):
self._filename = filename
def getNumAtoms(self):
raise NotImplemented
class OBMolecule(MoleculeBase):
def __init__(self, filename):
MoleculeBase.__init__(self, filename)
self._mol = #load molecule with openbabel
def getNumAtoms(self):
return self._mol.GetNumAtoms()
class RDKitMolecule(MoleculeBase):
pass
Using this approach, the fragmentation class will only interact with a molecule which exposes all the necessary features.
Currently we rely on OpenBabel to parse the SMARTS and give us the atoms of the corresponding fragments. We should also make an effort to support other APIs such as RDKit.
There is some code available in
src/openbabelwrapper.py
which could be used as a starting point.I suppose something like which is easily testable depending only on the classes themselves.
some logic would then be built-in depending on what packages are available. Some things that the classes should provide:
Initially we will ignore things like fragment grouping and so on.