comparison variant_effect_predictor/Bio/EnsEMBL/Variation/VariationAnnotation.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 # Ensembl module for Bio::EnsEMBL::Variation::VariationAnnotation
22 #
23 # Copyright (c) 2004 Ensembl
24 #
25
26
27 =head1 NAME
28
29 Bio::EnsEMBL::Variation::VariationAnnotation - A genotype phenotype annotation for a nucleotide variation.
30
31 =head1 SYNOPSIS
32
33 # Variation Annotation is associated with a variation object
34 $va = Bio::EnsEMBL::Variation::VariationAnnotation->new
35 (_variation_id => 8,
36 -phenotype_name => 'BD',
37 -phenotype_description => 'Bipolar Disorder',,
38 -associated_gene => 'HHEX',
39 -associated_variant_risk_allele => 'rs13266634-C',
40 -variation_names => 'rs13266634',
41 -risk_allele_freq_in_controls => '0.3',
42 -p_value => '6.00E-08',
43 -variation => $v);
44
45 ...
46
47 print $va->phenotype_name(),'-',$va->phenotype_description,"\n";
48 print "From source ",$va->source_name,'-',$va->study_name,"\n";
49 print " With study_type ", $va->study_type(),"\n";
50
51 ...
52 # Get the Variation object which this annotation represents
53 # If not already retrieved from the DB, this will be
54 # transparently lazy-loaded
55 my $v = $va->variation();
56
57 =head1 DESCRIPTION
58
59 This is a class representing the genotype-phenotype annotation of a variation
60 from the ensembl-variation database. The actual variation information is
61 represented by an associated Bio::EnsEMBL::Variation::Variation object.
62
63 =head1 METHODS
64
65 =cut
66
67 use strict;
68 use warnings;
69
70 package Bio::EnsEMBL::Variation::VariationAnnotation;
71
72 use Bio::EnsEMBL::Utils::Exception qw(throw warning);
73 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
74 use Bio::EnsEMBL::Variation::Variation;
75 use Bio::EnsEMBL::Storable;
76
77 use vars qw(@ISA);
78
79 @ISA = qw(Bio::EnsEMBL::Storable);
80
81 =head2 new
82
83 Arg [-dbID] :
84 int - unique internal identifier for variation_annotation
85 Arg [-ADAPTOR] :
86 Bio::EnsEMBL::Variation::DBSQL::VariationAnnotationAdaptor
87 Arg [-PHENOTYPE_NAME] :
88 string - name of the phenotype
89 Arg [-PHENOTYPE_DESCRIPTION] :
90 string - description of the phenotype
91 Arg [-VARIATION_NAMES] :
92 string - name of the associated variations
93 Arg [-VARIATION] :
94 int - the variation object associated with this annotation.
95 Arg [_VARIATION_ID] :
96 int _ the internal id of the variation object associated with this
97 identifier. This may be provided instead of a variation object so that
98 the variation may be lazy-loaded from the database on demand.
99 Arg [-ASSOCIATED_GENE] :
100 string - the gene names associated with this annotation/variant.
101 Arg [-ASSOCIATED_VARIANT_RISK_ALLELE] :
102 string - the variants-risk alleles associated with this annotation.
103 Arg [-RISK_ALLELE_FREQ_IN_CONTROLS] :
104 string - the risk allele frequency in controls associated with this annotation.
105 Arg [-P_VALUE] :
106 string - the p_value associated with this annotation.
107 Arg [-STUDY] :
108 object ref - the study object describing where the annotated variation comes from
109
110 Example :
111 $va = Bio::EnsEMBL::Variation::VariationAnnotation->new
112 (-phenotype_name => 'BD',
113 -phenotype_description => 'Bipolar Disorder',
114 -variation_names => 'rs123',
115 _variation_id => 10,
116 -associated_gene => 'HHEX',
117 -associated_variant_risk_allele => 'rs13266634-C',
118 -risk_allele_freq_in_controls => '0.3',
119 -p_value => '6.00E-08',
120 -variation => $v);
121
122 Description: Constructor. Instantiates a new VariationAnnotation object.
123 Returntype : Bio::EnsEMBL::Variation::VariationAnnotation
124 Exceptions : none
125 Caller : general
126 Status : At Risk
127
128 =cut
129
130 sub new {
131 my $caller = shift;
132 my $class = ref($caller) || $caller;
133 my $self = $class->SUPER::new(@_);
134
135 my ($dbID,$adaptor,$phenotype_id,$phenotype_name,$phenotype_description,$variation_id,$variation_names,
136 $variation,$associated_gene,$associated_variant_risk_allele,$risk_allele_freq_in_controls,$p_value,
137 $study) =
138 rearrange([qw(dbID ADAPTOR _PHENOTYPE_ID PHENOTYPE_NAME PHENOTYPE_DESCRIPTION
139 VARIATION_ID VARIATION_NAMES VARIATION ASSOCIATED_GENE ASSOCIATED_VARIANT_RISK_ALLELE
140 RISK_ALLELE_FREQ_IN_CONTROLS P_VALUE STUDY)],@_);
141
142 $self->{'dbID'} = $dbID;
143 $self->{'adaptor'} = $adaptor;
144 $self->{'_phenotype_id'} = $phenotype_id;
145 $self->{'phenotype_name'} = $phenotype_name;
146 $self->{'phenotype_description'} = $phenotype_description;
147 $self->{'variation'} = $variation;
148 $self->{'_variation_id'} = $variation_id;
149 $self->{'variation_names'} = $variation_names;
150 $self->{'associated_gene'} = $associated_gene;
151 $self->{'associated_variant_risk_allele'} = $associated_variant_risk_allele;
152 $self->{'risk_allele_freq_in_controls'} = $risk_allele_freq_in_controls;
153 $self->{'p_value'} = $p_value;
154 $self->{'study'} => $study,
155 return $self;
156 }
157
158
159
160 sub new_fast {
161 my $class = shift;
162 my $hashref = shift;
163 return bless $hashref, $class;
164 }
165
166
167 =head2 phenotype_name
168
169 Arg [1] : string phenotype_name (optional)
170 The new value to set the phenotype_name attribute to
171 Example : $phenotype_name = $obj->phenotype_name()
172 Description: Getter/Setter for the phenotype_name attribute.
173 Returntype : string
174 Exceptions : none
175 Caller : general
176 Status : Stable
177
178 =cut
179
180 sub phenotype_name{
181 my $self = shift;
182 return $self->{'phenotype_name'} = shift if(@_);
183 return $self->{'phenotype_name'};
184 }
185
186 =head2 phenotype_description
187
188 Arg [1] : string phenotype_description (optional)
189 The new value to set the phenotype_description attribute to
190 Example : $phenotype_description = $obj->phenotype_description()
191 Description: Getter/Setter for the phenotype_description attribute.
192 Returntype : string
193 Exceptions : none
194 Caller : general
195 Status : At Risk
196
197 =cut
198
199 sub phenotype_description{
200 my $self = shift;
201 return $self->{'phenotype_description'} = shift if(@_);
202 return $self->{'phenotype_description'};
203 }
204
205 =head2 source_name
206
207 Arg [1] : string source_name (optional)
208 The new value to set the source_name attribute to
209 Example : $source_name = $obj->source_name()
210 Description: Getter/Setter for the source_name attribute.
211 Returntype : string
212 Exceptions : none
213 Caller : general
214 Status : At Risk
215
216 =cut
217
218 sub source_name{
219 my $self = shift;
220 return $self->{'study'}->source = shift if(@_);
221 return $self->{'study'}->source;
222 }
223
224 =head2 study_type
225
226 Arg [1] : string study_type (optional)
227 The new value to set the study_type attribute to
228 Example : $study_type = $obj->study_type()
229 Description: Getter/Setter for the study_type attribute.
230 Returntype : string
231 Exceptions : none
232 Caller : general
233 Status : At Risk
234
235 =cut
236
237 sub study_type{
238 my $self = shift;
239 return $self->{'study'}->type = shift if(@_);
240 return $self->{'study'}->type;
241 }
242
243
244 =head2 variation
245
246 Arg [1] : (optional) Bio::EnsEMBL::Variation::Variation $variation
247 Example : $v = $va->variation();
248 Description: Getter/Setter for the variation associated with this annotation.
249 If not set, and this VariationAnnotation has an associated adaptor
250 an attempt will be made to lazy-load the variation from the
251 database.
252 Returntype : Bio::EnsEMBL::Variation::Variation
253 Exceptions : throw on incorrect argument
254 Caller : general
255 Status : Stable
256
257 =cut
258
259 sub variation {
260 my $self = shift;
261
262 if(@_) {
263 if(!ref($_[0]) || !$_[0]->isa('Bio::EnsEMBL::Variation::Variation')) {
264 throw("Bio::EnsEMBL::Variation::Variation argument expected");
265 }
266 $self->{'variation'} = shift;
267 }
268 elsif(!defined($self->{'variation'}) && $self->{'adaptor'} &&
269 defined($self->{'_variation_id'})) {
270 # lazy-load from database on demand
271 my $va = $self->{'adaptor'}->db()->get_VariationAdaptor();
272 $self->{'variation'} = $va->fetch_by_dbID($self->{'_variation_id'});
273 }
274
275 return $self->{'variation'};
276 }
277
278 =head2 variation_names
279
280 Arg [1] : string $newval (optional)
281 The new value to set the variation_names attribute to
282 Example : $variation_names = $obj->variation_names()
283 Description: Getter/Setter for the variation_names attribute. This is the
284 names of the variation associated with this study.
285 Returntype : string
286 Exceptions : none
287 Caller : general
288 Status : At Risk
289
290 =cut
291
292 sub variation_names{
293 my $self = shift;
294 return $self->{'variation_names'} = shift if(@_);
295 return $self->{'variation_names'};
296 }
297
298
299 =head2 study_name
300
301 Arg [1] : string $study_name (optional)
302 The new value to set the study_name attribute to
303 Example : $study = $sva->study_name()
304 Description: Getter/Setter for the study_name attribute
305 Returntype : string
306 Exceptions : none
307 Caller : general
308 Status : At Risk
309
310 =cut
311
312 sub study_name{
313 my $self = shift;
314 return $self->{'study'}->name = shift if(@_);
315 return $self->{'study'}->name;
316 }
317
318
319 =head2 study_description
320
321 Arg [1] : string $study_description (optional)
322 The new value to set the study_description attribute to
323 Example : $study_description = $obj->study_description()
324 Description: Getter/Setter for the study_description attribute
325 Returntype : string
326 Exceptions : none
327 Caller : general
328 Status : At Risk
329
330 =cut
331
332 sub study_description{
333 my $self = shift;
334 return $self->{'study'}->description = shift if(@_);
335 return $self->{'study'}->description;
336 }
337
338
339 =head2 external_reference
340
341 Arg [1] : string $newval (optional)
342 The new value to set the external reference attribute to
343 Example : $external_reference = $obj->external_reference()
344 Description: Getter/Setter for the external reference attribute. This is the
345 pubmed/id or project name associated with this study.
346 Returntype : string
347 Exceptions : none
348 Caller : general
349 Status : At Risk
350
351 =cut
352
353 sub external_reference{
354 my $self = shift;
355 return $self->{'study'}->external_reference = shift if(@_);
356 return $self->{'study'}->external_reference;
357 }
358
359
360 =head2 study_url
361
362 Arg [1] : string $newval (optional)
363 The new value to set the study_url attribute to
364 Example : $url = $obj->study_url()
365 Description: Getter/Setter for the study_url attribute. This is the link to the website where the data are stored.
366 Returntype : string
367 Exceptions : none
368 Caller : general
369 Status : At Risk
370
371 =cut
372
373 sub study_url{
374 my $self = shift;
375 return $self->{'study'}->url = shift if(@_);
376 return $self->{'study'}->url;
377 }
378
379
380 =head2 associated_studies
381 Example : $name = $obj->associate_studies()
382 Description: Getter/Setter for the associated_studies attribute
383 (e.g. EGA studies can be associated to NHGRI studies).
384 Returntype : reference to list of Bio::EnsEMBL::Variation::Study
385 Exceptions : none
386 Caller : general
387 Status : At Risk
388
389 =cut
390
391 sub associated_studies{
392 my $self = shift;
393 return $self->{'study'}->associated_studies;
394 }
395
396
397 =head2 associated_gene
398
399 Arg [1] : string $newval (optional)
400 The new value to set the associated_gene attribute to
401 Example : $associated_gene = $obj->associated_gene()
402 Description: Getter/Setter for the associated_gene attribute. This is the
403 gene names associated with this study.
404 Returntype : string
405 Exceptions : none
406 Caller : general
407 Status : At Risk
408
409 =cut
410
411 sub associated_gene{
412 my $self = shift;
413 return $self->{'associated_gene'} = shift if(@_);
414 return $self->{'associated_gene'};
415 }
416
417 =head2 associated_variant_risk_allele
418
419 Arg [1] : string $newval (optional)
420 The new value to set the associated_variant_risk_allele attribute to
421 Example : $associated_variant_risk_allele = $obj->associated_variant_risk_allele()
422 Description: Getter/Setter for the associated_variant_risk_allele attribute. This is the
423 associated_variant_risk_allele associated with this study.
424 Returntype : string
425 Exceptions : none
426 Caller : general
427 Status : At Risk
428
429 =cut
430
431 sub associated_variant_risk_allele{
432 my $self = shift;
433 return $self->{'associated_variant_risk_allele'} = shift if(@_);
434 return $self->{'associated_variant_risk_allele'};
435 }
436
437 =head2 risk_allele_freq_in_controls
438
439 Arg [1] : string $newval (optional)
440 The new value to set the risk_allele_freq_in_controls attribute to
441 Example : $risk_allele_freq_in_controls = $obj->risk_allele_freq_in_controls()
442 Description: Getter/Setter for the risk_allele_freq_in_controls attribute. This is the
443 risk_allele_freq_in_controls associated with this study.
444 Returntype : string
445 Exceptions : none
446 Caller : general
447 Status : At Risk
448
449 =cut
450
451 sub risk_allele_freq_in_controls{
452 my $self = shift;
453 return $self->{'risk_allele_freq_in_controls'} = shift if(@_);
454 return $self->{'risk_allele_freq_in_controls'};
455 }
456
457 =head2 p_value
458
459 Arg [1] : string $newval (optional)
460 The new value to set the p_value attribute to
461 Example : $p_value = $obj->p_value()
462 Description: Getter/Setter for the p_value attribute. This is the
463 p_value associated with this study.
464 Returntype : string
465 Exceptions : none
466 Caller : general
467 Status : At Risk
468
469 =cut
470
471 sub p_value{
472 my $self = shift;
473 return $self->{'p_value'} = shift if(@_);
474 return $self->{'p_value'};
475 }
476 1;