bug 1825
[bioperl-live.git] / t / targetp.t
blob361cb86755e3a93d82d4aee3200c3d669ee2d050
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN { 
7     use lib 't/lib';
8     use BioperlTest;
9     
10     test_begin(-tests => 124);
11         
12         use_ok('Bio::Tools::TargetP');
15 my $targetp = Bio::Tools::TargetP->new(
16                                        -file => test_input_file('targetp.out')
17                                       );
19 ok($targetp);
21 my $items = {
22              '1' => {
23                      'id' => 'BC1G_00001.1',
24                      'len' => '173',
25                      'mTP' => '0.393',
26                      'SP'  => '0.024',
27                      'other' => '0.683',
28                      'loc'   => '_',
29                      'RC'    => '4',
30                      'tplen' => undef,
31                     },
32              '2' => {
33                      'id' => 'BC1G_00002.1',
34                      'len' => '120',
35                      'mTP' => '0.619',
36                      'SP'  => '0.040',
37                      'other' => '0.458',
38                      'loc'   => 'M',
39                      'RC'    => '5',
40                      'tplen' => '97',
41                     },
42              '3' => {
43                      'id' => 'BC1G_00003.1',
44                      'len' => '323',
45                      'mTP' => '0.094',
46                      'SP'  => '0.895',
47                      'other' => '0.027',
48                      'loc'   => 'S',
49                      'RC'    => '1',
50                      'tplen' => '21',
51                     },
52              '4' => {
53                      'id' => 'BC1G_00004.1',
54                      'len' => '361',
55                      'mTP' => '0.402',
56                      'SP'  => '0.072',
57                      'other' => '0.479',
58                      'loc'   => '_',
59                      'RC'    => '5',
60                      'tplen' => undef,
61                     },
62              '5' => {
63                      'id' => 'BC1G_00005.1',
64                      'len' => '244',
65                      'mTP' => '0.526',
66                      'SP'  => '0.035',
67                      'other' => '0.548',
68                      'loc'   => '_',
69                      'RC'    => '5',
70                      'tplen' => undef,
71                     },
72              '6' => {
73                      'id' => 'BC1G_00006.1',
74                      'len' => '35',
75                      'mTP' => '0.234',
76                      'SP'  => '0.036',
77                      'other' => '0.819',
78                      'loc'   => '_',
79                      'RC'    => '3',
80                      'tplen' => undef,
81                     },
82              '7' => {
83                      'id' => 'BC1G_00007.1',
84                      'len' => '73',
85                      'mTP' => '0.292',
86                      'SP'  => '0.127',
87                      'other' => '0.431',
88                      'loc'   => '_',
89                      'RC'    => '5',
90                      'tplen' => undef,
91                     },
92              '8' => {
93                      'id' => 'BC1G_00008.1',
94                      'len' => '349',
95                      'mTP' => '0.088',
96                      'SP'  => '0.958',
97                      'other' => '0.078',
98                      'loc'   => 'S',
99                      'RC'    => '1',
100                      'tplen' => '82',
101                     },
102              '9' => {
103                      'id' => 'BC1G_00009.1',
104                      'len' => '514',
105                      'mTP' => '0.183',
106                      'SP'  => '0.102',
107                      'other' => '0.735',
108                      'loc'   => '_',
109                      'RC'    => '3',
110                      'tplen' => undef,
111                     },
112              '10' => {
113                      'id' => 'BC1G_00010.1',
114                      'len' => '440',
115                      'mTP' => '0.114',
116                      'SP'  => '0.088',
117                      'other' => '0.865',
118                      'loc'   => '_',
119                      'RC'    => '2',
120                      'tplen' => undef,
121                     },
122              '11' => {
123                      'id' => 'BC1G_04501.1',
124                      'len' => '215',
125                      'mTP' => '0.185',
126                      'SP'  => '0.038',
127                      'other' => '0.843',
128                      'loc'   => '_',
129                      'RC'    => '2',
130                      'tplen' => undef,
131                     },
132              '12' => {
133                      'id' => 'BC1G_04502.1',
134                      'len' => '395',
135                      'mTP' => '0.118',
136                      'SP'  => '0.164',
137                      'other' => '0.825',
138                      'loc'   => '_',
139                      'RC'    => '2',
140                      'tplen' => undef,
141                     },
142              '13' => {
143                      'id' => 'BC1G_04503.1',
144                      'len' => '199',
145                      'mTP' => '0.515',
146                      'SP'  => '0.062',
147                      'other' => '0.436',
148                      'loc'   => 'M',
149                      'RC'    => '5',
150                      'tplen' => '20',
151                     },
152              '14' => {
153                      'id' => 'BC1G_04504.1',
154                      'len' => '220',
155                      'mTP' => '0.440',
156                      'SP'  => '0.030',
157                      'other' => '0.707',
158                      'loc'   => '_',
159                      'RC'    => '4',
160                      'tplen' => undef,
161                     },
162              '15' => {
163                      'id' => 'BC1G_04505.1',
164                      'len' => '67',
165                      'mTP' => '0.382',
166                      'SP'  => '0.049',
167                      'other' => '0.610',
168                      'loc'   => '_',
169                      'RC'    => '4',
170                      'tplen' => undef,
171                     },
172             };
173         
174 my $i = 1;
175 $targetp->_parse_results();
177 is($targetp->network(), 'NON-PLANT');
178 is($targetp->analysis_method_version(), "v1.1");
180 while(my $feat = $targetp->next_prediction()){
182     is($feat->seq_id(), $items->{$i}->{id}, "good SeqID");
183     is($feat->length(), $items->{$i}->{len}, "good Seqlength");
184     is(($feat->get_tag_values('mitochondrionCutOff'))[0], $items->{$i}->{mTP}, "correct Mitochondrion cutoff");
185     is(($feat->get_tag_values('signalPeptideCutOff'))[0], $items->{$i}->{SP}, "correct signalpPeptide cutoff");
186     is(($feat->get_tag_values('otherCutOff'))[0], $items->{$i}->{other}, "correct other cutoff");
187     is(($feat->get_tag_values('location'))[0], $targetp->_toString_location($items->{$i}->{loc}), "correct location");
188     is(($feat->get_tag_values('reliabilityClass'))[0], $items->{$i}->{RC}, "correct Reliability class score");
189     
190         if ($feat->has_tag('signalPeptideLength')) {
191                 is(($feat->get_tag_values('signalPeptideLength'))[0], $items->{$i}->{tplen}, "correct peptide signal length")
192         } else {
193                 is($feat->has_tag('signalPeptideLength'), '', "No peptide signal length reported")
194         }
195     $i++;