Miscallaneous#

Miscallaneous#

Steps interfacing with various other kinds of software.

class maize.steps.mai.misc.QptunaTrain(parent: Graph | None = None, name: str | None = None, description: str | None = None, fail_ok: bool = False, n_attempts: int = 1, level: int | str | None = None, cleanup_temp: bool = True, resume: bool = False, logfile: Path | None = None, max_cpus: int | None = None, max_gpus: int | None = None, loop: bool | None = None, max_loops: int = -1, initial_status: Status = Status.NOT_READY)[source]

Interface to Qptuna training.

Notes

See the Qptuna repo for installation instructions. For maize to access it, specify the python interpreter and script location (most likely your python environment bin folder).

required_callables: ClassVar[list[str]] = ['qptuna-build']

Requires the ‘qptuna-build’ callable

inp: Input[list[IsomerCollection]]

List of molecules to train the model with

inp_config: Input[Path]

Qptuna model configuration (buildconfig)

out: Output[bool]

Signal emitted for completed training

model: FileParameter[Path]

Merged model output

pool: FileParameter[Path]

File to pool training molecules in

n_train: Parameter[int]

Number of molecules to train with (default = 1000)

class maize.steps.mai.misc.QptunaPredict(parent: Graph | None = None, name: str | None = None, description: str | None = None, fail_ok: bool = False, n_attempts: int = 1, level: int | str | None = None, cleanup_temp: bool = True, resume: bool = False, logfile: Path | None = None, max_cpus: int | None = None, max_gpus: int | None = None, loop: bool | None = None, max_loops: int = -1, initial_status: Status = Status.NOT_READY)[source]

Interface to Qptuna prediction.

Notes

See the Qptuna repo for installation instructions. For maize to access it, specify the python interpreter and script location (most likely your python environment bin folder).

required_callables: ClassVar[list[str]] = ['qptuna-predict']

Requires the ‘qptuna-predict’ callable

inp: Input[list[IsomerCollection]]

List of molecules to predict using the built model

out: Output[list[IsomerCollection]]

List of tagged molecules with predicted values

model: FileParameter[Path]

Merged model output / reading location

uncertainty: Parameter[bool]

Whether to additionally predict uncertainties (not available for all models) (default = False)

class maize.steps.mai.misc.QptunaHyper(parent: Graph | None = None, name: str | None = None, description: str | None = None, fail_ok: bool = False, n_attempts: int = 1, level: int | str | None = None, cleanup_temp: bool = True, resume: bool = False, logfile: Path | None = None, max_cpus: int | None = None, max_gpus: int | None = None, loop: bool | None = None, max_loops: int = -1, initial_status: Status = Status.NOT_READY)[source]

Interface to Qptuna hyperparameter optimisation.

Notes

See the Qptuna repo for installation instructions. For maize to access it, specify the python interpreter and script location (most likely your python environment bin folder).

required_callables: ClassVar[list[str]] = ['qptuna-optimize']

Requires the ‘qptuna-optimize’ callable

inp: Input[list[IsomerCollection]]

List of molecules to train the model with

out: Output[Path]

Optimised hyperparameter config

configuration: FileParameter[Path]

Qptuna configuration template

model: FileParameter[Path]

Merged model output

pool: FileParameter[Path]

File to pool training molecules in

n_train: Parameter[int]

Number of molecules to optimize with (default = 1000)

class maize.steps.mai.misc.IcolosFEP(parent: Graph | None = None, name: str | None = None, description: str | None = None, fail_ok: bool = False, n_attempts: int = 1, level: int | str | None = None, cleanup_temp: bool = True, resume: bool = False, logfile: Path | None = None, max_cpus: int | None = None, max_gpus: int | None = None, loop: bool | None = None, max_loops: int = -1, initial_status: Status = Status.NOT_READY)[source]

Interface to Icolos scoring functions for molecules.

Notes

See the Icolos repo for installation instructions. For maize to access it, specify the python interpreter and icolos executable location (most likely your python environment bin folder).

required_callables: ClassVar[list[str]] = ['icolos']
scripts

Requires the icolos executable and a suitable python interpreter

environment

Requires the following environment variables to be set:

  • PMX_PYTHON

    Path to the python executable for PMX

  • PMX

    Path to the PMX executable

  • GMXLIB

    Path to the PMX mutff force field

  • ICOLOS_ENTRY

    Path to the icolos_entrypoints PMX script folder

inp: Input[list[IsomerCollection]]

List of molecules to send to Icolos

inp_reference: Input[IsomerCollection]

Reference molecule for the star-map

out: Output[list[IsomerCollection]]

List of molecules with attached scores

target: FileParameter[Path]

Target protein structure

configuration: FileParameter[Path]

Icolos configuration

mdps: FileParameter[Path]

Folder containing mdp files for Gromacs

class maize.steps.mai.misc.Lomap(parent: Graph | None = None, name: str | None = None, description: str | None = None, fail_ok: bool = False, n_attempts: int = 1, level: int | str | None = None, cleanup_temp: bool = True, resume: bool = False, logfile: Path | None = None, max_cpus: int | None = None, max_gpus: int | None = None, loop: bool | None = None, max_loops: int = -1, initial_status: Status = Status.NOT_READY)[source]

Interface to the Lead Optimization MAPper (Lomap) [1].

Notes

Lomap can be installed into a copy of a maize environment from here.

References

required_callables: ClassVar[list[str]] = ['lomap']

scripts Requires the lomap script.

