biotite.application.autodock.VinaApp

class biotite.application.autodock.VinaApp(ligand, receptor, center, size, flexible=None, bin_path='vina')[source]

Bases: LocalApp

Dock a ligand to a receptor molecule using AutoDock Vina.

Parameters
ligandAtomArray

The structure of the receptor molecule. Must have an associated BondList. An associated charge annotation is recommended for proper calculation of partial charges.

receptorAtomArray, shape=(n,)

The structure of the receptor molecule. Must have an associated BondList. An associated charge annotation is recommended for proper calculation of partial charges.

centerndarray, shape=(3,), dtype=float

The xyz coordinates for the center of the search space.

sizendarray, shape=(3,), dtype=float

The size of the search space in xyz directions.

flexiblendarray, shape=(n,), dtype=bool, optional

A boolean mask that indicates flexible amino acid side chains in receptor. Each residue, where at least one atom index is True in flexible, is considered flexible. By default, the receptor has no flexibility.

bin_pathstr, optional

Path to the Vina binary.

Examples

>>> # A dummy receptor and ligand
>>> ligand = residue("ASP")
>>> receptor = atom_array
>>> app = VinaApp(
...     ligand, receptor,
...     # Binding pocket is in the center of the receptor
...     center=centroid(receptor),
...     # 20 Å x 20 Å x 20 Å search space
...     size=[20, 20, 20],
...     # Handle residues 2 and 5 as flexible
...     flexible=(receptor.res_id == 2) | (receptor.res_id == 5)
... )
add_additional_options(options)

Add additional options for the command line program. These options are put before the arguments automatically determined by the respective LocalApp subclass.

This method is focused on advanced users, who have knowledge on the available options of the command line program and the options already used by the LocalApp subclasses. Ignoring the already used options may result in conflicting CLI arguments and potential unexpected results. It is recommended to use this method only, when the respective LocalApp subclass does not provide a method to set the desired option.

Parameters
optionslist of str

A list of strings representing the command line options.

Notes

In order to see which options the command line execution used, try the get_command() method.

Examples

>>> seq1 = ProteinSequence("BIQTITE")
>>> seq2 = ProteinSequence("TITANITE")
>>> seq3 = ProteinSequence("BISMITE")
>>> seq4 = ProteinSequence("IQLITE")
>>> # Run application without additional arguments
>>> app = ClustalOmegaApp([seq1, seq2, seq3, seq4])
>>> app.start()
>>> app.join()
>>> print(app.get_command())
clustalo --in ...fa --out ...fa --force --output-order=tree-order --seqtype Protein --guidetree-out ...tree
>>> # Run application with additional argument
>>> app = ClustalOmegaApp([seq1, seq2, seq3, seq4])
>>> app.add_additional_options(["--full"])
>>> app.start()
>>> app.join()
>>> print(app.get_command())
clustalo --full --in ...fa --out ...fa --force --output-order=tree-order --seqtype Protein --guidetree-out ...tree
cancel()

Cancel the application when in RUNNING or FINISHED state.

clean_up()

Do clean up work after the application terminates.

PROTECTED: Optionally override when inheriting.

static dock(ligand, receptor, center, size, flexible=None, bin_path='vina')

Dock a ligand to a receptor molecule using AutoDock Vina.

This is a convenience function, that wraps the VinaApp execution.

Parameters
ligandAtomArray

The structure of the receptor molecule. Must have an associated BondList. An associated charge annotation is recommended for proper calculation of partial charges.

receptorAtomArray, shape=(n,)

The structure of the receptor molecule. Must have an associated BondList. An associated charge annotation is recommended for proper calculation of partial charges.

centerndarray, shape=(3,), dtype=float

The xyz coordinates for the center of the search space.

sizendarray, shape=(3,), dtype=float

The size of the search space in xyz directions.

flexiblendarray, shape=(n,), dtype=bool, optional

A boolean mask that indicates flexible amino acid side chains in receptor. Each residue, where at least one atom index is True in flexible, is considered flexible. By default, the receptor has no flexibility.

bin_pathstr, optional

Path to the Vina binary.

Returns
coordndarray, shape=(m,n,3), dtype=float

The docked ligand coordinates for m binding modes and n atoms of the input ligand. The models are sorted from best to worst predicted binding affinity. Missing coordinates due to the removed nonpolar hydrogen atoms are set to NaN.

energiesndarray, shape=(m,), dtype=float

The corresponding predicted binding energies (kcal/mol).

evaluate()

Evaluate application results. Called in join().

PROTECTED: Override when inheriting.

get_app_state()

Get the current app state.

Returns
app_stateAppState

The current app state.

get_command()

Get the executed command.

Cannot be called until the application has been started.

Returns
commandstr

The executed command.

Examples

>>> seq1 = ProteinSequence("BIQTITE")
>>> seq2 = ProteinSequence("TITANITE")
>>> seq3 = ProteinSequence("BISMITE")
>>> seq4 = ProteinSequence("IQLITE")
>>> app = ClustalOmegaApp([seq1, seq2, seq3, seq4])
>>> app.start()
>>> print(app.get_command())
clustalo --in ...fa --out ...fa --force --output-order=tree-order --seqtype Protein --guidetree-out ...tree
get_energies()

