Skip to content

deeporigin.drug_discovery.LigandSet

A class representing a set of Ligand objects.

Attributes:

Name Type Description
ligands list[Ligand]

A list of Ligand instances contained in the set.

network dict

A dictionary containing the network of ligands estimated using Konnektor.

Methods:

Name Description
minimize

Minimize all ligands in the set using their 3D optimization routines.

Attributes

ligands class-attribute instance-attribute

ligands: list[Ligand] = field(default_factory=list)

network class-attribute instance-attribute

network: dict = field(default_factory=dict)

Functions

admet_properties

admet_properties(use_cache: bool = True)

Predict ADMET properties for all ligands in the set. This calls the admet_properties() method on each Ligand in the set. Returns a list of the results for each ligand. Shows a progress bar using tqdm.

from_csv classmethod

from_csv(
    file_path: str, smiles_column: str = "smiles"
) -> LigandSet

Create a LigandSet instance from a CSV file containing SMILES strings and additional properties.

Parameters:

Name Type Description Default
file_path str

The path to the CSV file.

required
smiles_column str

The name of the column containing SMILES strings. Defaults to "smiles".

'smiles'

Returns:

Name Type Description
LigandSet LigandSet

A LigandSet instance containing Ligand objects created from the CSV file.

Raises:

Type Description
FileNotFoundError

If the file does not exist.

ValueError

If the CSV does not contain the specified smiles column or if SMILES strings are invalid.

from_dir classmethod

from_dir(directory: str) -> LigandSet

Create a LigandSet instance from a directory containing SDF files.

from_sdf classmethod

from_sdf(
    file_path: str,
    *,
    sanitize: bool = True,
    removeHs: bool = False
) -> LigandSet

Create a LigandSet instance from an SDF file containing one or more molecules.

Parameters:

Name Type Description Default
file_path str

The path to the SDF file.

required
sanitize bool

Whether to sanitize molecules. Defaults to True.

True
removeHs bool

Whether to remove hydrogens. Defaults to False.

False

Returns:

Name Type Description
LigandSet LigandSet

A LigandSet instance containing Ligand objects created from the SDF file.

Raises:

Type Description
FileNotFoundError

If the file does not exist.

ValueError

If the file cannot be parsed correctly.

from_smiles classmethod

from_smiles(smiles: list[str] | set[str]) -> LigandSet

Create a LigandSet from a list of SMILES strings.

map_network

map_network(
    *,
    use_cache: bool = True,
    operation: Literal[
        "mapping", "network", "full"
    ] = "network",
    network_type: Literal["star", "mst", "cyclic"] = "mst"
)

Map a network of ligands from an SDF file using the DeepOrigin API.

mcs

mcs() -> str

Generates the Most Common Substructure (MCS) for ligands in a LigandSet

Returns:

Type Description
str

smartsString (str) : SMARTS string representing the MCS

minimize

minimize()

Minimize all ligands in the set using their 3D optimization routines. This calls the minimize() method on each Ligand in the set.

show

show()

Visualize all ligands in this LigandSet.

Raises:

Type Description
FileNotFoundError

If the file does not exist.

ValueError

If the file cannot be parsed correctly.

show_df

show_df()

Show ligands in the set in a dataframe with 2D visualizations.

show_network

show_network()

Show the network of ligands in the set.

to_dataframe

to_dataframe() -> DataFrame

Convert the LigandSet to a pandas DataFrame.

to_rdkit_mols

to_rdkit_mols() -> list[Mol]

Convert all ligands in the set to RDKit molecules.

to_sdf

to_sdf(output_path: Optional[str] = None) -> str

Write all ligands in the set to a single SDF file, preserving all properties from each Ligand's mol.m field.

Parameters:

Name Type Description Default
output_path str

The path to the output SDF file.

None

Returns:

Name Type Description
str str

The path to the written SDF file.

to_smiles

to_smiles() -> list[str]

Convert all ligands in the set to SMILES strings.