1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 14);
12 use_ok('Bio::Structure::IO');
16 # test reading PDB format - single model, single chain
18 my $pdb_file = test_input_file('1BPT.pdb');
19 ok my $structin = Bio::Structure::IO->new(-file => $pdb_file,
21 ok my $struc = $structin->next_structure;
22 isa_ok $struc, "Bio::Structure::Entry";
24 # some basic checks, Structure objects are tested in Structure.t
25 my ($chain) = $struc->chain;
26 is($struc->residue, 97);
27 my ($atom) = $struc->get_atom_by_serial(367);
29 is($struc->parent($atom)->id, "LYS-46");
30 my ($ann) = $struc->annotation->get_Annotations("author");
32 "Value: D.HOUSSET,A.WLODAWER,F.TAO,J.FUCHS,C.WOODWARD ");
33 ($ann) = $struc->annotation->get_Annotations("header");
35 "Value: PROTEINASE INHIBITOR (TRYPSIN) 11-DEC-91 1BPT");
36 my $pseq = $struc->seqres;
37 is($pseq->subseq(1,20), "RPDFCLEPPYTGPCKARIIR");
40 # test reading PDB format - single model, multiple chains
42 $pdb_file = test_input_file('1A3I.pdb');
43 $structin = Bio::Structure::IO->new(-file => $pdb_file,
45 $struc = $structin->next_structure;
47 my ($chaincount,$rescount,$atomcount);
48 for my $chain ($struc->get_chains) {
50 for my $res ($struc->get_residues($chain)) {
52 for my $atom ($struc->get_atoms($res)) {
58 is($chaincount, 4); # 3 polypeptides and a group of hetero-atoms
59 is($rescount, 60); # amino acid residues and solvent molecules
60 is($atomcount, 171); # ATOM and HETATM
63 # test reading PDB format - multiple models, single chain
65 #$pdb_file = test_input_file('1A11.pdb');
69 # test reading PDB format - chains with ATOMs plus HETATMs
71 #$pdb_file = test_input_file('8HVP.pdb');
75 # test writing PDB format
77 my $out_file = test_output_file();
78 my $structout = Bio::Structure::IO->new(-file => ">$out_file",
80 $structout->write_structure($struc);