2 ## Bioperl Test Harness Script for Modules
7 eval { require Test; };
14 plan tests => $NTESTS;
16 use Bio::Tools::Run::Alignment::Exonerate;
20 for ( $Test::ntest..$NTESTS ) {
21 skip("exonerate program not found. Skipping. (Be sure you have installed Exonerate)",1);
26 my $verbose = $ENV{BIOPERLDEBUG} || -1;
28 my $query= Bio::Root::IO->catfile("t","data","exonerate_cdna.fa");
29 my $target= Bio::Root::IO->catfile("t","data","exonerate_genomic.fa");
30 my $targetrev= Bio::Root::IO->catfile("t","data","exonerate_genomic_rev.fa");
32 my $run = Bio::Tools::Run::Alignment::Exonerate->new(-verbose => $verbose,
33 arguments=>'--model est2genome --bestn 1');
34 exit(0) unless( $run->executable );
36 ok $run->isa('Bio::Tools::Run::Alignment::Exonerate');
38 my $searchio= $run->run($query,$target);
39 ok $searchio->isa("Bio::SearchIO");
40 my @expect = ( [qw(29 268 4 242)],# target-start t-end query-start q-end
41 [qw(526 646 243 363)],
42 [qw(964 1056 364 456)],
43 [qw(1770 1923 457 610)],
44 [qw(2250 2479 611 840 )],
45 [qw(2565 2687 841 963)],
46 [qw(2769 3074 964 1279)] );
47 RESULT: while(my $result = $searchio->next_result){
48 while( my $hit = $result->next_hit ) {
49 # ok($hit->start('hit'), 29);
50 # ok($hit->end('hit'), 3074);
52 while( my $hsp = $hit->next_hsp ) {
53 ok ($hsp->hit->strand, 1);
54 ok ($hsp->query->strand, 1);
55 ok ($hsp->hit->start,$expect[$i]->[0]);
56 ok ($hsp->hit->end,$expect[$i]->[1]);
57 ok ($hsp->query->start,$expect[$i]->[2]);
58 ok ($hsp->query->end,$expect[$i]->[3]);
61 warn("TARGET:", $hsp->hit->location->to_FTstring, "\n");
62 warn("QUERY: ",$hsp->query->location->to_FTstring, "\n");
65 last; # only show a single HIT
71 $searchio= $run->run($query,$targetrev);
72 ok $searchio->isa("Bio::SearchIO");
73 my @expectrev = ( [qw(28 333 964 1279)],# target-start t-end query-start q-end
74 [qw(415 537 841 963)],
75 [qw(623 852 611 840)],
76 [qw(1179 1332 457 610)],
77 [qw(2046 2138 364 456)],
78 [qw(2456 2576 243 363)],
79 [qw(2834 3073 4 242)] );
80 RESULT: while(my $result = $searchio->next_result){
81 while( my $hit = $result->next_hit ) {
83 while( my $hsp = $hit->next_hsp ) {
84 ok ($hsp->hit->strand, 1);
85 ok ($hsp->query->strand, -1);
86 ok ($hsp->hit->start,$expectrev[$i]->[0]);
87 ok ($hsp->hit->end,$expectrev[$i]->[1]);
88 ok ($hsp->query->start,$expectrev[$i]->[2]);
89 ok ($hsp->query->end,$expectrev[$i]->[3]);
92 warn("TARGET:", $hsp->hit->location->to_FTstring, "\n");
93 warn("QUERY: ",$hsp->query->location->to_FTstring, "\n");
96 last; # only show a single HIT