NAME
Chemistry::File::PDB - Protein Data Bank file format reader/writer
SYNOPSIS
use Chemistry::File::PDB;
# read a PDB file
my $macro_mol = Chemistry::MacroMol->read("myfile.pdb");
# write a PDB file
$macro_mol->write("out.pdb");
# read all models in a multi-model file
my @mols = Chemistry::MacroMol->read("models.pdb");
# read one model at a time
my $file = Chemistry::MacroMol->file("models.pdb");
$file->open;
while (my $mol = $file->read_mol($file->fh)) {
# do something with $mol
}
DESCRIPTION
This module reads and writes PDB files. The PDB file format is commonly used to describe proteins, particularly those stored in the Protein Data Bank (http://www.rcsb.org/pdb/). The current version of this module only reads the following record types, ignoring everything else:
ATOM
HETATM
ENDMDL
END
This module automatically registers the 'pdb' format with Chemistry::Mol, so that PDB files may be identified and read by Chemistry::Mol->read(). For autodetection purpuses, it assumes that files ending in .pdb or having a line matching /^(ATOM |HETATM)/ are PDB files.
The PDB reader and writer is designed for dealing with Chemistry::MacroMol objects, but it can also create and use Chemistry::Mol objects by throwing some information away.
Properties
When reading and writing files, this module stores or gets some of the information in the following places:
- $domain->type
-
The residue type, such as "ARG".
- $domain->name
-
The type and sequence number, such as "ARG114".
- $domain->attr("pdb/sequence_number")
-
The residue sequence number as given in the PDB file.
- $domain->attr("pdb/chain_id")
-
The chain to which this residue belongs (one character).
- $domain->attr("pdb/insertion_code")
-
The residue insertion code (see the PDB specification for details).
- $atom->name
-
The PDB atom name, such as "CA".
- $atom->attr("pdb/residue_name")
-
The name of the residue, as discussed above.
- $atom->attr("pdb/serial_number")
-
The serial number for the atom, as given in the PDB file.
If some of this information is not available when writing a PDB file, this module tries to make it up (by counting the atoms or residues, for example). The default residue name for writing is UNK (unknown). Atom names are just the atomic symbols.
Multi-model files
If a PDB file has multiple models (separated by END or ENDMDL records), each call to read_mol will return one model.
Output features
On writing Chemistry::Mol objects, which don't have macromolecule information and usually don't have atom names, the atom names are made up by concatenating the atomic symbol with a unique ID (up to 1296 atoms are possible). The ID can be disabled by setting the option 'noid':
$mol->write("out.pdb", noid => 1);
The molecule's name is written as a HEADER record; A REMARK record is added listing the version of Chemistry::File::PDB that was used.
VERSION
0.23
SEE ALSO
Chemistry::MacroMol, Chemistry::Mol, Chemistry::File, http://www.perlmol.org/.
The PDB format description at http://www.rcsb.org/pdb/docs/format/pdbguide2.2/guide2.2_frame.html
There is another PDB reader in Perl, as part of the BioPerl project: Bio::Structure::IO::pdb.
AUTHOR
Ivan Tubert-Brohman <itub@cpan.org>
COPYRIGHT
Copyright (c) 2009 Ivan Tubert-Brohman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.