1 # This is -*-Perl-*- code
2 ## Bioperl Test Harness Script for Modules
6 # Before `make install' is performed this script should be runnable with
7 # `make test'. After `make install' it should work as `perl test.t'
10 use vars qw($NUMTESTS $DEBUG);
11 $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
16 # to handle systems with no installed Test module
17 # we include the t dir (where a copy of Test.pm is located)
19 eval { require Test::More; };
26 plan tests => $NUMTESTS;
27 eval { require IO::String };
29 $error = "IO::String not installed. This means the Bio::DB::* modules are not usable. Skipping some tests.";
32 $error = "BIOPERLDEBUG must be set to 1 for running tests requiring network access. Skipping some tests.";
39 # clean up after oneself
43 ## End of black magic.
45 ## Insert additional test code below but remember to change
46 ## the print "1..x\n" in the BEGIN block to reflect the
47 ## total number of tests that will be run.
49 my ($seq_object,$filename,@seq_object_array);
51 # will guess file format from extension
52 $filename = File::Spec->catfile(qw(t data cysprot1.fa));
53 ok ($seq_object = read_sequence($filename));
54 isa_ok $seq_object, 'Bio::SeqI';
56 # forces genbank format
57 $filename = File::Spec->catfile(qw(t data AF165282.gb));
58 ok ($seq_object = read_sequence($filename,'genbank'));
59 isa_ok $seq_object, 'Bio::SeqI';
61 # reads an array of sequences
62 $filename = File::Spec->catfile(qw(t data amino.fa));
63 is (@seq_object_array = read_all_sequences($filename,'fasta'), 2);
64 isa_ok $seq_object_array[0], 'Bio::SeqI';
65 isa_ok $seq_object_array[1], 'Bio::SeqI';
67 $filename = 'Perltmp';
68 ok write_sequence(">$filename",'genbank',$seq_object);
69 ok ($seq_object = new_sequence("ATTGGTTTGGGGACCCAATTTGTGTGTTATATGTA","myname","AL12232"));
70 isa_ok $seq_object, 'Bio::SeqI';
74 ok ($trans = translate($seq_object));
76 isa_ok $trans, 'Bio::SeqI';
78 ok ($trans = translate("ATTGGTTTGGGGACCCAATTTGTGTGTTATATGTA"));
80 isa_ok $trans, 'Bio::PrimarySeqI';
82 ok ($trans = translate_as_string($seq_object));
84 is $trans, 'IGLGTQFVCYM';
88 ok ($trans = translate_as_string("ATTGGTTTGGGGACCCAATTTGTGTGTTATATGTA"));
90 is $trans, 'IGLGTQFVCYM';
92 # we need to keep tests that depend on net connection at the end
93 # these now run only with BIOPERLDEBUG set
96 skip($error, 10) unless $DEBUG;
101 $seq_object = get_sequence('swissprot',"ROA1_HUMAN");
104 skip("problem connecting to SwissProt:$@",2);
107 isa_ok $seq_object, 'Bio::SeqI';
114 $seq_object = get_sequence('embl',"BUM");
117 skip("problem connecting to EMBL:$@",2);
120 isa_ok $seq_object, 'Bio::SeqI';
127 $seq_object = get_sequence('genbank',"AI129902");
130 skip("problem connecting to GenBank:$@",2);
133 isa_ok $seq_object, 'Bio::SeqI';
140 $seq_object = get_sequence('genbank',"NM_006732");
143 skip("problem connecting to RefSeq:$@",2);
146 isa_ok $seq_object, 'Bio::SeqI';
153 $seq_object = get_sequence('genpept',"AAC06201");
156 skip("problem connecting to RefSeq:$@",2);
159 isa_ok $seq_object, 'Bio::SeqI';