tests pass, find the right nodes more explicitly
[bioperl-run.git] / t / Blat.t
blob37e760f663c14cd2215dad45741d585f4bf95345
1 #!/usr/local/bin/perl
2 #-*-Perl-*-
3 # ## Bioperl Test Harness Script for Modules
4 # #
5 use strict;
6 my $verbose = $ENV{'BIOPERLDEBUG'} || 0;
7 BEGIN {
8 eval { require Test; };
9 if( $@ ) {
10 use lib 't';
12 use Test;
13 use vars qw($NTESTS);
14 $NTESTS = 11;
15 plan tests => $NTESTS;
18 END {
19 foreach ( $Test::ntest..$NTESTS ) {
20 skip('Unable to run Blat tests, exe may not be installed',1);
24 use Bio::Tools::Run::Alignment::Blat;
25 use Bio::Root::IO;
26 use Bio::SeqIO;
27 use Bio::Seq;
29 my $db = Bio::Root::IO->catfile("t","data","blat_dna.fa");
31 my $query = Bio::Root::IO->catfile("t","data","blat_dna.fa");
33 my $factory = Bio::Tools::Run::Alignment::Blat->new('quiet' => 1,
34 -verbose => $verbose,
35 "DB" => $db);
36 ok $factory->isa('Bio::Tools::Run::Alignment::Blat');
38 my $blat_present = $factory->executable();
40 unless ($blat_present) {
41 warn("blat program not found. Skipping tests $Test::ntest to $NTESTS.\n");
42 exit 0;
45 my $searchio = $factory->align($query);
46 my $result = $searchio->next_result;
47 my $hit = $result->next_hit;
48 my $hsp = $hit->next_hsp;
49 ok $hsp->isa("Bio::Search::HSP::HSPI");
50 ok ($hsp->query->start,1);
51 ok ($hsp->query->end,1775);
52 ok ($hsp->hit->start,1);
53 ok ($hsp->hit->end,1775);
54 my $sio = Bio::SeqIO->new(-file=>$query,-format=>'fasta');
56 my $seq = $sio->next_seq ;
58 $searchio = $factory->align($seq);
59 $result = $searchio->next_result;
60 $hit = $result->next_hit;
61 $hsp = $hit->next_hsp;
62 ok $hsp->isa("Bio::Search::HSP::HSPI");
63 ok ($hsp->query->start,1);
64 ok ($hsp->query->end,1775);
65 ok ($hsp->hit->start,1);
66 ok ($hsp->hit->end,1775);
68 1;