comparison variant_effect_predictor/Bio/EnsEMBL/Map/Qtl.pm @ 0:1f6dce3d34e0

Uploaded
author mahtabm
date Thu, 11 Apr 2013 02:01:53 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1f6dce3d34e0
1 =head1 LICENSE
2
3 Copyright (c) 1999-2012 The European Bioinformatics Institute and
4 Genome Research Limited. All rights reserved.
5
6 This software is distributed under a modified Apache license.
7 For license details, please see
8
9 http://www.ensembl.org/info/about/code_licence.html
10
11 =head1 CONTACT
12
13 Please email comments or questions to the public Ensembl
14 developers list at <dev@ensembl.org>.
15
16 Questions may also be sent to the Ensembl help desk at
17 <helpdesk@ensembl.org>.
18
19 =cut
20
21 =head1 NAME
22
23 Bio::EnsEMBL::Map::Qtl
24
25 =head1 SYNOPSIS
26
27 =head1 DESCRIPTION
28
29 Represents a Qtl in the EnsEMBL database. A quantitative trait locus is
30 defined by three markers, two flanking and one peak (optional) marker.
31 Its a region (or more often a group of regions) which is likely to
32 affect the phenotype (trait) described in this Qtl.
33
34 =head1 METHODS
35
36 =cut
37
38 package Bio::EnsEMBL::Map::Qtl;
39
40 use strict;
41 use vars qw(@ISA);
42
43 use Bio::EnsEMBL::Storable;
44 use Bio::EnsEMBL::Utils::Exception qw(throw deprecate);
45
46 @ISA = qw(Bio::EnsEMBL::Storable);
47
48
49
50 =head2 new
51
52 Arg [1] : int $dbID
53 Arg [2] : Bio::EnsEMBL::Map::DBSQL::QtlAdaptor $adaptor
54 Arg [3] : Bio::EnsEMBL::Map::Marker $flank_marker_1
55 Arg [4] : Bio::EnsEMBL::Map::Marker $peak_marker
56 Arg [5] : Bio::EnsEMBL::Map::Marker $flank_marker_2
57 Arg [6] : string $trait
58 Arg [7] : float $lod_score
59 Arg [8] : hashref $synonyms
60 A hashref with source keys and identifier values
61 Example : none
62 Description: Creates a new Qtl object. Usually done by Adaptor
63 Returntype : Bio::EnsEMBL::Map::Qtl
64 Exceptions : none
65 Caller : general, DBSQL::QtlAdaptor, DBSQL::QtlFeatureAdaptor
66 Status : stable
67
68 =cut
69
70 sub new {
71 my ( $class, $dbID, $adaptor, $flank_marker_1, $peak_marker,
72 $flank_marker_2, $trait, $lod_score,
73 $synonyms ) = @_;
74
75 $class = ref( $class ) ||$class;
76 my $self = bless( {
77 'dbID' => $dbID,
78 'flank_marker_1' => $flank_marker_1,
79 'flank_marker_2' => $flank_marker_2,
80 'peak_marker' => $peak_marker,
81 'trait' => $trait,
82 'lod_score' => $lod_score,
83 'synonyms' => $synonyms
84 }, $class );
85 $self->adaptor($adaptor);
86 return $self;
87 }
88
89
90 =head2 add_synonym
91
92 Arg [1] : string $source
93 The source of the synonym
94 Arg [2] : string $identifier
95 The identifier from this source
96 Example : $qtl->add_synonym('rat genome database', '65516');
97 Description: Adds a synonym to this qtl
98 Returntype : none
99 Exceptions : thrown if arguments are not provided
100 Caller : general
101 Status : stable
102
103 =cut
104
105 sub add_synonym {
106 my $self = shift;
107 my $source = shift;
108 my $identifier = shift;
109
110 unless($source && $identifier) {
111 throw('Source and identifier arguments are required');
112 }
113
114 $self->{'synonyms'}->{$source} = $identifier;
115 }
116
117
118 =head2 get_synonyms
119
120 Arg [1] : none
121 Example :
122 foreach my $source ($keys %{$qtl->get_synonyms}) {
123 print $source . ':'. $qtl->get_synonyms->{$source};
124 }
125 Description: Returns a hashref of synonyms keyed on their source name
126 Returntype : hashref of synonyms keyed on their source name
127 Exceptions : none
128 Caller : general
129 Status : stable
130
131 =cut
132
133 sub get_synonyms {
134 my $self = shift;
135
136 return $self->{'synonyms'} || {};
137 }
138
139
140
141 =head2 trait
142
143 Arg [1] : string $trait
144 Phenotype of this Qtl
145 Example : none
146 Description: Getter/Setter for the trait attribute
147 Returntype : string
148 Exceptions : none
149 Caller : general
150 Status : stable
151
152 =cut
153
154 sub trait {
155 my $self = shift;
156
157 if(@_) {
158 $self->{'trait'} = shift;
159 }
160
161 return $self->{'trait'};
162 }
163
164
165 =head2 lod_score
166
167 Arg [1] : float $lod_score
168 A score for the Qtl
169 Example : none
170 Description: Getter/Setter for attribute lod_score
171 Returntype : float
172 Exceptions : none
173 Caller : general
174 Status : stable
175
176 =cut
177
178 sub lod_score {
179 my $self = shift;
180
181 if(@_) {
182 $self->{'lod_score'} = shift;
183 }
184
185 return $self->{'lod_score'};
186 }
187
188
189 =head2 peak_marker
190
191 Arg [1] : Bio::EnsEMBL::Map::Marker $peak_marker
192 an optional Marker which has the peak probablitity
193 for this traits occurence
194 Example : none
195 Description: Getter/Setter for attribute peak_marker
196 Returntype : Bio::EnsEMBL::Map::Marker
197 Exceptions : none
198 Caller : general
199 Status : stable
200
201 =cut
202
203 sub peak_marker {
204 my $self = shift;
205
206 if(@_) {
207 $self->{'peak_marker'} = shift;
208 }
209
210 return $self->{'peak_marker'};
211 }
212
213
214 =head2 flank_marker_1
215
216 Arg [1] : Bio::EnsEMBL::Map::Marker $flank_marker_1
217 One flanking marker of the interest region, the two flanking
218 markers define the region
219 Example : none
220 Description: Getter/Setter attribute flanking_marker_1
221 Returntype : Bio::EnsEMBL::Map::Marker
222 Exceptions : none
223 Caller : general
224 Status : stable
225
226 =cut
227
228 sub flank_marker_1 {
229 my $self = shift;
230
231 if(@_) {
232 $self->{'flank_marker_1'} = shift;
233 }
234
235 return $self->{'flank_marker_1'};
236 }
237
238
239
240 =head2 flank_marker_2
241
242 Arg [1] : Bio::EnsEMBL::Map::Marker $flank_marker_2
243 One flanking marker of the interest region, the two flanking
244 markers define the region
245 Example : none
246 Description: Getter/Setter attribute flanking_marker_2
247 Returntype : Bio::EnsEMBL::Map::Marker
248 Exceptions : none
249 Caller : general
250 Status : stable
251
252 =cut
253
254
255 sub flank_marker_2 {
256 my $self = shift;
257
258 if(@_) {
259 $self->{'flank_marker_2'} = shift;
260 }
261
262 return $self->{'flank_marker_2'};
263 }
264
265
266
267 =head2 get_QtlFeatures
268
269 Args : none
270 Example : none
271 Description: return the qtl feature which is associated with this
272 Qtl. It comes in chromosomal slice coordinates. There can
273 only be one.
274 Returntype : Bio::EnsEMBL::Map::QtlFeature
275 Exceptions : only works with adaptored Qtls
276 Caller : general
277 Status : stable
278
279 =cut
280
281 sub get_QtlFeature {
282 my $self = shift;
283
284 my $adaptor = $self->adaptor();
285 return undef unless $adaptor;
286 my $result = $adaptor->db()->get_QtlFeatureAdaptor()->
287 fetch_all_by_Qtl( $self );
288
289 if( @$result ) {
290 return $result->[0];
291 } else {
292 return;
293 }
294 }
295
296
297
298
299
300 =head2 source_database
301
302 This method is deprecated. Use get_synonyms or add_synonym instead.
303
304 =cut
305
306 sub source_database {
307 my $self = shift;
308
309 deprecate('Use get_synonyms or add_synonym instead');
310
311 my $syns = $self->get_synonyms;
312 my ($source) = keys %$syns;
313
314 return $source || '';
315 }
316
317
318 =head2 source_primary_id
319
320 This method is deprecated. Use get_synonyms or add_synonym instead.
321
322 =cut
323
324 sub source_primary_id {
325 my $self = shift;
326
327 deprecate('Use get_synonyms or add_synonym instead');
328
329 my $syns = $self->get_synonyms;
330 my ($source) = keys %$syns;
331
332 if($source) {
333 return $syns->{$source};
334 }
335
336 return '';
337 }
338
339
340 1;