tag fourth (and hopefully last) alpha
[bioperl-live.git] / branch-1-6 / examples / structure / structure-io.pl
blob4fc3e317ee162a8c8e9b8f22b40d6b2d1ae5d07e
1 #!/bin/perl -w
2 # Getting Entry, Chain, Residue, and Atom objects given a PDB file
4 use Bio::Structure::IO;
5 use strict;
7 my $file = shift or die "No PDB file\n";
8 my $structio = Bio::Structure::IO->new(-file => $file);
9 my $struc = $structio->next_structure;
11 for my $chain ($struc->get_chains) {
12 my $chainid = $chain->id;
13 # one-letter chaincode if present, 'default' otherwise
14 for my $res ($struc->get_residues($chain)) {
15 my $resid = $res->id;
16 # format is 3-lettercode - dash - residue number, e.g. PHE-20
17 my $atoms = $struc->get_atoms($res);
18 # actually a list of atom objects, used here to get a count
19 print join "\t", $chainid,$resid,$atoms,"\n";