0
|
1 #
|
|
2 # Ensembl module for Bio::EnsEMBL::Funcgen::ProbeSet
|
|
3 #
|
|
4
|
|
5 =head1 LICENSE
|
|
6
|
|
7 Copyright (c) 1999-2011 The European Bioinformatics Institute and
|
|
8 Genome Research Limited. All rights reserved.
|
|
9
|
|
10 This software is distributed under a modified Apache license.
|
|
11 For license details, please see
|
|
12
|
|
13 http://www.ensembl.org/info/about/code_licence.html
|
|
14
|
|
15 =head1 CONTACT
|
|
16
|
|
17 Please email comments or questions to the public Ensembl
|
|
18 developers list at <ensembl-dev@ebi.ac.uk>.
|
|
19
|
|
20 Questions may also be sent to the Ensembl help desk at
|
|
21 <helpdesk@ensembl.org>.
|
|
22
|
|
23 =head1 NAME
|
|
24
|
|
25 Bio::EnsEMBL::Funcgen::ProbeSet - A module to represent a probeset.
|
|
26
|
|
27 =head1 SYNOPSIS
|
|
28
|
|
29 use Bio::EnsEMBL::Registry;
|
|
30 use Bio::EnsEMBL::Funcgen::ProbeSet;
|
|
31
|
|
32
|
|
33 my $reg = Bio::EnsEMBL::Registry->load_adaptors_from_db(-host => 'ensembldb.ensembl.org',
|
|
34 -user => 'anonymous');
|
|
35
|
|
36 my $pset_adaptor = $reg->get_adaptor($species, 'funcgen', 'ProbeSet');
|
|
37
|
|
38 ### Creating/storing a ProbeSet ###
|
|
39
|
|
40 my $probe_set = Bio::EnsEMBL::Funcgen::ProbeSet->new(-NAME => 'ProbeSet-1',
|
|
41 -SIZE => 1,
|
|
42 -FAMILY => "ENCODE REGIONS",#optional
|
|
43 );
|
|
44
|
|
45 $pset_adaptor->store($probe_set);
|
|
46
|
|
47
|
|
48 ### Fetching associated transcripts ###
|
|
49 # Generated by the Ensembl array mapping pipeline
|
|
50
|
|
51 my @dbentries = @{$probe_set->fetch_all_Transcript_DBEntries};
|
|
52 my $trans_adaptor = $reg->get_adpator($species, 'core', 'Transcript');
|
|
53
|
|
54 foreach my $dbe(@dbentries){
|
|
55
|
|
56 my $tx = $trans_adaptor->fetch_by_stable_id($dbe->primary_id);
|
|
57
|
|
58 #Print the transcript info and the linkage annotation
|
|
59 print $tx->stable_id."\t".$probe_set->name.' '.$dbe->linkage_annotation."\n";
|
|
60 }
|
|
61
|
|
62 #Alternatively these annotations are also available in a transcript centric manner
|
|
63 #using the ProbeSetAdaptor
|
|
64
|
|
65
|
|
66 =head1 DESCRIPTION
|
|
67
|
|
68 A ProbeSet object represents a set of probes on a microarray. The
|
|
69 data (currently the name, size, and family) are stored in the probe_set
|
|
70 table. ProbeSets are only really relevant for Affy probes, or when
|
|
71 avaliable these will be analagous to Nimblegen feature sets.
|
|
72
|
|
73 For Affy arrays, a probeset can be part of more than one array, containing unique
|
|
74 probes.
|
|
75
|
|
76 #Need to rewrite this bit
|
|
77 #Something about array_chip_id i.e. experimental validation etc
|
|
78 On each Affy array the probe has a slightly different name. For
|
|
79 example, two different complete names for the same probe might be
|
|
80 DrosGenome1:AFFX-LysX-5_at:535:35; and Drosophila_2:AFFX-LysX-5_at:460:51;. In
|
|
81 the database, these two probes will have the same probe_id. Thus the same
|
|
82 Affy probe can have a number of different names and complete names depending on
|
|
83 which array it is on.
|
|
84
|
|
85
|
|
86 =head1 SEE ALSO
|
|
87
|
|
88 Bio::EnsEMBL::Funcgen::ProbeSetAdaptor
|
|
89 ensembl-functgenomics/scripts/examples/microarray_annotation_example.pl
|
|
90
|
|
91 Or for details on how to run the array mapping pipeline see:
|
|
92 ensembl-functgenomics/docs/array_mapping.txt
|
|
93
|
|
94 =cut
|
|
95
|
|
96 use strict;
|
|
97 use warnings;
|
|
98
|
|
99 package Bio::EnsEMBL::Funcgen::ProbeSet;
|
|
100
|
|
101 use Bio::EnsEMBL::Utils::Argument qw( rearrange ) ;
|
|
102 use Bio::EnsEMBL::Utils::Exception qw( throw warning );
|
|
103 use Bio::EnsEMBL::Funcgen::Storable;
|
|
104
|
|
105 use vars qw(@ISA);
|
|
106 @ISA = qw(Bio::EnsEMBL::Funcgen::Storable);
|
|
107
|
|
108
|
|
109 =head2 new
|
|
110
|
|
111 Arg [-NAME] : string - probeset name
|
|
112 Arg [-SIZE] : int - probe set size
|
|
113 Will be the same for all probes sets if same probe set
|
|
114 is on multiple arrays.
|
|
115 Arg [-FAMILY] : string - probe set family, generic descriptor for probe set e.g. ENCODE REGIONS, RANDOM
|
|
116 Will be the same for all probes sets if same probe set is on multiple arrays.
|
|
117 Example : my $probeset = Bio::EnsEMBL::Funcgen::ProbeSet->new(
|
|
118 -NAME => 'ProbeSet-1',
|
|
119 -SIZE => 1,
|
|
120 -FAMILY => "ENCODE_REGIONS",
|
|
121 );
|
|
122 Description: Creates a new Bio::EnsEMBL::Funcgen::ProbeSet object.
|
|
123 Returntype : Bio::EnsEMBL::Funcgen::ProbeSet
|
|
124 Exceptions : Throws if not supplied with probeset name and array chip id(s)
|
|
125 Caller : General
|
|
126 Status : Medium Risk
|
|
127
|
|
128 =cut
|
|
129
|
|
130 sub new {
|
|
131 my $caller = shift;
|
|
132
|
|
133 my $class = ref($caller) || $caller;
|
|
134
|
|
135 my $self = $class->SUPER::new(@_);
|
|
136
|
|
137 #warn("The only way to get array names/ids, is to retrieve all the probes!!!");
|
|
138
|
|
139
|
|
140 my (
|
|
141 $name, $size,
|
|
142 $family
|
|
143 ) = rearrange([
|
|
144 'NAME', 'SIZE',
|
|
145 'FAMILY',
|
|
146 ], @_);
|
|
147
|
|
148
|
|
149 $self->name($name) if defined $name;
|
|
150 $self->family($family) if defined $family;
|
|
151 $self->size($size) if defined $size;
|
|
152
|
|
153 return $self;
|
|
154 }
|
|
155
|
|
156
|
|
157
|
|
158 #=head2 get_all_ProbeFeatures
|
|
159
|
|
160 # Args : None
|
|
161 # Example : my $features = $probeset->get_all_ProbeFeatures();
|
|
162 # Description: Get all features produced by this probeset. The probeset needs to be
|
|
163 # database persistent.
|
|
164 # Returntype : Listref of Bio::EnsEMBL::Funcgen::ProbeFeature objects
|
|
165 # Exceptions : None
|
|
166 # Caller : General
|
|
167 # Status : Medium Risk
|
|
168
|
|
169 #=cut
|
|
170
|
|
171 sub get_all_ProbeFeatures {
|
|
172 my $self = shift;
|
|
173
|
|
174 throw("Not implemented yet, do we want to do this for ProbeSet or just probe?");
|
|
175
|
|
176 if ( $self->adaptor() && $self->dbID() ) {
|
|
177 return $self->adaptor()->db()->get_ProbeFeatureAdaptor()->fetch_all_by_ProbeSet($self);
|
|
178 } else {
|
|
179 warning('Need database connection to retrieve Features');
|
|
180 return [];
|
|
181 }
|
|
182 }
|
|
183
|
|
184 =head2 get_all_Arrays
|
|
185
|
|
186 Args : None
|
|
187 Example : my $arrays = $probeset->get_all_Arrays();
|
|
188 Description: Returns all arrays that this probeset is part of. Only works if the
|
|
189 probedet was retrieved from the database or created using
|
|
190 add_Array_probename.
|
|
191 Returntype : Listref of Bio::EnsEMBL::Funcgen::Array objects
|
|
192 Exceptions : None
|
|
193 Caller : General
|
|
194 Status : Medium Risk
|
|
195
|
|
196 =cut
|
|
197
|
|
198 sub get_all_Arrays {
|
|
199 my $self = shift;
|
|
200
|
|
201 if (defined $self->{'arrays'}) {
|
|
202 return $self->{'arrays'};
|
|
203 }
|
|
204 else{
|
|
205 $self->{arrays} = $self->adaptor->db->get_ArrayAdaptor->fetch_all_by_ProbeSet($self);
|
|
206 }
|
|
207
|
|
208 $self->{arrays}
|
|
209 }
|
|
210
|
|
211
|
|
212 =head2 get_all_Probes
|
|
213
|
|
214 Args : None
|
|
215 Example : my @probes = @{$probeset->get_all_Probes();
|
|
216 Description: Returns all probes belonging to this ProbeSet
|
|
217 Returntype : Listref of Bio::EnsEMBL::Funcgen::Probe objects
|
|
218 Exceptions : None
|
|
219 Caller : General
|
|
220 Status : At Risk
|
|
221
|
|
222 =cut
|
|
223
|
|
224 sub get_all_Probes {
|
|
225 my $self = shift;
|
|
226
|
|
227 if (defined $self->{'probes'}) {
|
|
228 return $self->{'probes'};
|
|
229 }
|
|
230 else{
|
|
231 $self->{probes} = $self->adaptor->db->get_ProbeAdaptor->fetch_all_by_ProbeSet($self);
|
|
232 }
|
|
233
|
|
234 $self->{probes}
|
|
235 }
|
|
236
|
|
237
|
|
238
|
|
239 #sub get_all_array_chips_ids?
|
|
240 #sub get_all_Results? from_Experiment?
|
|
241
|
|
242 =head2 name
|
|
243
|
|
244 Arg [1] : string - aprobeset name
|
|
245 Example : my $probesetname = $probeset->name('probeset-1');
|
|
246 Description: Getter/Setter for the name attribute of ProbeSet objects.
|
|
247 Returntype : string
|
|
248 Exceptions : None
|
|
249 Caller : General
|
|
250 Status : Medium Risk
|
|
251
|
|
252 =cut
|
|
253
|
|
254 sub name {
|
|
255 my $self = shift;
|
|
256 $self->{'name'} = shift if @_;
|
|
257 return $self->{'name'};
|
|
258 }
|
|
259
|
|
260
|
|
261 =head2 family
|
|
262
|
|
263 Arg [1] : (optional) string - family
|
|
264 Example : my $family = $probe->family();
|
|
265 Description: Getter and setter of family attribute for ProbeSet
|
|
266 objects. e.g. EXPERIMENTAL or CONTROL
|
|
267 Returntype : string
|
|
268 Exceptions : None
|
|
269 Caller : General
|
|
270 Status : Medium Risk
|
|
271
|
|
272 =cut
|
|
273
|
|
274 sub family {
|
|
275 my $self = shift;
|
|
276 $self->{'family'} = shift if @_;
|
|
277 return $self->{'family'};
|
|
278 }
|
|
279
|
|
280 =head2 size
|
|
281
|
|
282 Arg [1] : (optional) int - probeset size
|
|
283 Example : my $probeset_size = $probeset->size();
|
|
284 Description: Getter and setter of probeset size attribute for ProbeSet
|
|
285 objects.
|
|
286 Returntype : int
|
|
287 Exceptions : None
|
|
288 Caller : General
|
|
289 Status : Medium Risk
|
|
290
|
|
291 =cut
|
|
292
|
|
293 sub size {
|
|
294 my $self = shift;
|
|
295 $self->{'size'} = shift if @_;
|
|
296 return $self->{'size'};
|
|
297 }
|
|
298
|
|
299 1;
|
|
300
|