NAME
HackaMol::X::Vina - HackaMol extension for running Autodock Vina
VERSION
version 0.00_6
SYNOPSIS
use Modern::Perl;
use HackaMol;
use HackaMol::X::Vina;
use Math::Vector::Real;
my $receptor = "receptor.pdbqt";
my $ligand = "lig.pdbqt",
my $rmol = HackaMol -> new( hush_read=>1 ) -> read_file_mol( $receptor );
my $lmol = HackaMol -> new( hush_read=>1 ) -> read_file_mol( $ligand );
my $fh = $lmol->print_pdb("lig_out.pdb");
my @centers = map {$_ -> xyz}
grep {$_ -> name eq "OH" }
grep {$_ -> resname eq "TYR"} $rmol -> all_atoms;
foreach my $center ( @centers ){
my $vina = HackaMol::X::Vina -> new(
receptor => $receptor,
ligand => $ligand,
center => $center,
size => V( 20, 20, 20 ),
cpu => 4,
exhaustiveness => 12,
exe => '~/bin/vina',
scratch => 'tmp',
);
my $mol = $vina->dock_mol(3); # fill mol with 3 binding configurations
printf ("Score: %6.1f\n", $mol->get_score($_) ) foreach (0 .. $mol->tmax);
$mol->print_pdb_ts([0 .. $mol->tmax], $fh);
}
$_->segid("hgca") foreach $rmol->all_atoms; #for vmd rendering cartoons.. etc
$rmol->print_pdb("receptor.pdb");
DESCRIPTION
HackaMol::X::Vina provides an interface to AutoDock Vina, which is a widely used program for docking small molecules (ligands) into biological molecules (receptors). This class provides methods for writing configuration files and for processing output. The input/output associated with running Vina is pretty simple, but there is still a fair amount of scripting required to apply the program to virtual drug-screens that often involve sets of around 100,000 ligands, several sites (centers) within a given receptor, which may also have multiple configurations. The goal of this interface is to reduce the amount of scripting needed to set up massive drug screens, provide flexibility in analysis/application, and improve control of what is written into files that can quickly accumulate. The synopsis above loops the docking over centers determined with a chain of grep and map functions. Loops over ligands, receptors, centers are straightforward to implement, see examples (coming soon).
This class does not include the AutoDock Vina program, which is released under a very permissive Apache license, with few restrictions on commercial or non-commercial use, or on the derivative works, such is this. Follow these instructions to acquire the program. Most importantly, if you use this interface effectively, please be sure to cite AutoDock Vina in your work:
O. Trott, A. J. Olson, AutoDock Vina: improving the speed and accuracy of docking with a new scoring function, efficient optimization and multithreading, Journal of Computational Chemistry 31 (2010) 455-461
Since HackaMol has no pdbqt writing capabilities (yet, HackaMol can read pdbqt files; hush_read=>1 recommended, see synopsis), the user is required to provide those files. OpenBabel and MGLTools are popular and effective. This is still a work in progress and the API may change. Documentation will improve as API gets more stable... comments/contributions welcome! The automated testing reported on metacpan will likely give a bunch of fails until I have time to figure out how to skip tests calling on the vina program to run.
METHODS
write_input
This method takes no arguments; it returns, as a scalar, the input constructed from attributes. This method is called by map_input method via the map_in attribute to write the configuration file for running Vina.
map_input
provided by HackaMol::X::ExtensionRole. Writes the configuration file for Vina. See dock and dock_mol methods.
map_output
provided by HackaMol::X::ExtensionRole. By default, this method returns the docking scores as an array.
dock_mol
this method takes the number of binding modes (Integer) as an argument (Int). The argument is optional, and the num_modes attribute is rewritten if passed. This method calls the map_input and map_output methods for preparing and running Vina. It loads the resulting pdbqt and scores into a HackaMol::Molecule object. The scores are stored into the score attribute provided by the HackaMol::QmMolRole. See the synopsis for an example.
dock
this method is similar to dock_mol, but returns only the scores.
ATTRIBUTES
mol
isa HackaMol::Molecule object that is 'ro' and provided by HackaMol::X::ExtensionRole.
map_in map_out
these attributes are 'ro' CodeRefs that can be adjusted in a given instance of a class. These are provided by HackaMol::X::ExtensionRole. Setting the map_in and map_out attributes are for advanced use. Defaults are provided that are used in the map_input and map_output methods.
receptor ligand
these attributes are 'rw' and coerced into Path::Tiny objects using the AbsPath type provided by MooseX::Types::Path::Tiny. Thus, setting the receptor or ligand attributes with a string will store the entire path to the file, which is provided to Vina via the input configuration file. The receptor and ligand attributes typically point to pdbqt files used for running the docking calculations.
save_mol
this attribute isa 'Bool' that is 'rw'.
center
this attribute isa Math::Vector::Real object that is 'rw'. This attribute comes with a trigger that writes the center_x, center_y, and center_z attributes that are used in Vina configuration files.
center_x center_y center_z
this attribute isa Num that is 'rw'. These attributes provide the center for the box that (with size_x, size_y, size_z) define the docking space searched by Vina. Using the center attribute may be more convenient since it has the same type as the coordinates in atoms. See the synopsis.
size_x size_y size_z
this attribute isa Num that is 'rw'. These attributes provide the edgelengths of the the box that (with center_x, center_y, center_z) define the docking space searched by Vina.
num_modes
this attribute isa Int that is 'rw'. It provides the requested number of binding modes (ligand configurations) for Vina via the configuration file. Vina may return a smaller number of configurations depending on energy_range or other factors (that need documentation).
energy_range
this attribute isa Int that is 'rw'. In kcal/mol, provides a window for the number of configurations to return.
exhaustiveness
this attribute isa Int that is 'rw'. The higher the number the more time Vina will take looking for optimal docking configurations.
cpu
this attribute isa Int that is 'rw'. By default Vina will try to use all the cores available. Setting this attribute will limit the number of cores used by Vina.
scratch
this attribute isa Path::Tiny that is 'ro' and provided by HackaMol::PathRole. Setting this attribute return a Path::Tiny object with absolute path that will be created if needed and then used for all Vina calculations to be run.
in_fn
this attribute isa Path::Tiny that is 'rw' and provided by HackaMol::PathRole. The default is set to conf.txt when the object is built using the new method. If many instances of Vina will be running at the same time in the same directory, this conf.txt will need to be unique for each one!!! The same applies to out_fn which is described next.
out_fn
this attribute isa Path::Tiny that is 'rw' and provided by HackaMol::PathRole. The default is set to a value derived from the the basename of the ligand attribute. i.e. out_fn is set to lig_out.pdbqt from /some/big/path/lig.pdbqt. The Vina default behavior is to write to /some/big/path/lig_out.pdbqt, is usually not wanted (by me anyway); thus, the default is always set and written to the configuration file. If many instances of Vina will be running at the same time in the same directory, the output will need to be unique for each one as described above.
SEE ALSO
EXTENDS
CONSUMES
AUTHOR
Demian Riccardi <demianriccardi@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Demian Riccardi.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.