2 ## Bioperl Test Harness Script for Modules
5 # Before `make install' is performed this script should be runnable with
6 # `make test'. After `make install' it should work as `perl test.t'
11 # to handle systems with no installed Test module
12 # we include the t dir (where a copy of Test.pm is located)
14 eval { require Test; };
22 use Bio::Structure::Entry;
23 use Bio::Structure::IO;
27 # test reading PDB format - single model, single chain
29 my $pdb_file = Bio::Root::IO->catfile("t","data","1BPT.pdb");
30 my $structin = Bio::Structure::IO->new(-file => $pdb_file,
33 my $struc = $structin->next_structure;
35 ok(ref($struc), "Bio::Structure::Entry");
37 # some basic checks, Structure objects are tested in Structure.t
38 my ($chain) = $struc->chain;
39 ok($struc->residue, 97);
40 my ($atom) = $struc->get_atom_by_serial(367);
42 ok($struc->parent($atom)->id, "LYS-46");
43 my ($ann) = $struc->annotation->get_Annotations("author");
45 "Value: D.HOUSSET,A.WLODAWER,F.TAO,J.FUCHS,C.WOODWARD ");
46 ($ann) = $struc->annotation->get_Annotations("header");
48 "Value: PROTEINASE INHIBITOR (TRYPSIN) 11-DEC-91 1BPT");
49 my $pseq = $struc->seqres;
50 ok($pseq->subseq(1,20), "RPDFCLEPPYTGPCKARIIR");
53 # test reading PDB format - single model, multiple chains
55 $pdb_file = Bio::Root::IO->catfile("t","data","1A3I.pdb");
56 $structin = Bio::Structure::IO->new(-file => $pdb_file,
58 $struc = $structin->next_structure;
60 my ($chaincount,$rescount,$atomcount);
61 for my $chain ($struc->get_chains) {
63 for my $res ($struc->get_residues($chain)) {
65 for my $atom ($struc->get_atoms($res)) {
71 ok($chaincount, 4); # 3 polypeptides and a group of hetero-atoms
72 ok($rescount, 60); # amino acid residues and solvent molecules
73 ok($atomcount, 171); # ATOM and HETATM
76 # test reading PDB format - multiple models, single chain
78 $pdb_file = Bio::Root::IO->catfile("t","data","1A11.pdb");
81 # test reading PDB format - chains with ATOMs plus HETATMs
83 $pdb_file = Bio::Root::IO->catfile("t","data","8HVP.pdb");
86 # test writing PDB format
88 my $out_file = Bio::Root::IO->catfile("t","data","temp-pdb1bpt.ent");
89 my $structout = Bio::Structure::IO->new(-file => ">$out_file",
91 $structout->write_structure($struc);
95 unlink $out_file if -e $out_file;