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
|
# -*-Perl-*-
## Bioperl Test Harness Script for Modules
## $Id: Swiss.t,v 1.3 2003/11/28 09:55:17 heikki 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 = 0;
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 => 5;
}
# REQUIREMENTS:
# handle SP fuzzies (eg ?s)
# handle OX lines
if( $error == 1 ) {
exit(0);
}
END {
unlink(qw (swiss_unk.dat));
}
use Bio::SeqIO;
use Bio::Root::IO;
my $verbose = $ENV{'BIOPERLDEBUG'};
ok(1);
my $seqio =
new Bio::SeqIO( -verbose => $verbose,
-format => 'swiss',
-file => Bio::Root::IO->catfile('t','data',
'test.swiss'));
ok($seqio);
my $seq = $seqio->next_seq;
my @gns = $seq->annotation->get_Annotations('gene_name');
$seqio =
new Bio::SeqIO( -verbose => $verbose,
-format => 'swiss',
-file => Bio::Root::IO->catfile('>test.swiss'));
$seqio->write_seq($seq);
# reads it in once again
$seqio =
new Bio::SeqIO( -verbose => $verbose,
-format => 'swiss',
-file => Bio::Root::IO->catfile('test.swiss'));
$seq = $seqio->next_seq;
ok($seq->species);
ok($seq->species->ncbi_taxid eq "6239");
my @gns2 = $seq->annotation->get_Annotations('gene_name');
# check gene name is preserved (was losing suffix in worm gene names)
ok($#gns2 == 0 && $gns[0]->value eq $gns2[0]->value);
|