Skip to content

Instantly share code, notes, and snippets.

@aschreyer
Created June 13, 2011 16:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save aschreyer/1023142 to your computer and use it in GitHub Desktop.
Using the PostgreSQL pg_trgm extension for chemical similarity searching
SELECT molregno, s.ism, similarity(s.ism, 'C[NH+](C)CC[C@H](CSc1ccccc1)Nc2ccc(cc2[N+](=O)[O-])S(=O)(=O)NC(=O)c3ccc(cc3)N4CC[NH+](CC4)Cc5ccccc5c6ccc(cc6)Cl') As sim
FROM chembl.compound_smiles s
WHERE s.ism % 'C[NH+](C)CC[C@H](CSc1ccccc1)Nc2ccc(cc2[N+](=O)[O-])S(=O)(=O)NC(=O)c3ccc(cc3)N4CC[NH+](CC4)Cc5ccccc5c6ccc(cc6)Cl'
ORDER BY s.ism <-> 'C[NH+](C)CC[C@H](CSc1ccccc1)Nc2ccc(cc2[N+](=O)[O-])S(=O)(=O)NC(=O)c3ccc(cc3)N4CC[NH+](CC4)Cc5ccccc5c6ccc(cc6)Cl'
LIMIT 20;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment