comparison variant_effect_predictor/Bio/EnsEMBL/Funcgen/Channel.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::Channel
3 #
4 # You may distribute this module under the same terms as Perl itself
5
6
7 =head1 LICENSE
8
9 Copyright (c) 1999-2011 The European Bioinformatics Institute and
10 Genome Research Limited. All rights reserved.
11
12 This software is distributed under a modified Apache license.
13 For license details, please see
14
15 http://www.ensembl.org/info/about/code_licence.html
16
17 =head1 CONTACT
18
19 Please email comments or questions to the public Ensembl
20 developers list at <ensembl-dev@ebi.ac.uk>.
21
22 Questions may also be sent to the Ensembl help desk at
23 <helpdesk@ensembl.org>.
24
25
26 =head1 NAME
27
28 Bio::EnsEMBL::Funcgen::Channel - A module to represent a single channel of an ExperimentalChip
29
30 =head1 SYNOPSIS
31
32 use Bio::EnsEMBL::Funcgen::Channel;
33
34 my $array = Bio::EnsEMBL::Funcgen::Channel->new(
35 -EXPERIMENTAL_CHIP_ID => $ec_id,
36 -SAMPLE_ID => $sample_id,
37 -TYPE => $type,
38 -DYE => $dye,
39 );
40
41 #-replace TYPE with DENOMINATOR?
42
43 my $db_adaptor = Bio::EnsEMBL::Funcgen::DBSQL::DBAdaptor->new(...);
44 my $chan_a = $db_adaptor->get_ChannelAdaptor();
45 my $chan = $chan_a->fetch_by_type_ExperimentalChip($type, $ExpChip);
46
47 =head1 DESCRIPTION
48
49 A Channel object represents a single channel on an ExperimentalChip. The data
50 are stored in the channel table, and associated expermental variables are
51 stored in the experimental_variable table.
52
53 =cut
54
55 use strict;
56 use warnings;
57
58
59 package Bio::EnsEMBL::Funcgen::Channel;
60
61
62 use Bio::EnsEMBL::Utils::Argument qw( rearrange );
63 use Bio::EnsEMBL::Utils::Exception qw( throw warning );
64 use Bio::EnsEMBL::Funcgen::Storable;
65
66 use vars qw(@ISA);
67 @ISA = qw(Bio::EnsEMBL::Funcgen::Storable);
68
69
70 =head2 new
71
72 Arg [-EXPERIMENTAL_CHIP_ID]: int - the experimental chip dbID
73
74
75
76 Example : my $array = Bio::EnsEMBL::Funcgen::Channel->new(
77 -EXPERIMENTAL_CHIP_ID => $ec_id,
78 -SAMPLE_ID => $sample_id,
79 -TYPE => $type,
80 -DYE => $dye,
81 );
82 Description: Creates a new Bio::EnsEMBL::Funcgen::Channel object.
83 Returntype : Bio::EnsEMBL::Funcgen::Channel
84 Exceptions : None
85 Caller : General
86 Status : Medium Risk
87
88 =cut
89
90 sub new {
91 my $caller = shift;
92
93 my $class = ref($caller) || $caller;
94
95 my $self = $class->SUPER::new(@_);
96
97 #can we lc these?
98 my ($ec_id, $sample_id, $type, $dye)
99 = rearrange( ['EXPERIMENTAL_CHIP_ID', 'SAMPLE_ID', 'TYPE', 'DYE'], @_ );
100
101 $self->sample_id($sample_id) if defined $sample_id;
102 $self->experimental_chip_id($ec_id) if defined $ec_id;
103 $self->type($type) if defined $type;
104 $self->dye($dye) if defined $dye;
105
106
107 return $self;
108 }
109
110 =head2 sample_id
111
112 Arg [1] : (optional) string - the sample id for this Channel
113 Example : my $sample_id = $chan->sample_id();
114 Description: Getter, setter and lazy loader of sample_id attribute.
115 Returntype : string
116 Exceptions : None
117 Caller : General
118 Status : Medium Risk
119
120 =cut
121
122 sub sample_id {
123 my $self = shift;
124 $self->{'sample_id'} = shift if @_;
125
126 if ( ! exists $self->{'sample_id'} && $self->dbID() && $self->adaptor() ) {
127 $self->adaptor->fetch_attributes($self);
128 }
129
130 return $self->{'sample_id'};
131 }
132
133
134
135 =head2 experimental_chip_id
136
137 Arg [1] : (optional) int - the experimenta chip dbID
138 Example : my $ec_id = $chan->experimental_chip_id();
139 Description: Getter, setter and lazy loader of experimental_chip_id attribute
140 Returntype : int
141 Exceptions : None
142 Caller : General
143 Status : Medium Risk
144
145 =cut
146
147 sub experimental_chip_id {
148 my $self = shift;
149
150 $self->{'experimental_chip_id'} = shift if @_;
151 if ( !exists $self->{'experimental_chip_id'} && $self->dbID() && $self->adaptor() ) {
152 $self->adaptor->fetch_attributes($self);
153 }
154 return $self->{'experimental_chip_id'};
155 }
156
157 =head2 type
158
159 Arg [1] : (optional) string - the channel type e.g. EXPERIMENTAL or CONTROL
160 Example : my $type = $chan->type();
161 Description: Getter, setter and lazy loader of type attribute
162 Returntype : string
163 Exceptions :
164 Caller : General
165 Status : Medium Risk
166
167 =cut
168
169 sub type {
170 my $self = shift;
171
172 $self->{'type'} = shift if @_;
173
174 #warn "we need to control EXPERIMENTAL OR CONTROL here or enum on DB";
175
176 if ( !exists $self->{'type'} && $self->dbID() && $self->adaptor() ) {
177 $self->adaptor->fetch_attributes($self);
178 }
179 return $self->{'type'};
180 }
181
182 =head2 dye
183
184 Arg [1] : (optional) string - the channel type e.g. EXPERIMENTAL or CONTROL
185 Example : my $dye = $chan->dye();
186 Description: Getter, setter and lazy loader of dye attribute
187 Returntype : string
188 Exceptions :
189 Caller : General
190 Status : Medium Risk
191
192 =cut
193
194 sub dye {
195 my $self = shift;
196
197 $self->{'dye'} = shift if @_;
198
199 #if ( !exists $self->{'dye'} && $self->dbID() && $self->adaptor() ) {
200 # $self->adaptor->fetch_attributes($self);
201 #}
202 return $self->{'dye'};
203 }
204
205
206 1;
207