protein-ligand-benchmark icon indicating copy to clipboard operation
protein-ligand-benchmark copied to clipboard

Docs -- examples on running benchmarks with alchemiscale

Open ijpulidos opened this issue 11 months ago • 1 comments

We have scripts/notebooks that can be used to take the information in the protein-ligand benchmark dataset to be run with alchemiscale. I think it would be good if we add an example in this repo of running at least a single system in the PLB using alchemiscale.

CC @IAlibay

ijpulidos avatar Mar 11 '24 14:03 ijpulidos

@ijpulidos just as a follow-up from today's meeting, here is the code necessary to deserialize a network yaml file into a LigandNetwork

import yaml
from rdkit import Chem
import gufe
import openfe

def get_smc_by_name(ligands: list[openfe.SmallMoleculeComponent], name: str) -> openfe.SmallMoleculeComponent:
    for lig in ligands:
        if lig.name == name:
            return lig

# load in your ligands
rdmols = [mol for mol in Chem.SDMolSupplier("ligands.sdf", removeHs=False)]
ligands = [openfe.SmallMoleculeComponent.from_rdkit(mol) for mol in rdmols]

# Let's say the yaml is called `network.yml`
with open('network.yml') as stream:
    edge_dict = yaml.safe_load(stream)

mappings = []

for edge_name in edge_dict['edges']:
    edge = edge_dict['edges'][edge_name]
    molA = get_smc_by_name(ligands, edge['ligand_a'])
    molB = get_smc_by_name(ligands, edge['ligand_b'])
    mapped_atoms = edge['atom mapping']
    mappings.append(gufe.LigandAtomMapping(molA, molB, mapped_atoms))

ligand_network = openfe.LigandNetwork(mappings, ligands)

IAlibay avatar Mar 11 '24 15:03 IAlibay