- SEE ALSO
- COPYRIGHT AND LICENSE
HackaMol::MolReadRole - Read XYZ and PDB files
my $hack = HackaMol->new( name => "hackitup" ); my @atoms1 = $hack->read_file_atoms("t/lib/1L2Y.pdb"); my @atoms2 = $hack->read_file_atoms("t/lib/something.xyz"); my $mol = HackaMol->new( name => "merger", atoms => [@atoms1,@atoms2]); $mol->print_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.
Demian Riccardi <email@example.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.