Updating Mauricio's email
[bioperl-run.git] / t / Probcons.t
blob017930afc5471695c05c00ef44f33e284560c5be
1 # -*-Perl-*-
2 ## Bioperl Test Harness Script for Modules
4 use strict;
5 BEGIN {
6     use Bio::Root::Test;
7     test_begin(-tests => 11);
8         use_ok(' Bio::Tools::Run::Alignment::Probcons');
9         use_ok(' Bio::AlignIO');
10         use_ok(' Bio::SeqIO');
13 END { unlink qw(cysprot.dnd cysprot1a.dnd) }
15 my @params = ();
16 my $factory = Bio::Tools::Run::Alignment::Probcons->new(@params);
17 my $inputfilename = test_input_file('cysprot.fa');
18 my $aln;
20 SKIP: {
21         test_skip(-requires_executable => $factory,
22                   -tests => 8);
23         my $version = $factory->version;
24         cmp_ok ($version, '>=', 1.09, "Code tested only on probcons versions > 1.09" );
25         $aln = $factory->align($inputfilename);
26         ok($aln);
27         is( $aln->num_sequences, 7);
28         
29         my $str = Bio::SeqIO->new('-file' => $inputfilename,
30                                   '-format' => 'Fasta');
31         my @seq_array =();
32         
33         while ( my $seq = $str->next_seq() ) {
34                 push (@seq_array, $seq) ;
35         }
36         
37         my $seq_array_ref = \@seq_array;
38         
39         $aln = $factory->align($seq_array_ref);
40         is $aln->num_sequences, 7;
41         my $s1_avg_perid = $aln->average_percentage_identity;
42         is(int($s1_avg_perid), 43);
43         my $s1_ovl_perid = $aln->overall_percentage_identity;
44         is(int($s1_ovl_perid), 15);
45         
46         my ($paramsfilename) = test_output_file();
47         my ($annotfilename) = test_output_file();
48         my ($dummyfilename) = test_output_file();
49         my $factory2 = Bio::Tools::Run::Alignment::Probcons->new
50                 (
51                  'iterative-refinement'  => '1000',
52                  'consistency'   => '5',
53                  'emissions' => '',
54                  'verbose' => '',
55                  'train'   => $paramsfilename,
56                 );
57         $factory2->outfile_name($dummyfilename);
58         
59         my $aln2 = $factory2->align($seq_array_ref);
60         $aln2 = '';
61         $factory2 = '';
62         
63         $factory2 = Bio::Tools::Run::Alignment::Probcons->new
64                 (
65                  'iterative-refinement'  => '1000',
66                  'consistency'   => '5',
67                  'annot'   => $annotfilename,
68                  'paramfile'   => $paramsfilename,
69                 );
70         $factory->outfile_name($dummyfilename);
71         $aln2 = $factory2->align($seq_array_ref);
72         my $s2_avg_perid = $aln2->average_percentage_identity;
73         my $s2_ovl_perid = $aln2->overall_percentage_identity;
74         cmp_ok(int($s2_avg_perid), '>=', 42);
75         cmp_ok(int($s2_ovl_perid), '>=', 15);
78 END {
79         if (-e 'iterative-refinement') {
80                 unlink('iterative-refinement');
81         }