%load_ext autoreload
%autoreload 2
from dotenv import load_dotenv
load_dotenv()
True
Working with Projects¶
This notebook shows you how to work with Projects in Deeporigin
from deeporigin import projects
from deeporigin.platform import DeepOriginClient
from deeporigin.drug_discovery import LigandSet, BRD_DATA_DIR, Protein, PocketFinder, Ligand
# optional
client = DeepOriginClient()
/home/runner/work/do-dd-client/do-dd-client/.venv/lib/python3.11/site-packages/jwt/api_jwt.py:147: InsecureKeyLengthWarning: The HMAC key is 6 bytes long, which is below the minimum recommended length of 32 bytes for SHA256. See RFC 7518 Section 3.2. return self._jws.encode(
Creating a Project¶
Projects can be created using:
projects.create("python-client-test-project-kfsresf")
'09DEFAULTPROJECT00'
By default, creating a project also loads it, and sets it as the current project.
Viewing current project¶
To view the currently loaded project, use:
projects.current()
('09DEFAULTPROJECT00', 'python-client-test-project-kfsresf')
List projects¶
To list available projects, use:
projects.list(limit=10)
| id | name | description | |
|---|---|---|---|
| 0 | 09DEFAULTPROJECT00 | python-client-test-project-kfsresf | None |
Load a project¶
To load a project, use:
projects.load("python-client-test-project-kfsresf")
projects.current()
('09DEFAULTPROJECT00', 'python-client-test-project-kfsresf')
Proteins and Ligands in a Project¶
If a project is loaded, sync methods on Protein, Ligand, and LigandSet assign that entity to that project:
protein = Protein.from_file(BRD_DATA_DIR / "brd.pdb")
protein.sync()
ligands = LigandSet.from_dir(BRD_DATA_DIR)
ligands.sync()
We can view the proteins in this project using:
projects.proteins()
| id | name | file_path | pdb_id | |
|---|---|---|---|---|
| 0 | brd | brd | testing/brd.pdb | None |
Note that the Protein is now assigned a project_id:
protein.project_id
'09DEFAULTPROJECT00'
Similarly, we can view the ligands in the project using:
df = projects.ligands()
df
| id | name | smiles | |
|---|---|---|---|
| 0 | brd-2 | cmpd 2 (methyl) | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 |
| 1 | brd-3 | cmpd 3 (Allyl) | C=CCn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O |
| 2 | brd-4 | cmpd 4 (Crotyl) | C/C=C/Cn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O |
| 3 | brd-5 | cmpd 5 (1-Butenyl) | C=CCCn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O |
| 4 | brd-6 | cmpd 6 (ethyl) | CCn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O |
| 5 | brd-7 | cmpd 7 (n-propyl) | CCCn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O |
| 6 | brd-8 | cmpd 8 (n-Butyl) | CCCCn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O |
| 7 | brd-9 | cmpd 9 (methoxyethyl) | COCCn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O |
We can download those ligands to disk using:
ligands = LigandSet.from_ids(list(df["id"]))
ligands
LigandSet with 8 ligands
8 unique SMILES NOT PROTONATED 2D
Properties: initial_smiles
Use .to_dataframe() to convert to a dataframe, .show_df() to view dataframewith structures, or .show() for 3D visualization, .prepare() to prepare ligands for docking
ligands[0].project_id
'09DEFAULTPROJECT00'