HackaMol::MolReadRole - Read files with molecular information
version 0.011
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!
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.
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
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.
takes the name of the file as input, parses the xyz file to return the list of built Atom objects.
isa Bool that is lazy. $hack->hush_read(1) will quiet some warnings that may be ignored under some instances.
HackaMol
Protein Data Bank
Demian Riccardi <demianriccardi@gmail.com>
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.
To install HackaMol, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HackaMol
CPAN shell
perl -MCPAN -e shell install HackaMol
For more information on module installation, please visit the detailed CPAN module installation guide.