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