Supply TEMPLATE and SUFFIX for temporary query sequence files.
[bioperl-run.git] / t / DBA.t
blob28a10097d9d903a40c26f4fbca257a487261d094
1 # -*-Perl-*-
2 ## Bioperl Test Harness Script for Modules
5 use strict;
6 BEGIN {
7     use Bio::Root::Test;
8     test_begin(-tests => 18);
9     use_ok('Bio::Tools::Run::Alignment::DBA');
10     use_ok('Bio::SimpleAlign');
11     use_ok('Bio::AlignIO');
12     use_ok('Bio::SeqIO');
13
15 my $verbose = -1;
16 my @params = ('matchA' => 0.75, 'matchB' => '0.55','dymem'=>'linear');
17 my  $factory = Bio::Tools::Run::Alignment::DBA->new(@params);
19 SKIP: {
20     test_skip(-requires_executable => $factory,
21               -tests => 14);
23     isa_ok $factory,'Bio::Tools::Run::Alignment::DBA';
24     my $bequiet = 1;
25     $factory->quiet($bequiet);  # Suppress clustal messages to terminal
27     #test with one file with 2 sequences
28     my $inputfilename_1a = test_input_file("dba1a.fa");
29     my $inputfilename_1b = test_input_file("dba1b.fa");
30     my $inputfilename2 = test_input_file("dba2.fa");
31     my $aln;
32     my @hsps = $factory->align($inputfilename2);
33     isa_ok($hsps[0],"Bio::Search::HSP::GenericHSP");
34     is($hsps[0]->query->start,4);
35     is($hsps[0]->query->end,209);
36     is($hsps[0]->gaps,6);
37     
38     #test with 2 files of 1 sequence each
39     my @files = ($inputfilename_1a,$inputfilename_1b);
40     @hsps = $factory->align(\@files);
41     is($hsps[0]->query->start,3);
42     is($hsps[0]->query->end,88);
43     is($hsps[0]->gaps,0);
44     is($hsps[1]->hit->start,90);
45     is($hsps[1]->hit->end,195);
46     is($hsps[1]->gaps,0);
47     
48     #test with an array of 2 PrimarySeqI objects
49     
50     my $str = Bio::SeqIO->new(-file=> test_input_file("dba2.fa"), '-format' => 'Fasta');
51     my @seq_array =();
52     
53     while ( my $seq = $str->next_seq() ) {
54       push (@seq_array, $seq) ;
55     }
56     @hsps = $factory->align(\@seq_array);
57     is($hsps[0]->query->start,4);
58     is($hsps[0]->query->end,209);
59     is($hsps[0]->gaps,6);