The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HackaMol::MolReadRole - Read files with molecular information

VERSION

version 0.00_19

SYNOPSIS

   use HackaMol;

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

   # build array of carbon atoms from pdb [xyz,pdbqt] file
   my @carbons  = grep {
                        $_->symbol eq "C"
                       } $hack->read_file_atoms("t/lib/1L2Y.pdb"); 

   my $Cmol     = HackaMol::Molecule->new(
                        name => "carbonprotein", 
                        atoms => [ @carbons ]
                  );

   $Cmol->print_pdb;   
   $Cmol->print_xyz;     

   # build molecule from xyz [pdb,pdbqt] file
   my $mol    = $hack->read_file_mol("some.xyz");
   $mol->print_pdb; # not so easy from xyz to pdb! 

DESCRIPTION

The HackaMol::MolReadRole role provided methods for reading common structural files. Currently, pdb and xyz are provided in the core, but others will be likely added.

METHODS

read_file_atoms

takes the name of the file as input, parses the file, builds Atom objects, and returns them. Matches the filename extension and calls on either read_pdb_atoms or read_xyz_atoms

read_pdb_atoms

takes the name of the file as input, parses the pdb file to return the list of built Atom objects. This is a barebones parser. A more advanced PDB parser will be released soon as an extension.

According to the PDB specification, the element symbol should be present in columns 77-78. The element is often ommitted by programs, such as charmm, that can write pdbs because it makes the file larger, and the information is accessible somewhere else. Unfortunately, other programs require the information. HackaMol::MolReadRole, loads a hash (KNOWN_NAMES) from HackaMol::PeriodicTable that maps common names to the element (e.g. POT => 'K'). read_pdb_atoms will carp if the name is not in the hash, and then set the element to the first letter of the name. This will be improved when HackaMol::PeriodicTable is improved. See TODO.

read_xyz_atoms

takes the name of the file as input, parses the xyz file to return the list of built Atom objects.

ATTRIBUTES

hush_read

isa Bool that is lazy. $hack->hush_read(1) will quiet some warnings that may be ignored under some instances.

SEE ALSO

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.