Supply TEMPLATE and SUFFIX for temporary query sequence files.
[bioperl-run.git] / t / Lagan.t
blob9186714950554d7fa417b1c0a70ec707ccbd708f
1 #!/usr/local/bin/perl
2 #-*-Perl-*-
3 # ## Bioperl Test Harness Script for Modules
4 # #
5 use strict;
6 BEGIN {
7 use Bio::Root::Test;
8 test_begin(-tests => 12);
9 use_ok('Bio::AlignIO');
10 use_ok('Bio::Tools::Run::Alignment::Lagan');
11 use_ok('Bio::Root::IO');
12 use_ok('Bio::SeqIO');
13 use_ok('Bio::Seq');
14 use_ok('Bio::Matrix::Mlagan');
17 my $seq1 = test_input_file("lagan_dna.fa");
18 my $sio = Bio::SeqIO->new(-file=>$seq1,-format=>'fasta');
20 my $seq = $sio->next_seq;
21 $seq->id("first_seq");
22 my $seq2= Bio::Seq->new(-id=>"second_seq",-seq=>$seq->seq);
23 my $seq3= Bio::Seq->new(-id=>"third_seq",-seq=>$seq->seq);
25 my @params =
27 'order' => "\"-gs -7 -gc -2 -mt 2 -ms -1\"",
28 'tree' => "\"(first_seq (second_seq third_seq))\"",
29 'match' => 12,
30 'mismatch' => -8,
31 'gapstart' => -50,
32 'gapend' => -50,
33 'gapcont' => -2,
36 SKIP: {
37 my $factory = Bio::Tools::Run::Alignment::Lagan->new(@params,
38 -verbose => -1);
39 $factory->quiet(1);
40 isa_ok $factory,'Bio::Tools::Run::Alignment::Lagan';
41 test_skip(-requires_executable => $factory,
42 -tests => 5,
43 -requires_env => 'LAGAN_DIR');
45 my $simple_align= $factory->lagan($seq,$seq2);
47 isa_ok $simple_align, 'Bio::SimpleAlign';
49 is $simple_align->percentage_identity, 100;
51 my $multi = $factory->mlagan([$seq,$seq2,$seq3]);
52 is $multi->percentage_identity, 100;
54 my $matrix = Bio::Matrix::Mlagan->new(-values => [[qw(115 -161 -81 -161 0 -72)],
55 [qw(-161 115 -161 -81 0 -72)],
56 [qw(-81 -161 115 -161 0 -72)],
57 [qw(-161 -81 -161 115 0 -72)],
58 [qw(0 0 0 0 0 0)],
59 [qw(-72 -72 -72 -72 0 -72)]],
60 -gap_open => -470,
61 -gap_continue => -25);
63 is $factory->nuc_matrix($matrix), $matrix;
64 #*** weak test; doesn't show the supplied matrix had any effect on results...
65 $multi = $factory->mlagan([$seq,$seq2,$seq3]);
66 is $multi->percentage_identity, 100;