++ed by:
1 non-PAUSE user
Author image Raul Alcantara Aragon
and 1 contributors


Bio::PDB::Structure::Molecule - Perl module for parsing and manipulating Protein Databank (PDB) files


  use Bio::PDB::Structure::Molecule;
  $mol1= Bio::PDB::Structure::Molecule -> new;
  $mol2= Bio::PDB::Structure::Molecule -> new;
  $mol1 -> read("molecule.pdb",0);         #read the first model
  $mol2 -> read("molecule.pdb",1);         #read the second model
  $mol1b = $mol1 -> backbone;              #create a list with the backbone of mol1
  $mol2b = $mol2 -> backbone;              #create a list with the backbone of mol2
  @transform = $mol2b ->superpose($mol1b); #compute alignment of mol2 to mol1
  $mol2 ->rotate_translate(@transform);    #rotate and translate mol2
  $rmsd = $mol2 -> rmsd($mol1);            #compute the rmsd between mol2 and mol1
  $mol2 -> print("new.pdb");               #save the molecule to a file


This module combines tools that are commonly used to analyze proteins and nucleic acids from a pdb file stuctures. main benefits of using the module are its ability to parse and print out a pdb structure with minimum effort. However in addition to that it is possible to do structural alinments, RMSD calculations, atom editons, center of mass calculations, molecule editions and so forth. Both Atom objects and Molecule objects are defined within this module.

Methods for Atom objects

  • $object->type

  • $object->type("ATOM")

    Get/set the atom's type

  • $object->number

  • $object->number(50)

    Get/set the atom's number

  • $object->name

  • $object->name("CA")

    Get/set the atom's name

  • $object->chain

  • $object->chaini("X")

    Get/set the atom's chain

  • $object->chain

  • $object->residue_number(100)

    Get/set the atom's residue number

  • $object->residue_name

  • $object->residue_name("ALA")

    Get/set the atom's residue name

  • $object->x

  • $object->x(5.5)

    Get/set the atom's x coordinate

  • $object->y

  • $object->y(5.5)

    Get/set the atom's y coordinate

  • $object->z

  • $object->z(5.5)

    Get/set the atom's z coordinate

  • $object->occupancy

  • $object->occupancy(1.0)

    Get/set the atom's occupancy

  • $object->beta

  • $object->beta(0.3)

    Get/set the atom's temperature factor

  • $object->alt

  • $object->alt("I")

    Get/set the atom's alternate location field

  • $object->insertion_code

  • $object->insertion_code("K")

    Get/set the atom's insertion code

  • distance Bio::PDB::Structure::Atom($atom1,$atom2)

    Compute the distance between atom1 and atom2

  • distance Bio::PDB::Structure::Atom($atom1,$atom2,$atom3)

    Compute the angle in degrees sustended by atom1--atom2--atom3

  • dihedral Bio::PDB::Structure::Atom($atom1,$atom2,$atom3,$atom4)

    Compute the dihedral in degrees sustended by atom1--atom2--atom3--atom4

Methods for Molecule objects

  • models Bio::PDB::Structure::Molecule "file.pdb"

    Return the number of models in a pdb file

  • $object->read("file.pdb")

  • $object->read("file.pdb",i)

    Read the contents of file.pdb into a molecule. If a second numeric argument is specified it will read model (i+1) from the file (counting from zero).

  • $object->print

  • $object->print("file.pdb")

    Write the molecule to STDOUT when no argument is provided or to a file when an argument is provided.

  • $object->size

    Return the number of atoms contained in the molecule.

  • $object->atom(5)

    Return the atom located at position five (starting from zero).

  • $object->push(atom)

    Push atom object at the end of the molecule.

  • $object->proten

    Return a molecule that only contains atoms with type ATOM

  • $object->hetatoms

    Retruns a molecule that only contains HETATM records

  • $object->alpha

    Returns a molecule with the alpha carbons

  • $object->backbone

    Returns a molecule with the backbone of a protein

  • $object->sidechains

    Returns a molecule with the sidechains of a protein

  • $object->list_atoms('logical expression')

    Creates a molecule with a custom atom selection. The logical expression must use Perls logical operators and the properties of atoms. For example to select all atoms from residue 50 onwards and only belonging to ALA residues on would use the logical expression: 'residue_number >= 50 && residue_name eq "ALA"'

  • $object->center

    Return an atom object that respresents the centroid for the given molecule.

  • $object->cm

    Return an atom object that sits at the center of mass for the given molecule.

  • $object->translate(x,y,z)

    Translate the molecule as a rigid object by x,y,z.

  • $object->rotate(u11,u12,u13,u21,u22,u23,u31,u32,u33)

    Do a rigid rotation of the molecule using matrix u.

  • $object->rotate_translate(@matrix,@vector)

    Apply a rotation matrix followed by a translation. To facilitate structural supperpositions.

  • $object->superpose($reference)

    Find the transformation that overlaps $object on to $reference. The resulting transformation is in the format @transformation= (@matrix,@vector). Molecules must have the same number of atoms.

  • $object->rmsd($reference)

    Compute the RMSD between two molecules. The molecules must have the same number of atoms




Raul Alcantara Aragon, <rulix@hotmail.com>


Copyright (C) 2012 by Raul Alcantara

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.3 or, at your option, any later version of Perl 5 you may have available.