[Bioperl-l] pdb files/structure system

Douglas Kojetin djkojeti at unity.ncsu.edu
Mon Oct 4 15:49:12 EDT 2004


Sorry for the delayed response on this, but many thanks for sending  
this example.

I am seeing an error I believe is associated with the 'format' of my  
PDB.  It was created using CNS (format similar to XPLOR).  When I try  
to run the below script, I get an error as follows:

% ./read_pdb.pl > out

------------- EXCEPTION  -------------
MSG: PDB stream with no HEADER. Not pdb in my book
STACK Bio::Structure::IO::pdb::next_structure  
/sw/lib/perl5/Bio/Structure/IO/pdb.pm:138
STACK toplevel ./read_pdb.pl:6

--------------------------------------

1. Are CNS or XPLOR formats supported?
2. Is there an easy way of quickly converting to a 'PDB' authentic  
format?  It looks like it just wants some header information.

Thanks,
Doug


On Jul 28, 2004, at 6:15 PM, Jurgen Pletinckx wrote:

> | 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_file 
> s
> | _(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
> Bio::Structure::Residue
> 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.
> PHE-20
>
>                 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
> reticent
> to enshrine the current sad state of affairs by describing the  
> workarounds
> :/
>
> --
> Jurgen Pletinckx	AlgoNomics NV
> jurgen.pletinckx at algonomics.com
>
>



More information about the Bioperl-l mailing list