2 # Getting Entry, Chain, Residue, and Atom objects given a PDB file
4 use Bio
::Structure
::IO
;
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)) {
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";