This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [ 1]: from credo.credoscript import * | |
# Fetch a structure from a database with the corresponding adaptor | |
In [ 2]: s = StructureAdaptor().fetch_by_pdb('3CS9') | |
# Database columns are mapped as attributes | |
In [ 3]: s.title | |
Out[ 3]: 'Human ABL kinase in complex with nilotinib' | |
# Relationships with other entities are mapped as attributes as well |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT openeye.enumerate_tautomers('O=C1NN=Cc2cocc12'); | |
enumerate_tautomers | |
--------------------------------------- | |
'{O=c1[nH]ncc2c1coc2,Oc1nncc2c1coc2}' | |
(1 row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT '{1,2,3,4,5}'::arrayxi & '{5,4,3,2,1}'::arrayxi; | |
?column? | |
--------------- | |
'{0,0,3,0,0}' | |
(1 row) | |
Time: 0.290 ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT canonical_smiles, openeye.has_undef_stereo(canonical_smiles) | |
FROM chembl.compound_structures s | |
JOIN chembl.chembl_id_lookup i | |
ON s.molregno = i.entity_id AND i.entity_type = 'COMPOUND' | |
WHERE i.chembl_id = 'CHEMBL287587' OR i.chembl_id = 'CHEMBL1437'; | |
canonical_smiles | has_undef_stereo | |
----------------------------+----------------------- | |
'NC[C@H](O)c1ccc(O)c(O)c1' | f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT s.pdb, l.ligand_name, s.title, sq.similarity | |
FROM ( | |
WITH query AS (SELECT calphafp FROM credo.ligand_fuzcav WHERE ligand_id = 3919) | |
SELECT f.ligand_id, arrayxi_fuzcavsim_global(query.calphafp, f.calphafp) AS similarity | |
FROM credo.ligand_fuzcav f, query | |
WHERE arrayxi_fuzcavsim_global(query.calphafp, f.calphafp) > 0.17 | |
) sq, | |
credo.ligands l, credo.biomolecules b, credo.structures s | |
WHERE sq.ligand_id = l.ligand_id | |
AND l.biomolecule_id = b.biomolecule_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT degrees('(3,0,0)'::vector3d @ '(5,5,0)'::vector3d) AS angle; | |
angle | |
------- | |
45 | |
(1 row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from urllib import urlopen | |
# GET A CHEMICAL COMPONENT | |
response = urlopen('http://0.0.0.0:8000/credo/rest/chemcomps/sti').read() | |
# PARSE JSON INTO PYTHON DICTIONARY | |
sti = json.loads(response) | |
# COLUMN DATA/ATTRIBUTES ARE CONVERTED TO DICTIONARY KEYS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from credo.credoscript import * | |
from credo.contrib.chemidresolver import * | |
ca = ChemCompAdaptor() | |
rsvr = ChemIdResolver() | |
# GET THE SDF FILE OF LAPATINIB WITH 3D COORDINATES | |
molstring = rsvr.get_structure('lapatinib','sdf', get3d=True) | |
# GET THE USR MOMENTS FOR THE STRUCTURE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from credo.credoscript import * | |
ca = ChemCompAdaptor() | |
# GET IMATINIB | |
sti = ca.fetch_by_het_id('STI') | |
# GET ALL SIMILAR CHEMICAL COMPONENTS USING CIRCULAR FINGERPRINTS | |
ca.fetch_all_by_sim(sti.ism, fp='circular') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
OlderNewer