1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
# -*-Perl-*-
## Bioperl Test Harness Script for Modules
## $Id: game.t,v 1.15 2002/01/08 01:46:19 jason Exp $
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.t'
my $error;
use strict;
BEGIN {
# to handle systems with no installed Test module
# we include the t dir (where a copy of Test.pm is located)
# as a fallback
eval { require Test; };
if( $@ ) {
use lib 't';
}
use Test;
plan tests => 9;
$error = 0;
eval { require XML::Parser::PerlSAX; };
if( $@ ) {
print STDERR "XML::Parser::PerlSAX not loaded. This means game test cannot be executed. Skipping\n";
foreach ( 1..9 ) {
skip('XML::Parser::PerlSAX installed',1);
}
$error = 1;
}
# make sure we can load it, assuming that the prerequisites are really met
if( $error == 0 ) {
eval { require Bio::SeqIO::game; };
if( $@ ) {
print STDERR "game.pm not loaded. This means game test cannot be executed. Skipping\n";
foreach ( 1..9 ) {
skip('game.pm not loaded because XML::Writer not loaded',1);
}
$error = 1;
}
}
}
if( $error == 1 ) {
exit(0);
}
use Bio::Seq;
use Bio::SeqIO;
use Bio::SeqIO::MultiFile;
require XML::Parser::PerlSAX;
use vars qw($DEBUG);
use Bio::Root::IO;
my $str = Bio::SeqIO->new('-file'=> Bio::Root::IO->catfile("t","data","test.game"),
'-format' => 'game');
ok ($str);
my $seq = $str->next_primary_seq();
ok($seq);
ok ($seq->display_id(), 'AE003417' );
ok ($seq->id(), 'AE003417' );
my $str2 = Bio::SeqIO->new(-file=> Bio::Root::IO->catfile("t","data","test.game"), '-format' => 'game');
ok ($str2);
$seq = $str2->next_seq();
ok $seq;
$str2->write_seq($seq) if( $DEBUG);
ok ( $seq->id, 'AE003417',
'id was not AE003417 it was ' .$seq->id);
my @feats = $seq->all_SeqFeatures();
ok @feats, 5;
ok( $feats[0]->primary_tag, 'exon',
'primary tag was not exon it was ' . $feats[0]->primary_tag);
|