0
|
1 # HMM.pm
|
|
2 #
|
|
3 # Author: finnr
|
|
4 # Maintainer: $Id: HMM.pm,v 1.1 2009-10-08 12:27:28 jt6 Exp $
|
|
5 # Version: $Revision: 1.1 $
|
|
6 # Created: Nov 24, 2008
|
|
7 # Last Modified: $Date: 2009-10-08 12:27:28 $
|
|
8 =head1 NAME
|
|
9
|
|
10 Template - a short description of the class
|
|
11
|
|
12 =cut
|
|
13
|
|
14 package Bio::Pfam::HMM::HMM;
|
|
15
|
|
16 =head1 DESCRIPTION
|
|
17
|
|
18 A more detailed description of what this class does and how it does it.
|
|
19
|
|
20 $Id: HMM.pm,v 1.1 2009-10-08 12:27:28 jt6 Exp $
|
|
21
|
|
22 =head1 COPYRIGHT
|
|
23
|
|
24 File: HMM.pm
|
|
25
|
|
26 Copyright (c) 2007: Genome Research Ltd.
|
|
27
|
|
28 Authors: Rob Finn (rdf@sanger.ac.uk), John Tate (jt6@sanger.ac.uk)
|
|
29
|
|
30 This is free software; you can redistribute it and/or
|
|
31 modify it under the terms of the GNU General Public License
|
|
32 as published by the Free Software Foundation; either version 2
|
|
33 of the License, or (at your option) any later version.
|
|
34
|
|
35 This program is distributed in the hope that it will be useful,
|
|
36 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
37 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
38 GNU General Public License for more details.
|
|
39
|
|
40 You should have received a copy of the GNU General Public License
|
|
41 along with this program; if not, write to the Free Software
|
|
42 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
43 or see the on-line version at http://www.gnu.org/copyleft/gpl.txt
|
|
44
|
|
45 =cut
|
|
46
|
|
47 use strict;
|
|
48 use warnings;
|
|
49
|
|
50 use Moose;
|
|
51 use Moose::Util::TypeConstraints;
|
|
52 use Carp;
|
|
53
|
|
54 #-------------------------------------------------------------------------------
|
|
55
|
|
56 =head1 METHODS
|
|
57
|
|
58 =cut
|
|
59
|
|
60
|
|
61 subtype 'hmmVersion'
|
|
62 => as Str
|
|
63 => where { $_ =~ m/^HMMER3\/f\s+\[3\.\d+[ab](\d+)?\s+|\s+\[.*\]/ }
|
|
64 => message { "|$_| does not look like as HMMER3 version" };
|
|
65
|
|
66 subtype 'hmmName'
|
|
67 => as Str
|
|
68 => where { $_ =~ m/\S{1,15}/ }
|
|
69 => message { "|$_| does not look like Pfam name or SEED" };
|
|
70
|
|
71 subtype 'hmmAcc'
|
|
72 => as Str
|
|
73 => where { $_ =~ m/PF\d{5}/ }
|
|
74 => message { "|$_| does not look like Pfam accession" };
|
|
75
|
|
76
|
|
77 subtype 'hmmAlpha'
|
|
78 => as Str
|
|
79 => where { $_ eq 'amino' or $_ eq 'nucleic' }
|
|
80 => message { "|$_| does not look like a HMMER3 alphabet" };
|
|
81
|
|
82
|
|
83 subtype 'hmmMsvStats'
|
|
84 => as HashRef
|
|
85 => where { defined ($_->{mu}) and defined ($_->{lambda}) and ($_->{lambda} <= 0.8) and ($_->{lambda} >= 0.5) }
|
|
86 => message { "Mu |$_->{mu}| and lambda |$_->{lambda}| must be defined and lambda must be between 0.5 and 0.8" };
|
|
87
|
|
88
|
|
89 subtype 'hmmViterbiStats'
|
|
90 => as HashRef
|
|
91 => where { defined ($_->{mu}) and defined ($_->{lambda}) and ($_->{lambda} <= 0.8) and ($_->{lambda} >= 0.5) }
|
|
92 => message { "Mu |$_->{mu}| and lambda |$_->{lambda}| must be defined and lambda must be between 0.5 and 0.8" };
|
|
93
|
|
94 subtype 'hmmForwardStats'
|
|
95 => as HashRef
|
|
96 => where { defined ($_->{tau}) and defined ($_->{lambda}) and ($_->{lambda} <= 0.8) and ($_->{lambda} >= 0.5) }
|
|
97 => message { "Tau |$_->{tau}| and lambda |$_->{lambda}| must be defined and lambda must be between 0.5 and 0.8" };
|
|
98
|
|
99 has 'version' => (
|
|
100 isa => 'hmmVersion',
|
|
101 is => 'rw',
|
|
102 required => 1
|
|
103 );
|
|
104
|
|
105 has 'name' => (
|
|
106 isa => 'hmmName',
|
|
107 is => 'rw',
|
|
108 required => 1
|
|
109 );
|
|
110
|
|
111 has 'accession' => (
|
|
112 isa => 'hmmAcc',
|
|
113 is => 'rw'
|
|
114 );
|
|
115
|
|
116 has 'description' => (
|
|
117 isa => 'Str',
|
|
118 is => 'rw'
|
|
119 );
|
|
120
|
|
121 has 'length' => (
|
|
122 isa => 'Int',
|
|
123 is => 'rw',
|
|
124 required => 1
|
|
125 );
|
|
126
|
|
127 has 'alpha' => (
|
|
128 isa => 'hmmAlpha',
|
|
129 is => 'rw',
|
|
130 required => 1,
|
|
131 );
|
|
132
|
|
133 has 'rf' => (
|
|
134 isa => 'Bool',
|
|
135 is => 'rw',
|
|
136 required => 1
|
|
137 );
|
|
138
|
|
139 has 'mm' => (
|
|
140 isa => 'Bool',
|
|
141 is => 'rw',
|
|
142 );
|
|
143
|
|
144 has 'cons' => (
|
|
145 isa => 'Bool',
|
|
146 is => 'rw',
|
|
147 );
|
|
148
|
|
149 has 'cs' => (
|
|
150 isa => 'Bool',
|
|
151 is => 'rw',
|
|
152 required => 1
|
|
153 );
|
|
154
|
|
155 has 'map' => (
|
|
156 isa => 'Bool',
|
|
157 is => 'rw',
|
|
158 required => 1
|
|
159 );
|
|
160
|
|
161 has 'date' => (
|
|
162 isa => 'Str',
|
|
163 is => 'rw',
|
|
164 required => 1
|
|
165 );
|
|
166
|
|
167 has 'buildLine' => (
|
|
168 isa => 'HashRef[Str]',
|
|
169 is => 'rw',
|
|
170 required => 1,
|
|
171 default => sub { {} },
|
|
172 );
|
|
173
|
|
174 has 'searchMethod' => (
|
|
175 isa => 'Str',
|
|
176 is => 'rw',
|
|
177 );
|
|
178
|
|
179 has 'nSeq' => (
|
|
180 isa => 'Int',
|
|
181 is => 'rw',
|
|
182 required => 1
|
|
183 );
|
|
184
|
|
185 has 'msvStats' => (
|
|
186 isa => 'hmmMsvStats',
|
|
187 is => 'rw',
|
|
188 required => 1
|
|
189 );
|
|
190
|
|
191 has 'viterbiStats' => (
|
|
192 isa => 'hmmViterbiStats',
|
|
193 is => 'rw',
|
|
194 required => 1
|
|
195 );
|
|
196
|
|
197 has 'forwardStats' => (
|
|
198 isa => 'hmmForwardStats',
|
|
199 is => 'rw',
|
|
200 required => 1
|
|
201 );
|
|
202
|
|
203
|
|
204 has 'effn' => (
|
|
205 isa => 'Num',
|
|
206 is => 'rw',
|
|
207 required => 1
|
|
208 );
|
|
209
|
|
210 has 'cksum' => (
|
|
211 isa => 'Int',
|
|
212 is => 'rw',
|
|
213 required => 1
|
|
214 );
|
|
215
|
|
216 has 'seqGA' => (
|
|
217 isa => 'Num',
|
|
218 is => 'rw',
|
|
219 );
|
|
220
|
|
221 has 'domGA' => (
|
|
222 isa => 'Num',
|
|
223 is => 'rw',
|
|
224 );
|
|
225
|
|
226 has 'seqTC' => (
|
|
227 isa => 'Num',
|
|
228 is => 'rw',
|
|
229 );
|
|
230
|
|
231 has 'domTC' => (
|
|
232 isa => 'Num',
|
|
233 is => 'rw',
|
|
234 );
|
|
235
|
|
236 has 'seqNC' => (
|
|
237 isa => 'Num',
|
|
238 is => 'rw',
|
|
239 );
|
|
240
|
|
241 has 'domNC' => (
|
|
242 isa => 'Num',
|
|
243 is => 'rw',
|
|
244 );
|
|
245
|
|
246 has 'emissionLines' => (
|
|
247 isa => 'ArrayRef[ArrayRef]',
|
|
248 is => 'rw',
|
|
249 default => sub { [] },
|
|
250 );
|
|
251
|
|
252 has 'mapPos'=> (
|
|
253 isa => 'ArrayRef[Int]',
|
|
254 is => 'rw',
|
|
255 default => sub{ [] }
|
|
256 );
|
|
257
|
|
258 has 'compLines' => (
|
|
259 isa => 'ArrayRef[Str]',
|
|
260 is => 'rw',
|
|
261 default => sub { [] },
|
|
262 );
|
|
263
|
|
264 __PACKAGE__->meta->make_immutable;
|
|
265 1;
|
|
266
|