Debian Codegraph @

TFBS/TFFM.pm

raw symbols SCIP
1 # TFBS module for TFBS::TFFM
2 #
3 # You may distribute this module under the same terms as perl itself
4 #
5 # Date: 2015/10/06
6 #
7
8 # POD
9
10 =head1 NAME
11
12 TFBS::TFFM - class for Transcription Factor Flexible Models (TFFMs)
13
14 =head1 DESCRIPTION
15
16 TFBS::TFFM is a class to hold basic information about a TFFM. It was
17 mainly designed to store the information about a TFFM stored in the
18 TFFM table of the JASPAR DB newly introduced in the JASPAR 2016 version.
19 It does NOT (currently) store the actual XML describing the the model but
20 this would be simple to add. At the time of this writing the relationship
21 between JASPAR matrices as stored in the MATRIX table and TFFMs was not
22 completely clear and the matrix IDs related to a TFFM are stored in the
23 TFFM table. The relationship could be 1:n, m:1 or m:n in the future so
24 this may well be changed and a joining table created to facilitate this.
25
26 =head1 FEEDBACK
27
28 Please send bug reports and other comments to the author.
29
30 =head1 AUTHOR - David Arenillas
31
32 David Arenillas: [email protected]
33
34 =head1 APPENDIX
35
36 The rest of the documentation details each of the object
37 methods. Internal methods are preceded with an underscore.
38
39 =cut
40
41
42 # The code begins HERE:
43
44 package TFBS::TFFM;
45
46 use strict;
47
48 sub new
49 {
50 my $class = shift;
51 my %args = @_;
52 my $self = bless {}, ref($class) || $class;
53
54 $self->{'ID'} = $args{-ID} || "Unknown";
55 $self->{'name'} = $args{-name} || "Unknown";
56 $self->{'matrix_ID'} = $args{-matrix_ID};
57 $self->{'log_p_1st_order'} = $args{-log_p_1st_order};
58 $self->{'log_p_detailed'} = $args{-log_p_detailed};
59 $self->{'experiment_name'} = $args{-experiment_name};
60
61 # The JASPAR matrix related to this TFFM
62 my $matrix = $args{-matrix};
63 if ($matrix) {
64 if ($matrix->ISA('TFBS::Matrix')) {
65 $self->{'matrix'} = $matrix;
66 } else {
67 $self->throw(
68 "Provided -matrix argument does not refer to a TFBS::Matrix"
69 . " object"
70 );
71 }
72 }
73
74 return $self;
75 }
76
77
78 =head2 ID
79
80 Title : ID
81 Usage : my $id = $tffm->ID();
82
83 Function: Get/set the ID of this TFFM.
84 Returns : The ID of this TFFM.
85 Args : None for get or a new string ID.
86
87 =cut
88
89 sub ID
90 {
91 my ($self, $id) = @_;
92
93 if ($id) {
94 $self->{ID} = $id;
95 }
96
97 return $self->{ID};
98 }
99
100
101 =head2 name
102
103 Title : name
104 Usage : my $name = $tffm->name();
105
106 Function: Get/set the name of the transcription factor for which this TFFM
107 was modelled.
108 Returns : Name of the TF modelled by this TFFM.
109 Args : None for get or a new string TF name.
110
111 =cut
112
113 sub name
114 {
115 my ($self, $name) = @_;
116
117 if ($name) {
118 $self->{name} = $name;
119 }
120
121 return $self->{name};
122 }
123
124
125 =head2 experiment_name
126
127 Title : experiment_name
128 Usage : my $filename = $tffm->experiment_name();
129
130 Function: Get/set the name of the experimental data on which this TFFM
131 (generally ChIP-seq peak data) TFFM was trained. Often this
132 is base file name of ChIP-seq peaks file.
133 Returns : Name of the experiment/datafile.
134 Args : None for get or a new experiment/datafile name.
135
136 =cut
137
138 sub experiment_name
139 {
140 my ($self, $exp_name) = @_;
141
142 if ($exp_name) {
143 $self->{experiment_name} = $exp_name;
144 }
145
146 return $self->{experiment_name};
147 }
148
149
150 =head2 log_p_1st_order
151
152 Title : log_p_1st_order
153 Usage : my $log_p_val = $tffm->log_p_1st_order();
154
155 Function: Get/set the log(p) value for the 1st order model of this TFFM.
156 Returns : Log(p) value of the 1st-order model.
157 Args : None for get or a new 1st-order log(p) value.
158
159 =cut
160
161 sub log_p_1st_order
162 {
163 my ($self, $log_p_val) = @_;
164
165 if ($log_p_val) {
166 $self->{log_p_1st_order} = $log_p_val;
167 }
168
169 return $self->{log_p_1st_order};
170 }
171
172
173 =head2 log_p_detailed
174
175 Title : log_p_detailed
176 Usage : my $log_p_val = $tffm->log_p_detailed();
177
178 Function: Get/set the log(p) value for the detailed model of this TFFM.
179 Returns : Log(p) value of the detailed model.
180 Args : None for get or a new detailed log(p) value.
181
182 =cut
183
184 sub log_p_detailed
185 {
186 my ($self, $log_p_val) = @_;
187
188 if ($log_p_val) {
189 $self->{log_p_detailed} = $log_p_val;
190 }
191
192 return $self->{log_p_detailed};
193 }
194
195
196 =head2 matrix_ID
197
198 Title : matrix_ID
199 Usage : my $matrix_id = $tffm->matrix_ID();
200
201 Function: Get/set the ID of the matrix associated to this TFFM.
202 Returns : ID of the matrix associated to this TFFM.
203 Args : None for get or a JASPAR matrix ID.
204
205 =cut
206
207 sub matrix_ID
208 {
209 my ($self, $matrix_id) = @_;
210
211 if ($matrix_id) {
212 $self->{matrix_ID} = $matrix_id;
213 }
214
215 return $self->{matrix_ID};
216 }
217
218
219 =head2 matrix
220
221 Title : matrix
222 Usage : my $matrix = $tffm->matrix();
223
224 Function: Get/set the matrix object related to this TFFM
225 Returns : A reference to TFBS::Matrix object which was used to train the
226 TFFM.
227 Args : None for get or a new TFBS::Matrix object reference.
228
229 =cut
230
231 sub matrix
232 {
233 my ($self, $matrix) = @_;
234
235 if ($matrix) {
236 if ($matrix->ISA("TFBS::Matrix")) {
237 $self->{matrix} = $matrix;
238 } else {
239 $self->throw(
240 "Provided matrix argument does not refer to a TFBS::Matrix"
241 . " object"
242 );
243 }
244 }
245
246 return $self->{'matrix'};
247 }
248
249 1;