1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 53);
12 use_ok('Bio::Tools::Genewise');
13 use_ok('Bio::SearchIO');
16 my $inputfilename= test_input_file('genewise.out');
17 my $parser = Bio::Tools::Genewise->new(-file => $inputfilename);
19 while (my $gene= $parser->next_prediction){
22 my @t = $gene[0]->transcripts;
25 is ($t[0]->seq_id, 'Scaffold_2042.1');
26 is ($e[0]->seq_id, 'Scaffold_2042.1');
27 is ($t[0]->source_tag, 'genewise');
28 is ($e[0]->source_tag, 'genewise');
29 is ($t[0]->primary_tag, 'transcript');
30 is ($e[0]->primary_tag, 'exon');
32 is (scalar($t[0]->exons), 18);
33 is ($t[0]->start, 22265);
34 is ($t[0]->end, 37062);
35 is ($e[0]->start,22265);
36 is ($e[0]->end, 22396);
37 my ($phase) = $e[0]->each_tag_value('phase');
39 my ($sf)= $e[0]->each_tag_value('supporting_feature');
40 is ($sf->feature1->seq_id,'Scaffold_2042.1');
41 is ($sf->feature1->start,22265);
42 is ($sf->feature1->end,22396);
43 is ($sf->feature2->seq_id,'SINFRUP00000067802');
44 is ($sf->feature2->start,1);
45 is ($sf->feature2->end,44);
46 is ($sf->feature1->end,22396);
48 open(FH,$inputfilename);
49 $parser = Bio::Tools::Genewise->new(-fh=>\*FH);
50 while (my $gene= $parser->next_prediction){
53 @t = $gene[0]->transcripts;
56 is (scalar($t[0]->exons), 18);
57 is ($t[0]->start, 22265);
58 is ($t[0]->end, 37062);
59 is ($e[0]->start,22265);
60 is ($e[0]->end, 22396);
61 ($phase) = $e[0]->each_tag_value('phase');
63 ($sf)= $e[0]->each_tag_value('supporting_feature');
64 is ($sf->feature1->seq_id,'Scaffold_2042.1');
65 is ($sf->feature1->start,22265);
66 is ($sf->feature1->end,22396);
67 is ($sf->feature2->seq_id,'SINFRUP00000067802');
68 is ($sf->feature2->start,1);
69 is ($sf->feature2->end,44);
70 is ($sf->feature1->end,22396);
72 $parser = Bio::SearchIO->new(-file => test_input_file('genewise.out'),
74 -wisetype => 'genewise');
75 my $result = $parser->next_result;
76 my $hit = $result->next_hit;
77 is($result->query_name, 'SINFRUP00000067802');
78 is($hit->name, 'Scaffold_2042.1');
80 is($hit->score, 2054.68);
81 my $hsp = $hit->next_hsp;
83 is($hsp->query->start,22265);
84 is($hsp->query->end,22396);
85 is($hsp->query->strand,1);
86 is($hsp->query->score, 2054.68);
88 is($hsp->hit->start,1);
89 is($hsp->hit->end,44);
90 is($hsp->hit->strand,0);
91 is($hsp->hit->score, 2054.68);
93 $hsp = $hit->next_hsp;
95 is($hsp->query->start,24224);
96 is($hsp->query->end,24328);
98 is($hsp->hit->start,45);
99 is($hsp->hit->end,79);
101 $hsp = $hit->next_hsp;
103 is($hsp->query->start,24471);
104 is($hsp->query->end,24513);
106 is($hsp->hit->start,80);
107 is($hsp->hit->end,93);