~ubuntu-branches/ubuntu/oneiric/bioperl/oneiric

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# -*-Perl-*- Test Harness script for Bioperl
# $Id: SiteMatrix.t 15112 2008-12-08 18:12:38Z sendu $


use strict;

BEGIN {
  use lib '.';
  use Bio::Root::Test;
  
  test_begin(-tests => 14);
  
  use_ok('Bio::Matrix::PSM::SiteMatrix');
}

my $score;
my $A='a0501';
my $C='014a0';
my $G='01103';
my $T='08006';
my $eval=0.0001;
my %param=(pA=>$A,pC=>$C,pG=>$G,pT=>$T,e_val=>$eval, correction =>0);
ok my $matrix=Bio::Matrix::PSM::SiteMatrix->new(%param);

#Simple methods here
is $matrix->IUPAC,'ABVCD';

is $matrix->consensus,'ATACT';

is $matrix->width,5;

is $matrix->curpos,0;

is $matrix->get_string('A'),$A;

my %x= (base=>'A',pA=>1,pC=>0,pG=>0,pT=>0,prob=>10,rel=>0, 
        lA=>undef,lC=>undef,lG=>undef,lT=>undef);
my %pos = $matrix->next_pos;
my ($all) = 1;
while(my ($k,$v) = each %x ) {
    my $r =$pos{$k};
    if( ! defined $v && ! defined $r) {
    } elsif($pos{$k} ne $v ) { 
	$all = 0;
	last;
    }
}
ok($all);

is $matrix->curpos,1;

ok $matrix->e_val(0.0001);

is $matrix->e_val,0.0001;

#Now some PSM specific methods like regexp and matrix info
is $matrix->regexp,'[Aa][CcGgTtBb][AaCcGgVv][Cc][AaGgTtDd]';

my @x=(1,0,0.5,0,0.1);
is_deeply [$matrix->get_array('A')], \@x;

@x=qw([Aa] [CcGgTtBb] [AaCcGgVv] [Cc] [AaGgTtDd]);
is_deeply [$matrix->regexp_array], \@x;