tag fourth (and hopefully last) alpha
[bioperl-live.git] / branch-1-6 / t / Matrix / ProtMatrix.t
blob6644e53e7ed9d5181f0a3813cddd6005c69218d3
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::ProtMatrix';
17 my %param = (
18    '-id' => 'A. thaliana protein atp1',
19    '-e_val' => 0.0001,
20    '-ic' => [ '0.28', '0.40', '0.64', '0.68', '0.68', '0.70', '0.72', '0.72' ],
21    '-lS' => [ '-2', '3', '-3', '2', '-3', '1', '1', '3' ],
22    '-lF' => [ '-1', '-4', '0', '-5', '0', '-5', '-4', '-4' ],
23    '-lT' => [ '-1', '1', '0', '1', '-2', '-1', '0', '1' ],
24    '-lN' => [ '-3', '-1', '-2', '3', '-5', '5', '-2', '0' ],
25    '-lK' => [ '-2', '0', '-3', '2', '-3', '2', '-3', '-1' ],
26    '-lY' => [ '-2', '-3', '-3', '-4', '-3', '-4', '-4', '-4' ],
27    '-lE' => [ '-3', '4', '-3', '2', '-4', '-2', '-3', '2' ],
28    '-lV' => [ '0', '-2', '1', '-4', '1', '-4', '-1', '-3' ],
29    '-lQ' => [ '-1', '0', '-2', '3', '-4', '1', '-3', '0' ],
30    '-lM' => [ '8', '-3', '8', '-3', '1', '-3', '-3', '-3' ],
31    '-lC' => [ '-2', '-3', '-3', '-4', '-3', '-4', '-3', '-3' ],
32    '-lL' => [ '1', '-3', '1', '-4', '3', '-4', '-2', '-4' ],
33    '-lA' => [ '-2', '1', '-2', '0', '-2', '-2', '2', '2' ],
34    '-lW' => [ '-2', '-4', '-3', '-5', '-4', '-5', '-5', '-5' ],
35    '-lP' => [ '-3', '-2', '-4', '-3', '-1', '-3', '6', '-3' ],
36    '-lH' => [ '-2', '-2', '-3', '-2', '-5', '-2', '-2', '-3' ],
37    '-lD' => [ '-4', '-1', '-3', '1', '-3', '-1', '-3', '4' ],
38    '-lR' => [ '-2', '-1', '-3', '0', '-4', '4', '-4', '-3' ],
39    '-lI' => [ '0', '-3', '0', '-4', '6', '-4', '-2', '-2' ],
40    '-lG' => [ '-4', '-2', '-4', '-2', '-5', '-3', '-1', '-2' ],
41    '-pS' => [ '0', '33', '0', '16', '1', '12', '11', '25' ],
42    '-pF' => [ '0', '0', '2', '0', '3', '0', '0', '0' ],
43    '-pT' => [ '0', '8', '7', '10', '1', '2', '7', '8' ],
44    '-pN' => [ '0', '0', '2', '13', '0', '36', '1', '4' ],
45    '-pK' => [ '0', '5', '0', '13', '1', '15', '0', '2' ],
46    '-pY' => [ '0', '0', '0', '0', '0', '0', '0', '0' ],
47    '-pE' => [ '0', '41', '1', '12', '0', '0', '0', '15' ],
48    '-pV' => [ '0', '3', '9', '0', '2', '0', '3', '1' ],
49    '-pQ' => [ '0', '0', '0', '15', '0', '4', '0', '3' ],
50    '-pM' => [ '100', '0', '66', '0', '2', '0', '0', '0' ],
51    '-pC' => [ '0', '0', '0', '0', '0', '0', '0', '0' ],
52    '-pL' => [ '0', '0', '8', '0', '25', '0', '4', '0' ],
53    '-pA' => [ '0', '10', '1', '9', '2', '0', '22', '16' ],
54    '-pW' => [ '0', '0', '0', '0', '0', '0', '0', '0' ],
55    '-pP' => [ '0', '0', '0', '0', '3', '1', '45', '0' ],
56    '-pH' => [ '0', '0', '0', '0', '0', '0', '1', '0' ],
57    '-pD' => [ '0', '0', '1', '7', '2', '2', '0', '22' ],
58    '-pR' => [ '0', '0', '0', '3', '0', '27', '0', '0' ],
59    '-pI' => [ '0', '0', '3', '0', '59', '1', '2', '3' ],
60    '-pG' => [ '0', '0', '0', '1', '0', '0', '4', '1' ],
63 my $matrix = Bio::Matrix::PSM::ProtMatrix->new(%param);
64 ok $matrix;
66 #Simple methods here
67 is $matrix->IUPAC,'MEMSINPS';
69 is $matrix->consensus,'MEMSINPS';
71 is $matrix->width,8;
73 is $matrix->curpos,0;
75 is $matrix->get_string('A'), '0100a90200220160';
77 my %x1 = (
78          'base' => 'M', 'prob' => 100, 'rel' => 0,
79          'lC' => '-2',
80          'pM' => '100',
81          'lY' => '-2',
82          'lK' => '-2',
83          'lR' => '-2',
84          'lM' => '8',
85          'pP' => '0',
86          'lV' => '0',
87          'pK' => '0',
88          'lH' => '-2',
89          'pI' => '0',
90          'pT' => '0',
91          'lE' => '-3',
92          'lN' => '-3',
93          'lQ' => '-1',
94          'lW' => '-2',
95          'pH' => '0',
96          'pC' => '0',
97          'lI' => '0',
98          'pA' => '0',
99          'lA' => '-2',
100          'pV' => '0',
101          'pF' => '0',
102          'lS' => '-2',
103          'pY' => '0',
104          'lL' => '1',
105          'lG' => '-4',
106          'pE' => '0',
107          'pL' => '0',
108          'lF' => '-1',
109          'pS' => '0',
110          'pD' => '0',
111          'pN' => '0',
112          'lP' => '-3',
113          'lT' => '-1',
114          'pQ' => '0',
115          'pR' => '0',
116          'lD' => '-4',
117          'pW' => '0',
118          'pG' => '0'
121 my %x2 = $matrix->next_pos;
122 is_deeply \%x1, \%x2;
124 is $matrix->curpos,1;
126 ok $matrix->e_val(0.0001);
127 is $matrix->e_val,0.0001;
129 #Now some PSM specific methods like regexp and matrix info
131 my @a = ('0', '10', '1', '9', '2', '0', '22', '16');
132 is_deeply [$matrix->get_array('A')], \@a;
134 my $regexp = '[Mm][EeSs][Mm]\.[IiLl][RrNn][AaPp][DdSs]';
135 is $matrix->regexp, $regexp;
136 is $matrix->sequence_match_weight('MSMPLRPD'), 33;