0
|
1 # BioPerl module for Bio::Map::Microsatellite
|
|
2 #
|
|
3 # Cared for by Chad Matsalla <bioinformatics1@dieselwurks.com>
|
|
4 #
|
|
5 # Copyright Chad Matsalla
|
|
6 #
|
|
7 # You may distribute this module under the same terms as perl itself
|
|
8
|
|
9 # POD documentation - main docs before the code
|
|
10
|
|
11 =head1 NAME
|
|
12
|
|
13 Bio::Map::Microsatellite - An object representing a Microsatellite marker.
|
|
14
|
|
15 =head1 SYNOPSIS
|
|
16
|
|
17 $o_usat = new Bio::Map::Microsatellite
|
|
18 (-name=>'Chad Super Marker 2',
|
|
19 -sequence => 'gctgactgatcatatatatatatatatatatatatatatatcgcgatcgtga',
|
|
20 -motif => 'at',
|
|
21 -repeats => 15,
|
|
22 -repeat_start_position => 11
|
|
23 );
|
|
24
|
|
25 $sequence_before_usat = $o_usat->get_leading_flank();
|
|
26 $sequence_after_usat = $o_usat->get_trailing_flank();
|
|
27
|
|
28
|
|
29 =head1 DESCRIPTION
|
|
30
|
|
31 This object handles the notion of an Microsatellite. This microsatellite can
|
|
32 be placed on a (linear) Map or used on its own. If this Microsatellites
|
|
33 will be used in a mapping context (it doesn't have to, you know) it can have
|
|
34 multiple positions in a map. For information about a Microsatellite's position
|
|
35 in a map one must query the associate PositionI object which is accessible
|
|
36 through the position() method.
|
|
37
|
|
38 =head1 FEEDBACK
|
|
39
|
|
40 =head2 Mailing Lists
|
|
41
|
|
42 User feedback is an integral part of the evolution of this and other
|
|
43 Bioperl modules. Send your comments and suggestions preferably to
|
|
44 the Bioperl mailing list. Your participation is much appreciated.
|
|
45
|
|
46 bioperl-l@bioperl.org - General discussion
|
|
47 http://bioperl.org/MailList.shtml - About the mailing lists
|
|
48
|
|
49 =head2 Reporting Bugs
|
|
50
|
|
51 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
52 of the bugs and their resolution. Bug reports can be submitted via
|
|
53 email or the web:
|
|
54
|
|
55 bioperl-bugs@bioperl.org
|
|
56 http://bugzilla.bioperl.org/
|
|
57
|
|
58 =head1 AUTHOR - Chad Matsalla
|
|
59
|
|
60 Email bioinformatics1@dieselwurks.com
|
|
61
|
|
62 =head1 CONTRIBUTORS
|
|
63
|
|
64 Heikki Lehvaslaiho heikki@ebi.ac.uk
|
|
65 Lincoln Stein lstein@cshl.org
|
|
66 Jason Stajich jason@bioperl.org
|
|
67
|
|
68 =head1 APPENDIX
|
|
69
|
|
70 The rest of the documentation details each of the object methods.
|
|
71 Internal methods are usually preceded with a _
|
|
72
|
|
73 =cut
|
|
74
|
|
75 # Let the code begin...
|
|
76
|
|
77 package Bio::Map::Microsatellite;
|
|
78 use vars qw(@ISA);
|
|
79 use strict;
|
|
80 use Bio::Root::Root;
|
|
81 use Bio::Map::Marker;
|
|
82
|
|
83 @ISA = qw(Bio::Map::Marker);
|
|
84
|
|
85 =head2 new
|
|
86
|
|
87 Title : new
|
|
88 Usage : $o_usat =
|
|
89 Function: Builds a new Bio::Map::Microsatellite object
|
|
90 Returns : Bio::Map::Microsatellite
|
|
91 Args :
|
|
92 -name => name of this microsatellite (optional, string,
|
|
93 default 'Unknown microsatellite')
|
|
94 -positions => position(s) for this marker in maps[optional],
|
|
95 An array reference of tuples (array refs themselves)
|
|
96 Each tuple conatins a Bio::Map::MapI-inherited object and a
|
|
97 Bio::Map::PositionI-inherited obj, no default)
|
|
98 -sequence => the sequence of this microsatellite (optional,
|
|
99 scalar, no default)
|
|
100 -motif => the repeat motif of this microsatellite (optional,
|
|
101 scalar, no default)
|
|
102 -repeats => the number of motif repeats for this microsatellite
|
|
103 (optional, scalar, no default)
|
|
104 -repeat_start_position => the starting position of the
|
|
105 microsatellite in this sequence. The first base of the
|
|
106 sequence is position "1". (optional, scalar, no default)
|
|
107
|
|
108 Note : Creating a Bio::Map::Microsatellite object with no position
|
|
109 might be useful for microsatellite people wanting to embrace
|
|
110 and extend this module. <raising hand> Me! Me! Me!
|
|
111 - using repeat_start_position will trigger a mechinism to
|
|
112 calculate a value for repeat_end_position.
|
|
113
|
|
114
|
|
115 =cut
|
|
116
|
|
117 sub new {
|
|
118 my ($class,@args) = @_;
|
|
119 my $self = $class->SUPER::new(@args);
|
|
120 my ($map, $position, $sequence, $motif, $repeats, $start) =
|
|
121 $self->_rearrange([qw(MAP
|
|
122 POSITION
|
|
123 SEQUENCE
|
|
124 MOTIF
|
|
125 REPEATS
|
|
126 REPEAT_START_POSITION
|
|
127 )], @args);
|
|
128 if( ! $self->name ) {
|
|
129 $self->name('Unnamed microsatellite');
|
|
130 }
|
|
131 $map && $self->map($map);
|
|
132 $position && $self->position($position);
|
|
133 $sequence && $self->sequence($sequence);
|
|
134 $self->motif(defined $motif ? $motif : 'Unknown motif');
|
|
135 $repeats && $self->repeats($repeats);
|
|
136 $start && $self->repeat_start_position($start);
|
|
137 return $self;
|
|
138 }
|
|
139
|
|
140 =head2 Bio::Map::Marker methods
|
|
141
|
|
142 =cut
|
|
143
|
|
144 =head2 position
|
|
145
|
|
146 Title : position
|
|
147 Usage : my $position = $mappable->position($map); OR
|
|
148 $mappable->position($map,$position); OR
|
|
149 Function: Get/Set the Bio::Map::PositionI for a mappable element
|
|
150 in a specific Map
|
|
151 Returns : Bio::Map::PositionI
|
|
152 Args : $map =Bio::Map::MapI # Map we are talking about
|
|
153 $position = Bio::Map::PositionI # Position we want to set
|
|
154
|
|
155
|
|
156 =head2 name($new_name)
|
|
157
|
|
158 Title : name($new_name)
|
|
159 Usage : $o_usat->name($new_name) _or_
|
|
160 my $name = $o_usat->name()
|
|
161 Function: Get/Set the name for this Microsatellite
|
|
162 Returns : A scalar representing the current name of this Microsatellite
|
|
163 Args : If provided, the current name of this Microsatellite
|
|
164 will be set to $new_name.
|
|
165
|
|
166 =head2 motif($new_motif)
|
|
167
|
|
168 Title : motif($new_motif)
|
|
169 Usage : my $motif = $o_usat->motif($new_motif) _or_
|
|
170 my $motif = $o_usat->motif()
|
|
171 Function: Get/Set the repeat motif for this Microsatellite
|
|
172 Returns : A scalar representing the current repeat motif of this
|
|
173 Microsatellite.
|
|
174 Args : If provided, the current repeat motif of this Microsatellite
|
|
175 will be set to $new_motif.
|
|
176
|
|
177 =cut
|
|
178
|
|
179 sub motif {
|
|
180 my ($self,$motif) = @_;
|
|
181 if ($motif) {
|
|
182 $self->{'_motif'} = $motif;
|
|
183 }
|
|
184 return $self->{'_motif'};
|
|
185 }
|
|
186
|
|
187 =head2 sequence($new_sequence)
|
|
188
|
|
189 Title : sequence($new_sequence)
|
|
190 Usage : my $sequence = $o_usat->sequence($new_sequence) _or_
|
|
191 my $sequence = $o_usat->sequence()
|
|
192 Function: Get/Set the sequence for this Microsatellite
|
|
193 Returns : A scalar representing the current sequence of this
|
|
194 Microsatellite.
|
|
195 Args : If provided, the current sequence of this Microsatellite
|
|
196 will be set to $new_sequence.
|
|
197
|
|
198 =cut
|
|
199
|
|
200 sub sequence {
|
|
201 my ($self,$sequence) = @_;
|
|
202 if ($sequence) {
|
|
203 $self->{'_sequence'} = $sequence;
|
|
204 }
|
|
205 return $self->{'_sequence'};
|
|
206 }
|
|
207
|
|
208 =head2 repeats($new_repeats)
|
|
209
|
|
210 Title : repeats($new_repeats)
|
|
211 Usage : my $repeats = $o_usat->repeats($new_repeats) _or_
|
|
212 my $repeats = $o_usat->repeats()
|
|
213 Function: Get/Set the repeat repeats for this Microsatellite
|
|
214 Returns : A scalar representing the current number of repeats of this
|
|
215 Microsatellite.
|
|
216 Args : If provided, the current number of repeats of this
|
|
217 Microsatellite will be set to $new_repeats.
|
|
218
|
|
219 =cut
|
|
220
|
|
221 sub repeats {
|
|
222 my ($self,$repeats) = @_;
|
|
223 if ($repeats) {
|
|
224 $self->{'_repeats'} = $repeats;
|
|
225 }
|
|
226 return $self->{'_repeats'};
|
|
227 }
|
|
228
|
|
229 =head2 repeat_start_position($new_repeat_start_position)
|
|
230
|
|
231 Title : repeat_start_position($new_repeat_start_position)
|
|
232 Usage : my $repeat_start_position =
|
|
233 $o_usat->repeat_start_position($new_repeat_start_position) _or_
|
|
234 my $repeat_start_position = $o_usat->repeat_start_position()
|
|
235 Function: Get/Set the repeat repeat_start_position for this
|
|
236 Microsatellite
|
|
237 Returns : A scalar representing the repeat start position for this
|
|
238 Microsatellite.
|
|
239 Args : If provided, the current repeat start position of this
|
|
240 Microsatellite will be set to $new_repeat_start_position.
|
|
241 This method will also try to set the repeat end position. This
|
|
242 depends on having information for the motif and the number of
|
|
243 repeats. If you want to use methods like get_trailing_flank or
|
|
244 get_leading flank, be careful to include the right information.
|
|
245
|
|
246 =cut
|
|
247
|
|
248 sub repeat_start_position {
|
|
249 my ($self,$repeat_start_position) = @_;
|
|
250 if ($repeat_start_position) {
|
|
251 $self->{'_repeat_start_position'} = $repeat_start_position;
|
|
252 $self->repeat_end_position("set");
|
|
253 }
|
|
254 return $self->{'_repeat_start_position'};
|
|
255 }
|
|
256
|
|
257 =head2 repeat_end_position($value)
|
|
258
|
|
259 Title : repeat_end_position($set)
|
|
260 Usage : $new_repeat_end_position =
|
|
261 $o_usat->repeat_end_position("set"); _or_
|
|
262 $new_repeat_end_position =
|
|
263 $o_usat->repeat_end_position($value); _or_
|
|
264 $current_repeat_end_position = $o_usat->repeat_end_position();
|
|
265 Function: get/set the end position of the repeat in this sequence
|
|
266 Returns : A scalar representing the base index of the end of the
|
|
267 repeat in this Microsatellite. The first base in the sequence
|
|
268 is base 1.
|
|
269 Args : A scalar representing a value, the string "set", or no
|
|
270 argument (see Notes).
|
|
271 Notes : If you do not provide an argument to this method, the current
|
|
272 end position of the repeat in this Microsatellite will be
|
|
273 returned (a scalar).
|
|
274 If you provide the string "set" to this method it will set the
|
|
275 end position based on the start position, the length of the
|
|
276 motif, and the nuimber of repeats.
|
|
277 If you specify a value the current end position of the repeat
|
|
278 will be set to that value. This is a really bad idea. Don't do
|
|
279 it.
|
|
280
|
|
281 =cut
|
|
282
|
|
283 #'
|
|
284 sub repeat_end_position {
|
|
285 my ($self,$caller) = @_;
|
|
286 if( defined $caller ) {
|
|
287 if ($caller eq "set") {
|
|
288 $self->{'_repeat_end_position'} =
|
|
289 $self->{'_repeat_start_position'} +
|
|
290 (length($self->motif()) * $self->repeats());
|
|
291 }
|
|
292 elsif ($caller) {
|
|
293 $self->{'_repeat_end_position'} = $caller;
|
|
294 }
|
|
295 }
|
|
296 return $self->{'_repeat_end_position'};
|
|
297 }
|
|
298
|
|
299 =head2 equals
|
|
300
|
|
301 Title : equals
|
|
302 Usage : if( $mappable->equals($mapable2)) ...
|
|
303 Function: Test if a position is equal to another position
|
|
304 Returns : boolean
|
|
305 Args : Bio::Map::MappableI
|
|
306
|
|
307 =cut
|
|
308
|
|
309 sub equals {
|
|
310 my ($self,@args) = @_;
|
|
311 $self->warn("equals is not yet implemented in ".
|
|
312 ref($self)." yet. Check back real soon!");
|
|
313 }
|
|
314
|
|
315 =head2 less_than
|
|
316
|
|
317 Title : less_than
|
|
318 Usage : if( $mappable->less_than($m2) ) ...
|
|
319 Function: Tests if a position is less than another position
|
|
320 Returns : boolean
|
|
321 Args : Bio::Map::MappableI
|
|
322
|
|
323 =cut
|
|
324
|
|
325 sub less_than {
|
|
326 my ($self,@args) = @_;
|
|
327 $self->warn("less_then is not yet implemented in ".
|
|
328 ref($self)." yet. Check back real soon!");
|
|
329 }
|
|
330
|
|
331 =head2 greater_than
|
|
332
|
|
333 Title : greater_than
|
|
334 Usage : if( $mappable->greater_than($m2) ) ...
|
|
335 Function: Tests if position is greater than another position
|
|
336 Returns : boolean
|
|
337 Args : Bio::Map::MappableI
|
|
338
|
|
339 =cut
|
|
340
|
|
341 sub greater_than {
|
|
342 my ($self,@args) = @_;
|
|
343 $self->warn("greater_then is not yet implemented in ".
|
|
344 ref($self)." yet. Check back real soon!");
|
|
345 }
|
|
346
|
|
347 =head2 get_leading_flank()
|
|
348
|
|
349 Title : get_leading_flank()
|
|
350 Usage : $leading_sequence = $o_usat->get_leading_flank();
|
|
351 Returns : A scalar representing the sequence before the repeats in this
|
|
352 Microsatellite.
|
|
353 Args : None.
|
|
354
|
|
355 =cut
|
|
356
|
|
357 sub get_leading_flank {
|
|
358 my $self = shift;
|
|
359 return substr $self->sequence(),0,$self->repeat_start_position-1;
|
|
360
|
|
361 }
|
|
362
|
|
363 =head2 get_trailing_flank()
|
|
364
|
|
365 Title : get_trailing_flank()
|
|
366 Usage : $trailing_flank = $o_usat->get_trailing_flank();
|
|
367 Returns : A scalar representing the sequence after the repeats in this
|
|
368 Microsatellite.
|
|
369 Args : None.
|
|
370
|
|
371 =cut
|
|
372
|
|
373 sub get_trailing_flank {
|
|
374 my $self = shift;
|
|
375 return substr $self->sequence(),$self->repeat_end_position()-1;
|
|
376 }
|
|
377
|
|
378
|
|
379 1;
|
|
380
|
|
381
|