Hi Paul,
On May 30, 2011, at 4:42 PM, [email protected] wrote:
> I have some old code which I would like to convert smoothly to rdkit.
...
> Do I necessarily need to convert MySQL to PostgreSQL? A quick google search
> shows me that this should be feasible, but I have never done it so far.
That frowns code is only on the client side so you don't need to change the
database at all.
I've been trying to figure out why your code turns the SMILES from the database
into a molecule, to get the canonical SMILES, then reinterprets the canonical
SMILES to go back into a molecule.
That's one (or two) conversions too many. The following should work for you:
pattern = Chem.MolFromSmarts("....pattern here ...")
db_smiles = db.do('SELECT ligand_id, smiles FROM ligands;')
ligand_ids = []
for db_smile in db_smiles:
mol = Chem.MolFromSmiles(db_smile[1])
if mol is not None and mol.HasSubstructMatch(pattern):
ligand_ids.append(db_smile[0])
return ligand_ids
The check for "mol is not None" is in case the SMILES is invalid, or cannot be
perceived by RDKit. The frowns code threw an exception in that case.
Andrew
[email protected]
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss