skip tests if the cloning class used happens to be Storable, see bug #3447
[bioperl-live.git] / t / Matrix / SiteMatrix.t
blob3e8bd99ab0b89eb9661c3f69488df13c481fd58e
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
5 use strict;
7 BEGIN {
8   use lib '.';
9   use Bio::Root::Test;
10   
11   test_begin(-tests => 14);
12   
13   use_ok('Bio::Matrix::PSM::SiteMatrix');
16 my $score;
17 my $A='a0501';
18 my $C='014a0';
19 my $G='01103';
20 my $T='08006';
21 my $eval=0.0001;
22 my %param=(pA=>$A,pC=>$C,pG=>$G,pT=>$T,e_val=>$eval, correction =>0);
23 ok my $matrix=Bio::Matrix::PSM::SiteMatrix->new(%param);
25 #Simple methods here
26 is $matrix->IUPAC,'ABVCD';
28 is $matrix->consensus,'ATACT';
30 is $matrix->width,5;
32 is $matrix->curpos,0;
34 is $matrix->get_string('A'),$A;
36 my %x= (base=>'A',pA=>1,pC=>0,pG=>0,pT=>0,prob=>10,rel=>0, 
37         lA=>undef,lC=>undef,lG=>undef,lT=>undef);
38 my %pos = $matrix->next_pos;
39 my ($all) = 1;
40 while(my ($k,$v) = each %x ) {
41     my $r =$pos{$k};
42     if( ! defined $v && ! defined $r) {
43     } elsif($pos{$k} ne $v ) { 
44         $all = 0;
45         last;
46     }
48 ok($all);
50 is $matrix->curpos,1;
52 ok $matrix->e_val(0.0001);
54 is $matrix->e_val,0.0001;
56 #Now some PSM specific methods like regexp and matrix info
57 is $matrix->regexp,'[Aa][CcGgTtBb][AaCcGgVv][Cc][AaGgTtDd]';
59 my @x=(1,0,0.5,0,0.1);
60 is_deeply [$matrix->get_array('A')], \@x;
62 @x=qw([Aa] [CcGgTtBb] [AaCcGgVv] [Cc] [AaGgTtDd]);
63 is_deeply [$matrix->regexp_array], \@x;