Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/EnsEMBL/Funcgen/ArrayChip.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 # | |
2 # Ensembl module for Bio::EnsEMBL::Funcgen::ArrayChip | |
3 # | |
4 # You may distribute this module under the same terms as Perl itself | |
5 | |
6 =head1 LICENSE | |
7 | |
8 Copyright (c) 1999-2011 The European Bioinformatics Institute and | |
9 Genome Research Limited. All rights reserved. | |
10 | |
11 This software is distributed under a modified Apache license. | |
12 For license details, please see | |
13 | |
14 http://www.ensembl.org/info/about/code_licence.html | |
15 | |
16 =head1 CONTACT | |
17 | |
18 Please email comments or questions to the public Ensembl | |
19 developers list at <ensembl-dev@ebi.ac.uk>. | |
20 | |
21 Questions may also be sent to the Ensembl help desk at | |
22 <helpdesk@ensembl.org>. | |
23 | |
24 | |
25 =head1 NAME | |
26 | |
27 Bio::EnsEMBL::Funcgen::ArrayChip - A simple module to represent the concept/template of | |
28 a chip/slide within an array, of which the physical manifestation is an ExperimentalChip. | |
29 | |
30 =head1 SYNOPSIS | |
31 | |
32 use Bio::EnsEMBL::Funcgen::ArrayChip; | |
33 | |
34 my $ec = Bio::EnsEMBL::Funcgen::ArrayChip->new( | |
35 -ARRAY_ID => $array->dbID(), | |
36 -NAME => $desc, | |
37 -DESIGN_ID => $design_id, | |
38 ); | |
39 | |
40 #add more methods here? | |
41 | |
42 | |
43 =head1 DESCRIPTION | |
44 | |
45 An ArrayChip object represent the concept of an array chip/slide withing a given array/chipset. | |
46 The data for ArrayChips is stored in the array_chip table. | |
47 | |
48 | |
49 =cut | |
50 | |
51 use strict; | |
52 use warnings; | |
53 | |
54 | |
55 package Bio::EnsEMBL::Funcgen::ArrayChip; | |
56 | |
57 | |
58 use Bio::EnsEMBL::Utils::Argument qw( rearrange ); | |
59 use Bio::EnsEMBL::Utils::Exception qw( throw warning ); | |
60 use Bio::EnsEMBL::Funcgen::Storable; | |
61 | |
62 use vars qw(@ISA); | |
63 @ISA = qw(Bio::EnsEMBL::Funcgen::Storable); | |
64 | |
65 | |
66 =head2 new | |
67 | |
68 Arg [-ARRAY_ID] : int - the dbID of the parent array | |
69 Arg [-ARRAY] : Bio::EnsEMBL::Funcgen::Array | |
70 Arg [-DESIGN_ID] : string - the unqiue deisng ID defined by the array vendor | |
71 Arg [-NAME] : string - the name of the array chip | |
72 | |
73 | |
74 Example : my $array_chip = Bio::EnsEMBL::Funcgen::ArrayChip->new( | |
75 -ARRAY_ID => $array->dbID(), | |
76 -NAME => $desc, | |
77 -DESIGN_ID => $design_id, | |
78 ); ); | |
79 Description: Creates a new Bio::EnsEMBL::Funcgen::ArrayChip object. | |
80 Returntype : Bio::EnsEMBL::Funcgen::ArrayChip | |
81 Exceptions : None ? should throw if mandaotry params not set | |
82 Caller : General | |
83 Status : Medium Risk | |
84 | |
85 =cut | |
86 | |
87 sub new { | |
88 my $caller = shift; | |
89 | |
90 my $class = ref($caller) || $caller; | |
91 my $self = $class->SUPER::new(@_); | |
92 | |
93 my ($array_id, $name, $design_id, $array) | |
94 = rearrange( ['ARRAY_ID', 'NAME', 'DESIGN_ID', 'ARRAY'], @_ ); | |
95 | |
96 | |
97 #Remove array_id so we can remove checking below? | |
98 | |
99 throw("Must define a name($name) and design_id($design_id)") if(! $name || ! $design_id); | |
100 | |
101 | |
102 #Make these mutually exclusive to avoid checking | |
103 if($array_id && $array){ | |
104 throw('Must provide either -array or -array_id but not both'); | |
105 } | |
106 | |
107 if(defined $array){ | |
108 | |
109 if(!(ref($array) && $array->isa('Bio::EnsEMBL::Funcgen::Array'))){ | |
110 throw('array paramter must be a valid Bio::EnsEMBL::Funcgen::Array'); | |
111 } | |
112 | |
113 $self->{'array'} = $array; | |
114 } | |
115 | |
116 | |
117 | |
118 $self->array_id($array_id) if defined $array_id; | |
119 $self->name($name); | |
120 $self->design_id($design_id); | |
121 | |
122 return $self; | |
123 } | |
124 | |
125 | |
126 =head2 array_id | |
127 | |
128 Arg [1] : (optional) int - the parent array dbID | |
129 Example : my $array_id = $array_chip->array_id(); | |
130 Description: Getter, setter array_id attribute. | |
131 Returntype : int | |
132 Exceptions : None | |
133 Caller : General | |
134 Status : At Risk | |
135 | |
136 =cut | |
137 | |
138 sub array_id { | |
139 my $self = shift; | |
140 $self->{'array_id'} = shift if @_; | |
141 return $self->{'array_id'}; | |
142 } | |
143 | |
144 =head2 name | |
145 | |
146 Arg [1] : (optional) string - the array chip name | |
147 Example : my $ac_name = $array_chip->name(); | |
148 Description: Getter, setter for the name attribute | |
149 Returntype : string | |
150 Exceptions : None | |
151 Caller : General | |
152 Status : Medium Risk | |
153 | |
154 =cut | |
155 | |
156 sub name { | |
157 my $self = shift; | |
158 $self->{'name'} = shift if @_; | |
159 return $self->{'name'}; | |
160 } | |
161 | |
162 =head2 design_id | |
163 | |
164 Arg [1] : (optional) string - the array_chip unique design id as deinfed by the array vendor | |
165 Example : my $design_id = $array_chip->design_id(); | |
166 Description: Getter, setter for the design_id attribute | |
167 Returntype : string | |
168 Exceptions : None | |
169 Caller : General | |
170 Status : At Risk | |
171 | |
172 =cut | |
173 | |
174 sub design_id { | |
175 my $self = shift; | |
176 $self->{'design_id'} = shift if @_; | |
177 return $self->{'design_id'}; | |
178 } | |
179 | |
180 | |
181 =head2 get_Array | |
182 | |
183 Example : my $array = $array_chip->get_array(); | |
184 Description: Getter for the array attribute | |
185 Returntype : Bio::EnsEMBL::Funcgen::Array | |
186 Exceptions : None | |
187 Caller : General | |
188 Status : At Risk | |
189 | |
190 =cut | |
191 | |
192 sub get_Array { | |
193 my $self = shift; | |
194 | |
195 if(! defined $self->{'array'}){ | |
196 $self->{'array'} = $self->adaptor->db->get_ArrayAdaptor()->fetch_by_dbID($self->array_id()); | |
197 } | |
198 | |
199 return $self->{'array'}; | |
200 } | |
201 | |
202 | |
203 | |
204 1; | |
205 |