Get the predicted binding energy for each generated binding mode.

Returns
energiesndarray, dtype=float

The predicted binding energies (kcal/mol). The energies are sorted from best to worst.

get_exit_code()

Get the exit code of the process.

PROTECTED: Do not call from outside.

Returns
codeint

The exit code.

get_flexible_residue_models()

Get the structure for the flexible side chains with the conformations for each generated binding mode.

If no flexible side chains were defined, the returned AtomArrayStack contains no atoms.

Returns
side_chainsAtomArrayStack

The docked side chains. Each model corresponds to one binding mode. The models are sorted from best to worst predicted binding affinity.

Notes

The returned structure may contain less atoms than the input structure, as Vina removes nonpolar hydrogen atoms. Furthermore, the returned structure contains AutoDock atom types as element annotation.

get_ligand_coord()

Get the ligand coordinates for each generated binding mode.

Returns
coordndarray, shape=(m,n,3), dtype=float

The coordinates for m binding modes and n atoms of the input ligand. The models are sorted from best to worst predicted binding affinity. Missing coordinates due to the removed nonpolar hydrogen atoms are set to NaN.

get_ligand_models()

Get the ligand structure with the conformations for each generated binding mode.

Returns
ligandAtomArrayStack

The docked ligand. Each model corresponds to one binding mode. The models are sorted from best to worst predicted binding affinity.

Notes

The returned structure may contain less atoms than the input structure, as Vina removes nonpolar hydrogen atoms. Furthermore, the returned structure contains AutoDock atom types as element annotation.

get_process()

Get the Popen instance.

PROTECTED: Do not call from outside.

Returns
processPopen

The Popen instance

get_receptor_coord()

Get the get_receptor_coord coordinates for each generated binding mode.

Returns
coordndarray, shape=(m,n,3), dtype=float

The coordinates for m binding modes and n atoms of the input receptor. The models are sorted from best to worst predicted binding affinity. Missing coordinates due to the removed nonpolar hydrogen atoms from flexible side chains are set to NaN.

Notes

The output is only meaningful, if flexible side chains were defined. Otherwise, the returned coordinates are simply m repetitions of the input receptor coordinates.

get_stderr()

Get the STDERR pipe content of the process.

PROTECTED: Do not call from outside.

Returns
stdoutstr

The standard error.

get_stdout()

Get the STDOUT pipe content of the process.

PROTECTED: Do not call from outside.

Returns
stdoutstr

The standard output.

is_finished()

Check if the application has finished.

PROTECTED: Override when inheriting.

Returns
finishedbool

True of the application has finished, false otherwise

join(timeout=None)

Conclude the application run and set its state to JOINED. This can only be done from the RUNNING or FINISHED state.

If the application is FINISHED the joining process happens immediately, if otherwise the application is RUNNING, this method waits until the application is FINISHED.

Parameters
timeoutfloat, optional

If this parameter is specified, the Application only waits for finishing until this value (in seconds) runs out. After this time is exceeded a TimeoutError is raised and the application is cancelled.

Raises
TimeoutError

If the joining process exceeds the timeout value.

run()

Commence the application run. Called in start().

PROTECTED: Override when inheriting.

set_arguments(arguments)

Set command line arguments for the application run.

PROTECTED: Do not call from outside.

Parameters
argumentslist of str

A list of strings representing the command line options.

set_energy_range(energy_range)

Set the maximum energy range of the generated models.

Vina will ignore binding modes if the difference between this mode and the best mode is greater than this value. By default, the range is 3.0.

Parameters
numberfloat

The energy range (kcal/mol).

set_exec_dir(exec_dir)

Set the directory where the application should be executed. If not set, it will be executed in the working directory at the time the application was created.

PROTECTED: Do not call from outside.

Parameters
exec_dirstr

The execution directory.

set_exhaustiveness(exhaustiveness)

Set the exhaustiveness parameter for Vina.

A higher exhaustiveness may lead to better docking results, but also increases the computation time. By default, the exhaustiveness is 8.

Parameters
exhaustivenessint

The value for the exhaustiveness parameter. Must be greater than 0.

set_max_number_of_models(number)

Set the maximum number of binding modes to generate.

Vina may generate less modes, if the docking process does not find enough distinct conformations. By default, the maximum number is 9.

Parameters
numberint

The maximum number of generated modes/models.

set_seed(seed)

Fix the seed for the random number generator to get reproducible results.

By default, the seed is chosen randomly.

Parameters
seedint

The seed for the random number generator.

set_stdin(file)

Set a file as standard input for the application run.

PROTECTED: Do not call from outside.

Parameters
filefile object

The file for the standard input. Must have a valid file descriptor, e.g. file-like objects such as StringIO are invalid.

start()

Start the application run and set its state to RUNNING. This can only be done from the CREATED state.

wait_interval()

The time interval of is_finished() calls in the joining process.

PROTECTED: Override when inheriting.

Returns
intervalfloat

Time (in seconds) between calls of is_finished() in join()