2 ## Bioperl Test Harness Script for Modules
10 test_begin(-tests => 23);
11 use_ok(' Bio::Tools::Run::Alignment::MAFFT');
12 use_ok(' Bio::AlignIO');
13 use_ok(' Bio::SeqIO');
16 END { unlink qw(cysprot.dnd cysprot1a.dnd) }
18 my @params = (-verbose => $DEBUG,
20 my $factory = Bio::Tools::Run::Alignment::MAFFT->new(@params);
22 isa_ok $factory,'Bio::Tools::Run::Alignment::MAFFT';
24 my $inputfilename = test_input_file("cysprot.fa");
28 test_skip(-requires_executable => $factory,
31 $factory->executable($factory->method);
33 my $version = $factory->version;
35 $aln = $factory->align($inputfilename);
37 is( $aln->num_sequences, 7);
39 my $str = Bio::SeqIO->new('-file' => test_input_file("cysprot.fa"),
40 '-format' => 'Fasta');
43 while ( my $seq = $str->next_seq() ) {
44 push (@seq_array, $seq) ;
47 my $seq_array_ref = \@seq_array;
49 $aln = $factory->align($seq_array_ref);
50 is $aln->num_sequences, 7;
51 my $s1_perid = $aln->average_percentage_identity;
52 cmp_ok(int($s1_perid), '>=', 42, '42 or 43 expected');
54 for my $method ( grep { !/rough/ } $factory->methods ) {
55 $factory->method($method);
56 $aln = $factory->align($inputfilename);
57 is $aln->num_sequences, 7;
58 my $s1_perid = $aln->average_percentage_identity;
63 skip("Tests require version 6 of MAFFT", 6) unless $factory->_version6;
64 $factory->localpair(1);
65 $aln = $factory->align( $inputfilename );
66 is $aln->num_sequences, 7;
67 $s1_perid = $aln->average_percentage_identity;
70 $factory->globalpair(1);
71 throws_ok { $aln = $factory->align( $inputfilename ) }
72 qr/You can't specify more than one of/,
73 'More than one alignment method throws';
75 my @extra_params = qw/ localpair 1 maxiterate 10000 /;
76 $factory = Bio::Tools::Run::Alignment::MAFFT->new(@params, @extra_params);
77 isa_ok $factory,'Bio::Tools::Run::Alignment::MAFFT';
78 $aln = $factory->align( $inputfilename );
79 is $aln->num_sequences, 7;
80 $s1_perid = $aln->average_percentage_identity;