[Bioperl-l] pdb files/structure system

Brian Osborne brian_osborne at cognia.com
Thu Jul 29 08:11:18 EDT 2004


I'll put your example into the bptutorial and into a new examples/structure
directory, if you don't mind.

If anyone else has useful example code please post it, I'd be happy to add
it to examples/.

Brian O.

-----Original Message-----
From: bioperl-l-bounces at portal.open-bio.org
[mailto:bioperl-l-bounces at portal.open-bio.org]On Behalf Of Jurgen Pletinckx
Sent: Wednesday, July 28, 2004 6:16 PM
To: Douglas Kojetin; bioperl-l at bioperl.org
Subject: RE: [Bioperl-l] pdb files/structure system

| Can anyone point me towards a tutorial dealing with using Bioperl's
| Structure system?  I'm able to read in a PDB file and print out a
| sequence, but I cannot figure out how to extract atoms or coordinates
| from the one line examples given here:
| http://bioperl.org/Core/Latest/
| bptutorial.html#iii.9.1_using_3d_structure_objects_and_reading_pdb_files
| _(structurei,_structure::io)
| Using that example, I've tried setting $res to a number of things (1,
| MET1, MET-1, MET, etc.), but I think it's look for something more
| sophisticated (i.e. input from another system module)?

Yes. That example is pretty unenlightening. $res is a
object in that line. Here's one way to get at these objects:

#!/usr/bin/perl -w
use Bio::Structure::IO;
use strict;

my $structio = Bio::Structure::IO->new(-file => "/PDB/ca/pdb1cam.ent");
my $struc = $structio->next_structure;

for my $chain ($struc->get_chains)
        my $chainid = $chain->id;
        # one-letter chaincode if present, 'default' otherwise

        for my $res ($struc->get_residues($chain))
                my $resid = $res->id;
                # format is 3-lettercode - dash - residue number, e.g.

                my $atoms = $struc->get_atoms($res);
                # actually a list of atom objects, used here to get a count

                print join "\t", $chainid,$resid,$atoms,"\n";

That kind of loop over all objects is often sufficient for me. When I do
need direct access, I first construct an index:

my %resindex;
my %atindex;

for my $chain ($struc->get_chains)
        for my $res ($struc->get_residues($chain))
                $resindex{$chain->id}{$res->id} = $res;
                for my $atom ($struc->get_atoms($res))
                        $atindex{$chain->id}{$res->id}{$atom->id} = $atom;


print join "\t", $atindex{'default'}{'PHE-20'}{'CA'}->xyz,"\n";

and then use that for lookups. Yet another tool I would like to include into
the Bio::Structure modules. (as get_res_by_name?)

| Is there a HOWTO under development (or in the near future) for the
| Structure system?

There wasn't, actually. Perhaps there should be. I find myself rather
to enshrine the current sad state of affairs by describing the workarounds

Jurgen Pletinckx        AlgoNomics NV
jurgen.pletinckx at algonomics.com

Bioperl-l mailing list
Bioperl-l at portal.open-bio.org

More information about the Bioperl-l mailing list