CDF/Probe.pm untested

filter: Statementstmt 0.0% 0 / 47 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 11 totaltotal 0.0% 0 / 80 CC 5 SCAR 13.3
CC
5
Cov
0%
mismatch_position
6.0
probe_mismatch_base
6.0
probe_target_base
6.0
CRAP 3.8
1 #!/usr/bin/perl
2  
3 # A Affymetrix probeset. We gloss over the fact that multiple
4 # Unit_blocks are allowed per Unit, since this whole set of modules
5 # only really cares about expression
6  
7 package Bio::Affymetrix::CDF::Probe;
8  
9 # Docs come before the code
10  
11 =head1 NAME
12  
13 Bio::Affymetrix::CDF::Probe- an Affymetrix probe in a probeset in an CDF file
14  
15 =head1 SYNOPSIS
16  
17 use Bio::Affymetrix::CDF;
18  
19 # Parse the CDF file
20  
21 my $cdf=new CDF();
22  
23 $cdf->parse_from_file("foo.cdf");
24  
25 # Find a probe. This is the first probe in the first probepair in Unit 1000
26  
27 my $probe=$chp->probesets()->{1000}->[0]->[0];
28  
29 # Find some fun facts about this probe
30  
31 print join ",",
32 ($probe->x(),$probe->y(),($probe->is_mismatch()?"Mismatch probe":"Perfect match probe");
33  
34 =head1 DESCRIPTION
35  
36 The Affymetrix microarray system produces files in a variety of
37 formats. If this means nothing to you, these modules are probably not
38 for you :). After these modules have parsed a CDF file, the resulting
39 Bio::Affymetrix::CDF file contains a hash of
40 Bio::Affmetrix::CDF::Probeset objects. Each probeset then contains an
41 array reference of probepairs, each one which is an array reference
42 of Bio::Affymetrix::CDF::Probe objects.
43  
44 =head2 HINTS
45  
46 You can only get probe-level information if you have parsed the CDF
47 object with probe-level parsing turned on.
48  
49 =head1 COPYRIGHT
50  
51 Copyright (C) 2005 by Nick James, David J Craigon, NASC (arabidopsis.info), The
52 University of Nottingham
53  
54 This module is free software. You can copy or redistribute it under the same terms as Perl itself.
55  
56 Affymetrix is a registered trademark of Affymetrix Inc., Santa
57 Clara, California, USA.
58  
59 =head1 AUTHORS
60
61 Nick James (nick at arabidopsis.info)
62  
63 David J Craigon (david at arabidopsis.info)
64  
65 Nottingham Arabidopsis Stock Centre (http://arabidopsis.info), University of Nottingham.
66  
67 =head1 METHODS
68  
69 =cut
70  
71  
72 use Carp;
73  
74 use warnings;
75 use strict;
76 our $VERSION=0.5;
77  
78 =head2 new
79  
80 Arg [0] : none
81 Example : my $probe=new Bio::Affymetrix::CDF::Probe();
82 Description: constructor for Bio::Affymetrix::CDF::Probe object. You
83 probably do not want to make these objects yourself, however.
84 Returntype : new Bio::Affmetrix::CDF object
85 Exceptions : none
86 Caller : general
87  
88 =cut
89  
90 sub new {
91 my $class=shift;
92 my $q=shift;
93 my $self={};
94  
95 bless $self,$class;
96  
97  
98 return $self;
99 }
100  
101 # Getter/setters
102  
103 # Probe info
104  
105 # Coordinates of probe
106  
107  
108 =head2 x
109 Arg [1] : integer $x (optional)
110 Example : my $x=$probe->x();
111 Description: Get the x coordinate of this probe. This is now (since version 0.3) immutable.
112 Returntype : integer
113 Exceptions : none
114 Caller : general
115
116 =cut
117 sub x {
118 my $self=shift;
119 return $self->{"X"};
120 }
121  
122 =head2 y
123 Arg [1] : integer $y (optional)
124 Example : my $name=$probe->cols()
125 Description: Get the y coordinate of this probe. This is now (since version 0.3) immutable.
126 Returntype : integer
127 Exceptions : none
128 Caller : general
129 =cut
130 sub y {
131 my $self=shift;
132
133 return $self->{"Y"};
134 }
135  
136 # Probeset the probe came out of (name)
137  
138 =head2 original_probeset
139 Arg [0] : none
140 Example : my $name=$probe->original_probeset()
141 Description: The name of the original probeset this probe came from
142 Returntype : string $probesetname
143 Exceptions : none
144 Caller : general
145 =cut
146  
147 sub original_probeset {
148 my $self=shift;
149 return $self->{"PROBESET"};
150 }
151  
152 # The number of the probe in the probeset
153  
154 =head2 orignal_probe_number
155 Arg [0] : none
156 Example : my $position=$probe->original_probe_number()
157 Description: The name of the original index of this probe in the probeset
158 Returntype : string $probesetname
159 Exceptions : none
160 Caller : general
161 =cut
162 sub original_probe_number {
163 my $self=shift;
164 return $self->{"EXPOS"};
165 }
166  
167  
168  
169 # Position of the mismatched base
170 =head2 mismatch_position
171 Arg [1] : integer $position (optional)
172 Example : my $position=$probe->mismatch_position();
173 Description: Get/set the postition of the mismatch base (in the
174 25-mer oligo. As far as the author knows, all factory Affymetrix
175 chips have the mismatch probe in position 13). Only available if the
176 original CDF file was in MAS5 format.
177 Returntype : integer
178 Exceptions : none
179 Caller : general
180
181 =cut
182 sub mismatch_position {
183 my $self=shift;
184
185 if (my $q=shift) {
186 $self->{"POS"}=$q;
187 }
188
189 return $self->{"POS"};
190 }
191  
192  
193 # The base at the mismatch position
194 =head2 probe_mismatch_base
195 Arg [1] : char $base
196 Example : my $base=$probe->probe_mismatch_base()
197 Description: Get/set the base A,C,T or G at the mismatch position.
198 Returntype : char $base
199 Exceptions : none
200 Caller : general
201 =cut
202 sub probe_mismatch_base {
203 my $self=shift;
204
205 if (my $q=shift) {
206 $self->{"PBASE"}=$q;
207 }
208
209 return $self->{"PBASE"};
210 }
211  
212 #
213 =head2 probe_target_base
214 Arg [1] : char $base
215 Example : my $base=$probe->probe_target_base()
216 Description: Get/set what the base (A, C, T or G) would be if it is to detect for
217 the target sequence. Non-mismatch probes have
218 probe_mismatch_base() eq probe_target_base().
219 Returntype : char $base
220 Exceptions : none
221 Caller : general
222 =cut
223 sub probe_target_base {
224 my $self=shift;
225
226 if (my $q=shift) {
227 $self->{"TBASE"}=$q;
228 }
229
230 return $self->{"TBASE"};
231 }
232  
233 # Is this probe a mismatch?
234 =head2 is_mismatch
235 Arg [0] : none
236 Example : if ($probe->is_mismatch()) {
237 print "Everybody loves mismatch probes!";
238 }
239 Description: Utility function that returns whether this probe is a
240 mismatch probe or not.
241 Returntype : bool
242 Exceptions : none
243 Caller : general
244 =cut
245 sub is_mismatch {
246 my $self=shift;
247 return ($self->probe_target_base() eq $self->probe_mismatch_base());
248 }
249  
250 =head2 original_probepair_number
251 Arg [0] : none
252 Example : my $original_number=$probe->original_probepair_number();
253 Description: Returns the probe pair number as written in the file
254 Returntype : integer $number
255 Exceptions : none
256 Caller : general
257 =cut
258 sub original_probepair_number {
259 my $self=shift;
260  
261 return $self->{"ATOM"};
262 }
263  
264 # Index for CEL file, apparently
265  
266 =head2 index
267 Arg [1] : integer $index (optional)
268 Example : my $i=$probe->index();
269 Description: Get/set the index of this probe. Allegedly this number
270 was used in the CEL file at some point, but is probably useless now.
271 Returntype : integer
272 Exceptions : none
273 Caller : general
274
275 =cut
276 sub index {
277 my $self=shift;
278  
279 if (my $q=shift) {
280 $self->{"INDEX"}=$q;
281 }
282 return $self->{"INDEX"};
283 }
284  
285 1;