2 ## Bioperl Test Harness Script for Modules
8 test_begin(-tests => 19);
9 use_ok('Bio::Tools::Run::Alignment::MSAProbs');
10 use_ok('Bio::Tools::GuessSeqFormat');
11 use_ok('Bio::AlignIO');
13 use_ok('Bio::Root::IO');
18 unlink('muscle.log', 'muscle.out');
19 unlink qw(cysprot.dnd cysprot1a.dnd);
22 my @params = ('quiet' => 1);
23 my $factory = Bio::Tools::Run::Alignment::MSAProbs->new(@params);
24 is($factory->quiet, 1);
25 my $inputfilename = test_input_file("cysprot.fa");
29 test_skip(-requires_executable => $factory,
31 my $version = $factory->version;
32 unless ($version >= 0.94) {
33 skip("Only muscle version 0.9.4 or higher is supported by these tests. Skipping tests", 7);
36 cmp_ok ($version, '>=', 0.94, "Code tested only on msaprobs versions > 0.9.4" );
37 $aln = $factory->align($inputfilename);
39 is( $aln->num_sequences, 7);
41 my $str = Bio::SeqIO->new('-file' =>
42 test_input_file("cysprot.fa"),
43 '-format' => 'Fasta');
46 while ( my $seq = $str->next_seq() ) {
47 push (@seq_array, $seq) ;
50 my $seq_array_ref = \@seq_array;
52 $aln = $factory->align($seq_array_ref);
53 is $aln->num_sequences, 7;
54 my $s1_perid = POSIX::ceil($aln->average_percentage_identity);
55 is($s1_perid == 43, 1);
57 my $annotfile = test_output_file();
58 my $outfile = test_output_file();
59 # add some more params
60 @params = ('-quiet' => 1,
62 '-outfile' => $outfile,
66 '-alignment_order' => 1,
67 '-annot_file' => $annotfile,
70 $factory = Bio::Tools::Run::Alignment::MSAProbs->new(@params);
71 my @methods = qw(quiet verbose outfile iterations clustalw consistency
72 alignment_order annot_file version num_threads);
73 can_ok($factory, @methods);
74 is($factory->annot_file, $annotfile,'annotation file');
75 $aln = $factory->align($seq_array_ref);
76 is $aln->num_sequences, 7;
77 $s1_perid = POSIX::ceil($aln->average_percentage_identity);
78 is($s1_perid == 43, 1 );
80 my $guesser = Bio::Tools::GuessSeqFormat->new(-file => $outfile);
81 my $type = $guesser->guess;
82 is($type, 'clustalw', "Expected output is clustalw formatted");
83 $inputfilename = test_input_file("cysprot1a.fa");
84 $aln = $factory->align($inputfilename);
85 is $aln->num_sequences, 3;
86 $s1_perid = POSIX::ceil($aln->average_percentage_identity);
88 is($s1_perid == 42, 1 );