1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 61);
12 use_ok('Bio::Tools::Est2Genome');
15 my $parser = Bio::Tools::Est2Genome->new(-file => test_input_file('hs_est.est2genome'));
18 my $feature_set = $parser->parse_next_gene;
19 like(ref($feature_set), qr/ARRAY/i );
21 is(scalar @$feature_set, 7);
22 my @exons = grep { $_->primary_tag eq 'Exon' } @$feature_set;
23 my @introns = grep { $_->primary_tag eq 'Intron' } @$feature_set;
25 my @expected_exons = ( [695,813,1,1,119,1],
26 [1377,1493,1,120,236,1],
27 [1789,1935,1,237,382,1],
28 [2084,2180,1,383,479,1]);
29 my @expected_introns = ( [814,1376,1],
33 foreach my $e ( @exons ) {
34 my $test_e = shift @expected_exons;
36 is($e->query->start, $test_e->[$i++]);
37 is($e->query->end, $test_e->[$i++]);
38 is($e->query->strand, $test_e->[$i++]);
40 is($e->hit->start, $test_e->[$i++]);
41 is($e->hit->end, $test_e->[$i++]);
42 is($e->hit->strand, $test_e->[$i++]);
44 ok(! @expected_exons);
45 foreach my $intron ( @introns ) {
46 my $test_i = shift @expected_introns;
48 is($intron->start, $test_i->[$i++]);
49 is($intron->end, $test_i->[$i++]);
50 is($intron->strand, $test_i->[$i++]);
52 ok(! @expected_introns);
54 $parser = Bio::Tools::Est2Genome->new(-file => test_input_file('hs_est.est2genome'));
57 my $gene = $parser->parse_next_gene(1);
58 @expected_exons = ( [695,813,1,1,119,1],
59 [1377,1493,1,120,236,1],
60 [1789,1935,1,237,382,1],
61 [2084,2180,1,383,479,1]);
62 @expected_introns = ( [814,1376,1],
66 foreach my $trans($gene->transcripts){
67 my @exons = $trans->exons;
68 foreach my $e(@exons){
69 my $test_e = shift @expected_exons;
71 is($e->start, $test_e->[$i++]);
72 is($e->end, $test_e->[$i++]);
73 is($e->strand, $test_e->[$i++]);
75 my @introns = $trans->introns;
76 foreach my $intron ( @introns ) {
77 my $test_i = shift @expected_introns;
79 is($intron->start, $test_i->[$i++]);
80 is($intron->end, $test_i->[$i++]);
81 is($intron->strand, $test_i->[$i++]);