Operations

This module contains various operations used in the GB-BI library.

Generator Class

class illumination.operations.Generator(config)[source]

Bases: object

A catalog class containing and implementing mutations to small molecules according to the principles of positional analogue scanning.

Attributes:

archive: The archive of elite molecules used for generating new molecules. crossover: An instance of the Crossover class for generating molecule pairs. mutator: An instance of the Mutator class for mutating molecules. batch_size: The number of molecules to sample and mutate/crossover per batch. initial_data: The path to the initial data file containing molecule information. initial_size: The initial number of molecules to load from the database.

Methods:

__init__(config): Initializes the Generator with the given configuration. set_archive(archive): Sets the archive for the Generator. __call__(): Generates a batch of new molecules by mutating and crossing over sampled molecules. load_from_database(): Loads a set of molecules from the initial data database.

load_from_database() List[Molecule][source]

Loads a set of molecules from the initial data database.

Returns:

List[Molecule]: A list of molecules loaded from the database.

set_archive(archive)[source]

Sets the archive for the Generator.

Args:

archive: The archive of elite molecules.

Mutator Class

class illumination.operations.Mutator(mutation_data: str)[source]

Bases: object

A catalog class containing and implementing mutations to small molecules according to the principles of positional analogue scanning.

Attributes:

mutation_data: A dataframe containing mutation SMARTS patterns and their associated probabilities.

Methods:

__init__(mutation_data): Initializes the Mutator with the given mutation data. __call__(molecule): Applies a mutation to a given molecule and returns the resulting molecules.

Crossover Class

class illumination.operations.Crossover[source]

Bases: object

A strategy class implementing a parent-centric crossover of small molecules.

Methods:

__init__(): Initializes the Crossover object. __call__(molecule_pair): Performs a crossover on a pair of molecules. merge(molecule_pair): Merges the fragments of a molecule pair. fragment(molecule_pair): Fragments a molecule pair into cores and sidechains.

fragment(molecule_pair)[source]

Fragments a molecule pair into cores and sidechains.

Args:

molecule_pair: A pair of molecules to be fragmented.

Returns:

Tuple[List[Chem.Mol], List[Chem.Mol]]: Two lists containing the cores and sidechains of the fragmented molecules.

merge(molecule_pair)[source]

Merges the fragments of a molecule pair.

Args:

molecule_pair: A pair of molecules to be merged.

Returns:

List[str]: A list of SMILES strings representing the merged molecules.