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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
# -*-Perl-*-
## Bioperl Test Harness Script for Modules
##
# $Id: est2genome.t,v 1.3 2003/05/12 13:58:17 shawnh Exp $
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
$error = 0;
eval { require Test; };
if( $@ ) {
use lib 't';
}
use Test;
use vars qw($TESTCOUNT);
$TESTCOUNT = 60;
plan tests => $TESTCOUNT;
}
use Bio::Tools::Est2Genome;
my $verbose = 0;
my $parser = new Bio::Tools::Est2Genome(-file => Bio::Root::IO->catfile
('t','data', 'hs_est.est2genome'));
ok($parser);
my $feature_set = $parser->parse_next_gene;
ok(ref($feature_set), qr/ARRAY/i );
ok(scalar @$feature_set, 7);
my @exons = grep { $_->primary_tag eq 'Exon' } @$feature_set;
my @introns = grep { $_->primary_tag eq 'Intron' } @$feature_set;
my @expected_exons = ( [695,813,1,1,119,1],
[1377,1493,1,120,236,1],
[1789,1935,1,237,382,1],
[2084,2180,1,383,479,1]);
my @expected_introns = ( [814,1376,1],
[1494,1788,1],
[1936,2083,1] );
foreach my $e ( @exons ) {
my $test_e = shift @expected_exons;
my $i = 0;
ok($e->query->start, $test_e->[$i++]);
ok($e->query->end, $test_e->[$i++]);
ok($e->query->strand, $test_e->[$i++]);
ok($e->hit->start, $test_e->[$i++]);
ok($e->hit->end, $test_e->[$i++]);
ok($e->hit->strand, $test_e->[$i++]);
}
ok(! @expected_exons);
foreach my $intron ( @introns ) {
my $test_i = shift @expected_introns;
my $i = 0;
ok($intron->start, $test_i->[$i++]);
ok($intron->end, $test_i->[$i++]);
ok($intron->strand, $test_i->[$i++]);
}
ok(! @expected_introns);
$parser = new Bio::Tools::Est2Genome(-file => Bio::Root::IO->catfile
('t','data', 'hs_est.est2genome'));
ok($parser);
my $gene = $parser->parse_next_gene(1);
@expected_exons = ( [695,813,1,1,119,1],
[1377,1493,1,120,236,1],
[1789,1935,1,237,382,1],
[2084,2180,1,383,479,1]);
@expected_introns = ( [814,1376,1],
[1494,1788,1],
[1936,2083,1] );
foreach my $trans($gene->transcripts){
my @exons = $trans->exons;
foreach my $e(@exons){
my $test_e = shift @expected_exons;
my $i = 0;
ok($e->start, $test_e->[$i++]);
ok($e->end, $test_e->[$i++]);
ok($e->strand, $test_e->[$i++]);
}
my @introns = $trans->introns;
foreach my $intron ( @introns ) {
my $test_i = shift @expected_introns;
my $i = 0;
ok($intron->start, $test_i->[$i++]);
ok($intron->end, $test_i->[$i++]);
ok($intron->strand, $test_i->[$i++]);
}
}
|