In [1]:
%load_ext autoreload
%autoreload 2
In [2]:
from dotenv import load_dotenv

load_dotenv()
Out[2]:
True

Working with Projects¶

This notebook shows you how to work with Projects in Deeporigin

In [3]:
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:

In [4]:
projects.create("python-client-test-project-kfsresf")
Out[4]:
'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:

In [5]:
projects.current()
Out[5]:
('09DEFAULTPROJECT00', 'python-client-test-project-kfsresf')

List projects¶

To list available projects, use:

In [6]:
projects.list(limit=10)
Out[6]:
id name description
0 09DEFAULTPROJECT00 python-client-test-project-kfsresf None

Load a project¶

To load a project, use:

In [7]:
projects.load("python-client-test-project-kfsresf") 
projects.current()
Out[7]:
('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:

In [8]:
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:

In [9]:
projects.proteins()
Out[9]:
id name file_path pdb_id
0 brd brd testing/brd.pdb None

Note that the Protein is now assigned a project_id:

In [10]:
protein.project_id
Out[10]:
'09DEFAULTPROJECT00'

Similarly, we can view the ligands in the project using:

In [11]:
df = projects.ligands()
df
Out[11]:
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:

In [12]:
ligands = LigandSet.from_ids(list(df["id"]))
ligands
Out[12]:

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

In [13]:
ligands[0].project_id
Out[13]:
'09DEFAULTPROJECT00'
In [ ]: