Supply TEMPLATE and SUFFIX for temporary query sequence files.
[bioperl-run.git] / t / StandAloneFasta.t
bloba79989360e4ddb41093f6ef1364e8a95db3f9df8
1 # -*-Perl-*-
2 ## Bioperl Test Harness Script for Modules
3 ## $Id$
6 use strict;
7 BEGIN {
8     use Bio::Root::Test;
9     test_begin(-tests => 15);
10         use_ok('Bio::Tools::Run::Alignment::StandAloneFasta');
11         use_ok('Bio::SeqIO');
14 my $verbose = -1;
16 my $version = '35';
17 my @params = ( 'b' =>'15', 
18                'd' => 0,
19                'O' => test_output_file(),
20                'm'=>'9',
21                "program"=>"fasta$version");
22 my $factory = Bio::Tools::Run::Alignment::StandAloneFasta->new
23     ('-verbose' => $verbose,
24      @params);
25 ok $factory;
26 my $inputfilename = test_input_file("fasta.fa");
28 SKIP: {
29     test_skip(-requires_executable => $factory,
30               -tests => 12);
31         my $lib = test_input_file("fastalib.fa");
32         $factory->library($lib);
33         my ($fastareport) = $factory->run($inputfilename);
34         my $result = $fastareport->next_result;
35         my $hit    = $result->next_hit();
36         my $hsp    = $hit->next_hsp();
37         is $hsp->algorithm, 'FASTN';
38         is $hsp->num_identical, 2982;
39         is $hsp->length, 2982;
40         
41         $factory->program_name('ssearch'.$version);
42         ($fastareport) = $factory->run($inputfilename);
43         $result = $fastareport->next_result;
44         $hit    = $result->next_hit();
45         $hsp    = $hit->next_hsp();
46         like $hsp->algorithm, qr/SMITH-WATERMAN|SSEARCH/;
47         is $hsp->num_identical, 2982;
48         is $hsp->length, 2982;
49         
50         $factory->program_name('fastx'.$version);
51         $factory->library(test_input_file("fastaprot.fa"));
52         ($fastareport) = $factory->run($inputfilename);
53         $result = $fastareport->next_result;
54         $hit    = $result->next_hit();
55         $hsp    = $hit->next_hsp();
56         is $hsp->algorithm, 'FASTX';
57         is $hsp->num_identical, 994;
58         is $hsp->length, 994;
59         
60         my $sio = Bio::SeqIO->new(-file=>$inputfilename,
61                                   -format=>"fasta");
62         my $seq = $sio->next_seq;
63         
64         #test with objects
65         ($fastareport) = $factory->run($seq);
66         $result = $fastareport->next_result;
67         $hit    = $result->next_hit();
68         $hsp    = $hit->next_hsp();
69         is $hsp->algorithm, 'FASTX';
70         is $hsp->num_identical, 994;
71         is $hsp->length, 994;