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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
# -*-Perl-*-
## Bioperl Test Harness Script for Modules
use strict;
BEGIN {
eval { require Test; };
if( $@ ) {
use lib 't';
}
use Test;
use vars qw($NTESTS);
$NTESTS = 51;
plan tests => $NTESTS;
}
use Bio::Tools::Genewise;
use Bio::SeqIO;
use Bio::SearchIO;
use Bio::Root::IO;
END {
for ( $Test::ntest..$NTESTS ) {
skip("Genewise program not found. Skipping. (Be sure you have the wise package )",1);
}
}
my $inputfilename= Bio::Root::IO->catfile("t","data","genewise.out");
my $parser = Bio::Tools::Genewise->new(-file => $inputfilename);
my @gene;
while (my $gene= $parser->next_prediction){
push @gene, $gene;
}
my @t = $gene[0]->transcripts;
my @e = $t[0]->exons;
ok ($t[0]->seq_id, 'Scaffold_2042.1');
ok ($e[0]->seq_id, 'Scaffold_2042.1');
ok ($t[0]->source_tag, 'genewise');
ok ($e[0]->source_tag, 'genewise');
ok ($t[0]->primary_tag, 'transcript');
ok ($e[0]->primary_tag, 'exon');
ok (scalar($t[0]->exons), 18);
ok ($t[0]->start, 22265);
ok ($t[0]->end, 37062);
ok ($e[0]->start,22265);
ok ($e[0]->end, 22396);
my ($phase) = $e[0]->each_tag_value('phase');
ok ($phase,0);
my ($sf)= $e[0]->each_tag_value('supporting_feature');
ok ($sf->feature1->seq_id,'Scaffold_2042.1');
ok ($sf->feature1->start,22265);
ok ($sf->feature1->end,22396);
ok ($sf->feature2->seq_id,'SINFRUP00000067802');
ok ($sf->feature2->start,1);
ok ($sf->feature2->end,44);
ok ($sf->feature1->end,22396);
open(FH,$inputfilename);
$parser = Bio::Tools::Genewise->new(-fh=>\*FH);
while (my $gene= $parser->next_prediction){
push @gene, $gene;
}
@t = $gene[0]->transcripts;
@e = $t[0]->exons;
ok (scalar($t[0]->exons), 18);
ok ($t[0]->start, 22265);
ok ($t[0]->end, 37062);
ok ($e[0]->start,22265);
ok ($e[0]->end, 22396);
($phase) = $e[0]->each_tag_value('phase');
ok ($phase,0);
($sf)= $e[0]->each_tag_value('supporting_feature');
ok ($sf->feature1->seq_id,'Scaffold_2042.1');
ok ($sf->feature1->start,22265);
ok ($sf->feature1->end,22396);
ok ($sf->feature2->seq_id,'SINFRUP00000067802');
ok ($sf->feature2->start,1);
ok ($sf->feature2->end,44);
ok ($sf->feature1->end,22396);
$parser = new Bio::SearchIO(-file =>
Bio::Root::IO->catfile(qw(t data genewise.out)),
-format => 'wise',
-wisetype => 'genewise');
my $result = $parser->next_result;
skip(1,'swapping query/name need to reconsider how this done');
#ok($result->query_name, 'SINFRUP00000067802');
my $hit = $result->next_hit;
skip(1,'swapping query/name need to reconsider how this done');
#ok($hit->name, 'Scaffold_2042.1');
ok($hit->score, 2054.68);
my $hsp = $hit->next_hsp;
ok($hsp->query->start,22265);
ok($hsp->query->end,22396);
ok($hsp->query->strand,1);
ok($hsp->query->score, 2054.68);
ok($hsp->hit->start,1);
ok($hsp->hit->end,44);
ok($hsp->hit->strand,0);
ok($hsp->hit->score, 2054.68);
$hsp = $hit->next_hsp;
ok($hsp->query->start,24224);
ok($hsp->query->end,24328);
ok($hsp->hit->start,45);
ok($hsp->hit->end,79);
$hsp = $hit->next_hsp;
ok($hsp->query->start,24471);
ok($hsp->query->end,24513);
ok($hsp->hit->start,80);
ok($hsp->hit->end,93);
|