Skip to content

Instantly share code, notes, and snippets.


Adrian Schreyer aschreyer

View GitHub Profile
View USRCAT-ZINC-screen.sql
WITH conformer AS
SELECT'CC1=CC(=C(N1C2=CC(=CC(=C2)C(F)(F)F)C(F)(F)F)C)/C=C\3/C(=O)N=C(S3)NC4=CC=CC=C4') as oeb
query AS
SELECT openeye.usrcat(oeb) AS usr_moments
FROM conformer
screen AS
aschreyer /
Created Feb 26, 2013
USRCAT search with one of the OSDD Malaria compounds, OSM-S-35. The SMILES strings were obtained by using on the relevant OSDD blog post. Two stereoisomers were found for OSM-S-35 and a conformer generated for each with OpenEye's OMEGA toolkit.
import requests
headers = {'accept': 'application/json'}
files = {'file': open('/home/adrian/Dropbox/OSM-S-35-I.sdf')}
response ='',
headers=headers, files=files, params={'usrcat':'t', 'limit':25})
View sample.cif
aschreyer / pgopeneye-benchmark.sql
Last active Dec 12, 2015
PostgreSQL OpenEye cartridge benchmark based on ChEMBL15.
View pgopeneye-benchmark.sql
-- set search_path = public, openeye;
DO $$
molregno integer;
fp oefp;
FOR molregno, fp IN SELECT cfp.molregno, cfp.circular_fp
FROM chembl.compound_oefps cfp
ORDER BY random() LIMIT 100
def fetch_all_descendants(self, fragment_id, *expr, **kwargs):
Returns all the descending fragments of the fragment with the given
fragment_id using an recursive SQL query.
# query part that will be used in both parts of the recursive query
query = Fragment.query.with_entities(Fragment.fragment_id)
query = query.join(FragmentHierarchy, FragmentHierarchy.child_id==Fragment.fragment_id)
aschreyer /
Last active Dec 12, 2015
More credoscript examples to show the implementation of SQLAlchemy.
def contains(self, smiles):
return self.rdmol.HasSubstructMatch(MolFromSmiles(str(smiles)))
def contains(self, smiles):
return self.rdmol.op('OPERATOR(rdkit.@>)')(smiles)
import urllib2
import json
headers = {'Accept' : 'application/json'}
req = urllib2.Request('', headers=headers)
resp = urllib2.urlopen(req)
jsondata = json.load(resp)
# output
{u'data': [7464,
aschreyer / openeye-multimcs-chembl-threshold.sql
Created Nov 12, 2012
The multimcs() function in the PostgreSQL OpenEye cartridge
View openeye-multimcs-chembl-threshold.sql
SELECT assay_id,
count(DISTINCT molregno) AS compounds,
openeye.multimcs(array_agg(ism), threshold:=0.8) AS mcs
FROM chembl.target_dictionary
JOIN chembl.assay2target USING(tid)
JOIN chembl.activities a USING(assay_id)
JOIN chembl.compound_smiles cs USING(molregno)
WHERE protein_accession = 'P53779'
GROUP BY assay_id
HAVING count(DISTINCT molregno) >= 5
aschreyer / unichem-fdw-query.sql
Created Nov 2, 2012
UniChem PostgreSQL Foreign Data Wrapper
View unichem-fdw-query.sql
FROM credo.unichem_pdb_to_kegg
het_id compound_id
------ -----------
LQZ C07073
HC4 C00811
DC5 C14355
POD C10874
aschreyer / usrcat-query.sql
Created Sep 10, 2012
Example USRCAT query demonstrating the use of the cube extension
View usrcat-query.sql
-- select a query molecule
WITH query AS
FROM dude.usr_moments_fnta
WHERE category = 'ACTIVE' AND mol_idx = 1 AND conformer = 0
-- run the virtual screen with the given query
SELECT category, mol_idx, MAX(sq.similarity) as similarity
You can’t perform that action at this time.