Mercurial > repos > willmclaren > ensembl_vep
comparison variant_effect_predictor/Bio/EnsEMBL/Variation/Study.pm @ 0:21066c0abaf5 draft
Uploaded
author | willmclaren |
---|---|
date | Fri, 03 Aug 2012 10:04:48 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:21066c0abaf5 |
---|---|
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::Study | |
22 # | |
23 # Copyright (c) 2011 Ensembl | |
24 # | |
25 | |
26 | |
27 =head1 NAME | |
28 | |
29 Bio::EnsEMBL::Variation::Study - Ensembl representation of a study. | |
30 | |
31 =head1 SYNOPSIS | |
32 | |
33 # Study | |
34 $study = Bio::EnsEMBL::Variation::Study->new | |
35 (-name => 'EGAS00000000001', | |
36 -external_reference => 'pubmed/17554300', | |
37 -url => 'http://www.ebi.ac.uk/ega/page.php?page=study&study=EGAS00000000001&cat=www.wtccc.studies.xml.ega&subcat=BD' | |
38 ); | |
39 ... | |
40 | |
41 | |
42 =head1 DESCRIPTION | |
43 | |
44 This is a class representing a study from the ensembl-variation database. | |
45 | |
46 =head1 METHODS | |
47 | |
48 =cut | |
49 | |
50 use strict; | |
51 use warnings; | |
52 | |
53 package Bio::EnsEMBL::Variation::Study; | |
54 | |
55 use Bio::EnsEMBL::Storable; | |
56 use Bio::EnsEMBL::Utils::Exception qw(throw warning); | |
57 use Bio::EnsEMBL::Utils::Argument qw(rearrange); | |
58 | |
59 our @ISA = ('Bio::EnsEMBL::Storable'); | |
60 | |
61 | |
62 =head2 new | |
63 | |
64 Arg [-dbID] : | |
65 see superclass constructor | |
66 Arg [-ADAPTOR] : | |
67 see superclass constructor | |
68 Arg [-NAME] : | |
69 name of the study | |
70 Arg [-DESCRIPTION] : | |
71 study description | |
72 Arg [-URL] : | |
73 string - url of the database/file where the data are stored | |
74 Arg [-EXTERNAL_REFERENCE] : | |
75 string - the pubmed/ids or project/study names | |
76 Arg [-TYPE] : | |
77 string - type of the study (e.g. GWAS) | |
78 Arg [-SOURCE] : | |
79 string - name of the source | |
80 Arg [-ASSOCIATE] : | |
81 array ref - list of the study objects associated with the current study | |
82 | |
83 Example : | |
84 | |
85 $study = Bio::EnsEMBL::Variation::Study->new | |
86 (-name => 'EGAS00000000001', | |
87 -external_reference => 'pubmed/17554300', | |
88 -url => 'http://www.ebi.ac.uk/ega/page.php?page=study&study=EGAS00000000001&cat=www.wtccc.studies.xml.ega&subcat=BD' | |
89 ); | |
90 | |
91 Description: Constructor. Instantiates a new Study object. | |
92 Returntype : Bio::EnsEMBL::Variation::Study | |
93 Exceptions : none | |
94 Caller : general | |
95 Status : At Risk | |
96 | |
97 =cut | |
98 | |
99 sub new { | |
100 my $caller = shift; | |
101 my $class = ref($caller) || $caller; | |
102 | |
103 my $self = $class->SUPER::new(@_); | |
104 my ($dbID,$adaptor,$study_name,$study_description,$study_url,$external_reference, | |
105 $study_type,$source_name,$associate) = | |
106 rearrange([qw(dbID ADAPTOR NAME DESCRIPTION URL EXTERNAL_REFERENCE TYPE SOURCE ASSOCIATE)], @_); | |
107 | |
108 $self = { | |
109 'dbID' => $dbID, | |
110 'adaptor' => $adaptor, | |
111 'name' => $study_name, | |
112 'description' => $study_description, | |
113 'url' => $study_url, | |
114 'external_reference' => $external_reference, | |
115 'type' => $study_type, | |
116 'source' => $source_name, | |
117 'associate' => $associate | |
118 }; | |
119 | |
120 return bless $self, $class; | |
121 } | |
122 | |
123 | |
124 =head2 name | |
125 | |
126 Arg [1] : string $newval (optional) | |
127 The new value to set the name attribute to | |
128 Example : $name = $obj->name() | |
129 Description: Getter/Setter for the name attribute | |
130 Returntype : string | |
131 Exceptions : none | |
132 Caller : general | |
133 Status : At Risk | |
134 | |
135 =cut | |
136 | |
137 sub name{ | |
138 my $self = shift; | |
139 return $self->{'name'} = shift if(@_); | |
140 return $self->{'name'}; | |
141 } | |
142 | |
143 | |
144 =head2 description | |
145 | |
146 Arg [1] : string $newval (optional) | |
147 The new value to set the description attribute to | |
148 Example : $name = $obj->description() | |
149 Description: Getter/Setter for the description attribute | |
150 Returntype : string | |
151 Exceptions : none | |
152 Caller : general | |
153 Status : At Risk | |
154 | |
155 =cut | |
156 | |
157 sub description{ | |
158 my $self = shift; | |
159 return $self->{'description'} = shift if(@_); | |
160 return $self->{'description'}; | |
161 } | |
162 | |
163 | |
164 =head2 url | |
165 | |
166 Arg [1] : string $newval (optional) | |
167 The new value to set the url attribute to | |
168 Example : $name = $obj->url() | |
169 Description: Getter/Setter for the url attribute | |
170 Returntype : string | |
171 Exceptions : none | |
172 Caller : general | |
173 Status : At Risk | |
174 | |
175 =cut | |
176 | |
177 sub url{ | |
178 my $self = shift; | |
179 return $self->{'url'} = shift if(@_); | |
180 return $self->{'url'}; | |
181 } | |
182 | |
183 | |
184 =head2 external_reference | |
185 | |
186 Arg [1] : string $newval (optional) | |
187 The new value to set the external_reference attribute to | |
188 Example : $name = $obj->external_reference() | |
189 Description: Getter/Setter for the external_reference attribute | |
190 Returntype : string | |
191 Exceptions : none | |
192 Caller : general | |
193 Status : At Risk | |
194 | |
195 =cut | |
196 | |
197 sub external_reference{ | |
198 my $self = shift; | |
199 return $self->{'external_reference'} = shift if(@_); | |
200 return $self->{'external_reference'}; | |
201 } | |
202 | |
203 | |
204 =head2 type | |
205 | |
206 Arg [1] : string $newval (optional) | |
207 The new value to set the type attribute to | |
208 Example : $name = $obj->type() | |
209 Description: Getter/Setter for the type attribute | |
210 Returntype : string | |
211 Exceptions : none | |
212 Caller : general | |
213 Status : At Risk | |
214 | |
215 =cut | |
216 | |
217 sub type{ | |
218 my $self = shift; | |
219 return $self->{'type'} = shift if(@_); | |
220 return $self->{'type'}; | |
221 } | |
222 | |
223 | |
224 =head2 source | |
225 | |
226 Arg [1] : string $newval (optional) | |
227 The new value to set the source attribute to | |
228 Example : $name = $obj->source() | |
229 Description: Getter/Setter for the source attribute | |
230 Returntype : string | |
231 Exceptions : none | |
232 Caller : general | |
233 Status : At Risk | |
234 | |
235 =cut | |
236 | |
237 sub source{ | |
238 my $self = shift; | |
239 return $self->{'source'} = shift if(@_); | |
240 return $self->{'source'}; | |
241 } | |
242 | |
243 | |
244 =head2 associated_studies | |
245 Example : $name = $obj->associate_studies() | |
246 Description: Getter/Setter for the associated_studies attribute | |
247 Returntype : reference to list of Bio::EnsEMBL::Variation::Study | |
248 Exceptions : none | |
249 Caller : general | |
250 Status : At Risk | |
251 | |
252 =cut | |
253 | |
254 sub associated_studies{ | |
255 my $self = shift; | |
256 | |
257 my $results; | |
258 | |
259 if (defined($self->{'associate'}) && defined($self->{'adaptor'})) { | |
260 my $studya = $self->{'adaptor'}->db()->get_StudyAdaptor(); | |
261 return $studya->fetch_all_by_dbID_list($self->{'associate'}); | |
262 } | |
263 else { | |
264 return []; | |
265 } | |
266 } |