inp: Input[list[Isomer]]

List of molecules to map

inp_reference: Input[Isomer]

Reference molecule for a star-map

out: Output[dict[tuple[str, str], dict[int, int]]]

Edges with potential atom-mappings

class maize.steps.mai.misc.ReInvent(parent: Graph | None = None, name: str | None = None, description: str | None = None, fail_ok: bool = False, n_attempts: int = 1, level: int | str | None = None, cleanup_temp: bool = True, resume: bool = False, logfile: Path | None = None, max_cpus: int | None = None, max_gpus: int | None = None, loop: bool | None = None, max_loops: int = -1, initial_status: Status = Status.NOT_READY)[source]

Runs REINVENT in a staged learning context.

This node works by starting a REINVENT process with a special ‘intercepting’ external process to score the sampled SMILES. This interceptor simply accepts the SMILES on standard input and writes them to a location known by the node. The node then reads these SMILES and sends them to the output. The node then waits for scores to be received on the input, and writes them to a location known by the interceptor. The interceptor waits for the scores to be written and then reads them in to pass them to REINVENT on standard output. REINVENT can then perform its likelihood update and the cycle repeats until REINVENT exits or the maximum number of iterations is reached.

required_callables: ClassVar[list[str]] = ['reinvent']

Requires REINVENT to be installed in a separate python environment and ideally be specified as an interpreter - script pair.

inp: Input[ndarray[Any, dtype[float32]]]

Raw score input for the likelihood update

out: Output[list[str]]

SMILES string output

configuration: FileParameter[Path]

ReInvent configuration file

min_epoch: Parameter[int]

Minimum number of epochs to run (default = 5)

max_epoch: Parameter[int]

Minimum number of epochs to run (default = 50)

weight: Parameter[float]

Weight of the maize scoring component (default = 1.0)

low: Parameter[float]

Low threshold for the sigmoid score transformation (default = 0.0)

high: Parameter[float]

High threshold for the sigmoid score transformation (default = 1.0)

k: Parameter[float]

Slope for the sigmoid score transformation (default = 0.5)

reverse: Parameter[bool]

Whether to use a reverse sigmoid score transform (default = False)

batch_size: Parameter[int]

ReInvent batch size (default = 128)

maize_backend: Parameter[bool]

Whether to use a special maize backend in Reinvent to enable weighted scores (default = False)

class maize.steps.mai.misc.ReinventEntry(parent: Graph | None = None, name: str | None = None, description: str | None = None, fail_ok: bool = False, n_attempts: int = 1, level: int | str | None = None, cleanup_temp: bool = True, resume: bool = False, logfile: Path | None = None, max_cpus: int | None = None, max_gpus: int | None = None, loop: bool | None = None, max_loops: int = -1, initial_status: Status = Status.NOT_READY)[source]

Specialized entrypoint for the REINVENT - Maize interface.

Reads a JSON file containing generated SMILES and additional metadata, and outputs this information to be used in more generic workflows.

Examples

 1# REINVENT-Maize interface example
 2#
 3# Usage:
 4# maize flow.yml --smiles input.json --output out.json --receptor path/to/pdbqt --center 3.3 11.5 24.8
 5#
 6# input.json:
 7#
 8# {
 9#     "smiles": ["CCO", "CCF"],
10#     "metadata": {"iteration": 0}
11# }
12
13name: Docking
14level: INFO
15
16nodes:
17- name: smiles
18  type: ReinventEntry
19- name: dock
20  type: Docking
21- name: rnv
22  type: ReinventExit
23
24# ReinventEntry can output optional metadata, if it's not required in can be sent to a Void node
25- name: void
26  type: Void
27
28channels:
29- sending:
30    smiles: out
31  receiving:
32    dock: inp
33- sending:
34    dock: out
35  receiving:
36    rnv: inp
37- sending:
38    smiles: out_metadata
39  receiving:
40    void: inp
41
42parameters:
43- name: smiles
44  map:
45  - smiles: data
46- name: receptor
47  map:
48  - dock: receptor
49- name: center
50  map:
51  - dock: search_center
52- name: output
53  map:
54  - rnv: data
data: FileParameter[Path]

JSON input from Maize REINVENT scoring component

out: Output[list[str]]

SMILES output

out_metadata: Output[dict[str, Any]]

Any additional metadata passed on by REINVENT

class maize.steps.mai.misc.ReinventExit(parent: Graph | None = None, name: str | None = None, description: str | None = None, fail_ok: bool = False, n_attempts: int = 1, level: int | str | None = None, cleanup_temp: bool = True, resume: bool = False, logfile: Path | None = None, max_cpus: int | None = None, max_gpus: int | None = None, loop: bool | None = None, max_loops: int = -1, initial_status: Status = Status.NOT_READY)[source]

Specialized exitpoint for the REINVENT - Maize interface.

Creates a JSON file containing scores and relevances, which can be read in by the Maize scoring component in REINVENT.

inp: Input[list[IsomerCollection]]

Scored molecule input

data: FileParameter[Path]

JSON output for Maize REINVENT scoring component

maize.steps.mai.misc.expose_reinvent(graph_type: type[Graph]) Callable[[], None][source]

Converts a subgraph with smiles input and score output to a REINVENT-compatible workflow.

The subgraph must have a single input ‘inp’ of type Input[list[str]] and a single output ‘out’ of type Output[NDArray[np.float32]].

Parameters:

graph_type – The subgraph to convert

Returns:

Runnable workflow

Return type:

Callable[[], None]