Optimization of Chemical Properties

We’ll cover a simple example of how to optimize a molecule for a specific property. In this case, we’ll optimize for MolLogP (aka cLogP).

Example: Optimizing LogP

LogP (partition coefficient) measures a molecule’s hydrophobicity and is a key property in drug design.

More about MolLogP

Step-by-Step Guide

Here’s a step-by-step guide on how to use the Ascent Bio API to increase the logP of a molecule:

Step 1: Define Your Target Molecule

Begin by identifying the molecule you want to optimize using its SMILES representation.

For example, if your starting molecule is represented by CC(=O)OC1=CC=CC=C1C(=O)O, this will be the value you provide in the smiles field.

This SMILES string tells the API which molecular structure to take as the starting point for the optimization.

Step 2: Set the Target Property for Optimization

Next, specify the property you want to modify and the desired direction of change.

In this case, we aim to increase the molecule’s MolLogP, a property that indicates the molecule’s hydrophobicity.

To do this, set target_props to ["MolLogP"] in the request body. The target_changes field allows you to indicate whether you want to increase or decrease this property; here, set target_changes: [1] to indicate an increase. This signals to the API that the molecule should be optimized to have a higher logP value.

Step 3: Send the Request and Retrieve Results

Finally, make a POST request to the API endpoint, providing your API key in the headers along with the SMILES string and target specifications in the body of the request. Here’s a sample code snippet:

import requests

url = "https://ascentbio--ab-design-apiv4-01-inference.modal.run/design"

headers = {
  "Content-Type": "application/json",
  "ascent-api-key": "YOUR_API_KEY"
}

data = {
    "smiles": "CC(=O)OC1=CC=CC=C1C(=O)O",
    "changes": {"qed": "increase"}
}

response = requests.post(url, json=data, headers=headers)

print(response.status_code)
print(response.json())

The API will return a modified SMILES string and property values for the optimized molecule. You can verify that the logP has increased as requested. This same process can be used to optimize other molecular properties supported by the API.