NAME

HackaMol - HackaMol: Object-Oriented Library for Molecular Hacking

VERSION

version 0.015

SYNOPSIS

use HackaMol;
use Math::Vector::Real;

my $hack = HackaMol->new( name => "hackitup" );

# all coordinates from NMR ensemble are loaded into atoms
my $mol  = $hack->read_file_mol("1L2Y.pdb");

#recenter all coordinates to center of mass
foreach my $t ( 0 .. $mol->tmax) {
    $mol->t($t);
    $mol->translate( -$mol->COM );
}

#create array of CA atoms with full occupancy

my @CAs = grep {
                 $_->name    eq 'CA'  and
                 $_->occ == 1
               } $mol->all_atoms;

#print out the pdb with CA for several models from the NMR
HackaMol::Molecule->new(
                         atoms=>[@CAs]
                       )-> print_pdb_ts([8,2,4,6,8,0], 'some.pdb');

# print coordinates to trp-cage.xyz and return filehandle for future
# writing
my $fh = $mol->print_xyz( $mol->name . ".xyz" );
foreach ( 1 .. 10 ) {
    $mol->rotate(
        V( 0, 0, 1 ),    # rotation vector
        36,              # rotate by 36 degrees
        V( 5, 0, 0 )     # origin of rotation
    );
    $mol->print_xyz($fh);
}

# translate/rotate method is provided by AtomGroupRole
# populate groups byatom resid attr
my @groups = $hack->group_by_atom_attr( 'resid', $mol->all_atoms );
$mol->push_groups(@groups);

foreach my $ang ( 1 .. 10 ) {
    $_->rotate( V( 1, 1, 1 ), 36, $_->COM ) foreach $mol->all_groups;
    $mol->print_xyz($fh);
}

DESCRIPTION

The HackaMol library simplifies powerful scripting of multiscale molecular modeling and analysis. HackaMol seeks to provide intuitive attributes and methods that may be harnessed to coerce molecular computation through a common core. The library is inspired by PerlMol, BioPerl, MMTSB, and our own experiences as researchers.

The library is organized into two regions: HackaMol, the core (contained here) that has classes for atoms and molecules, and HackaMol::X, the extensions, such as HackaMol::X::Vina (an interface to Autodock Vina) or HackaMol::X::Calculator, a more general abstract calculator for interfacing external programs. The three major goals of the core are for it to be well-tested, well-documented, and easy to install. The goal of the extensions is to provide a more flexible space for researchers to develop and share new methods that use the core.

HackaMol uses Math::Vector::Real (MVR) for all the vector operations. The methods of MVR overlap very well with those needed for working with atoms and coarse grained molecules. MVR is a lightweight solution with an XS drop-in that makes vector analyses very fast. Extensions that treat much larger systems will definitely benefit from the capabilities of PDL.

The HackaMol class (loaded in Synopsis) uses the core classes to provide some object building utilities described below. This class consumes HackaMol::MolReadRole to provide structure readers for xyz and pdb coordinates. See Open Babel if other formats needed (All suggestions, contributions welcome!).

METHODS

build_bonds

takes a list of atoms and returns a list of bonds. The bonds are generated for "list neighbors" by simply stepping through the atom list one at a time. e.g.

my @bonds = $hack->build_bonds(@atoms[1,3,5]);

will return two bonds: B13 and B35

build_angles

takes a list of atoms and returns a list of angles. The angles are generated analagously to build_bonds, e.g.

my @angles = $hack->build_angles(@atoms[1,3,5]);

will return one angle: A135

build_dihedrals

takes a list of atoms and returns a list of dihedrals. The dihedrals are generated analagously to build_bonds, e.g.

my @dihedral = $hack->build_dihedrals(@atoms[1,3,5]);

will croak! you need atleast four atoms.

my @dihedral = $hack->build_dihedrals(@atoms[1,3,5,6,9]);

will return two dihedrals: D1356 and D3569

group_by_atom_attr

takes atom attribute and a list of atoms as arguments and builds AtomGroup objects by attribute. Grouping by graphical searches are needed!

find_bonds_brute

takes hash argument list and returns bonds. Find bonds between bond_atoms and the candidates.

my @oxy_bonds = $hack->find_bonds_brute(
                                  bond_atoms => [$hg],
                                  candidates => [$mol->all_atoms],
                                  fudge      => 0.45,
                                  max_bonds  => 6,
);

fudge is optional with Default is 0.45 (open babel uses same default); max_bonds is optional with default of 99. max_bonds is compared against the atom bond count, which are incremented during the search. Before returning the bonds, the bond_count are returned the values before the search. For now, molecules are responsible for setting the number of bonds in atoms. find_bonds_brute uses a bruteforce algorithm that tests the interatomic separation against the sum of the covalent radii + fudge. It will not test for bond between atoms if either atom has >= max_bonds. It does not return a self bond for an atom ( next if refaddr($ati) == refaddr($atj) ).

find_disulfide_bonds

takes a list of atoms and returns the disulfide bonds as bond objects.

ATTRIBUTES

name

name is a rw str provided by HackaMol::NameRole.

SEE ALSO

EXTENDS

CONSUMES

AUTHOR

Demian Riccardi <demianriccardi@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 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.