1 # BioPerl module for Bio::Map::Microsatellite
3 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 # Cared for by Sendu Bala <bix@sendu.me.uk>
7 # Copyright Chad Matsalla
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
15 Bio::Map::Microsatellite - An object representing a Microsatellite marker.
19 $o_usat = Bio::Map::Microsatellite->new
20 (-name=>'Chad Super Marker 2',
21 -sequence => 'gctgactgatcatatatatatatatatatatatatatatatcgcgatcgtga',
24 -repeat_start_position => 11
27 $sequence_before_usat = $o_usat->get_leading_flank();
28 $sequence_after_usat = $o_usat->get_trailing_flank();
33 This object handles the notion of an Microsatellite. This microsatellite can
34 be placed on a (linear) Map or used on its own. If this Microsatellites
35 will be used in a mapping context (it doesn't have to, you know) it can have
36 multiple positions in a map. For information about a Microsatellite's position
37 in a map one must query the associate PositionI object which is accessible
38 through the position() method.
44 User feedback is an integral part of the evolution of this and other
45 Bioperl modules. Send your comments and suggestions preferably to
46 the Bioperl mailing list. Your participation is much appreciated.
48 bioperl-l@bioperl.org - General discussion
49 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
53 Please direct usage questions or support issues to the mailing list:
55 I<bioperl-l@bioperl.org>
57 rather than to the module maintainer directly. Many experienced and
58 reponsive experts will be able look at the problem and quickly
59 address it. Please include a thorough description of the problem
60 with code and data examples if at all possible.
64 Report bugs to the Bioperl bug tracking system to help us keep track
65 of the bugs and their resolution. Bug reports can be submitted via the
68 https://github.com/bioperl/bioperl-live/issues
70 =head1 AUTHOR - Chad Matsalla
72 Email bioinformatics1@dieselwurks.com
76 Heikki Lehvaslaiho heikki-at-bioperl-dot-org
77 Lincoln Stein lstein@cshl.org
78 Jason Stajich jason@bioperl.org
79 Sendu Bala bix@sendu.me.uk
83 The rest of the documentation details each of the object methods.
84 Internal methods are usually preceded with a _
88 # Let the code begin...
90 package Bio
::Map
::Microsatellite
;
93 use base
qw(Bio::Map::Marker);
99 Function: Builds a new Bio::Map::Microsatellite object
100 Returns : Bio::Map::Microsatellite
102 -name => name of this microsatellite (optional, string,
103 default 'Unknown microsatellite')
104 -positions => position(s) for this marker in maps[optional],
105 An array reference of tuples (array refs themselves)
106 Each tuple contains a Bio::Map::MapI-inherited object and a
107 Bio::Map::PositionI-inherited obj, no default)
108 -sequence => the sequence of this microsatellite (optional,
110 -motif => the repeat motif of this microsatellite (optional,
112 -repeats => the number of motif repeats for this microsatellite
113 (optional, scalar, no default)
114 -repeat_start_position => the starting position of the
115 microsatellite in this sequence. The first base of the
116 sequence is position "1". (optional, scalar, no default)
118 Note : Creating a Bio::Map::Microsatellite object with no position
119 might be useful for microsatellite people wanting to embrace
120 and extend this module. <raising hand> Me! Me! Me!
121 - using repeat_start_position will trigger a mechinism to
122 calculate a value for repeat_end_position.
128 my ($class,@args) = @_;
129 my $self = $class->SUPER::new
(@args);
130 my ($map, $position, $sequence, $motif, $repeats, $start) =
131 $self->_rearrange([qw(MAP
136 REPEAT_START_POSITION
138 if( ! $self->name ) {
139 $self->name('Unnamed microsatellite');
141 $map && $self->map($map);
142 $position && $self->position($position);
143 $sequence && $self->sequence($sequence);
144 $self->motif(defined $motif ?
$motif : 'Unknown motif');
145 $repeats && $self->repeats($repeats);
146 $start && $self->repeat_start_position($start);
153 Usage : $o_usat->motif($new_motif);
154 my $motif = $o_usat->motif();
155 Function: Get/Set the repeat motif for this Microsatellite.
156 Returns : A scalar representing the current repeat motif of this
158 Args : none to get, OR string to set
163 my ($self,$motif) = @_;
165 $self->{'_motif'} = $motif;
167 return $self->{'_motif'};
173 Usage : $o_usat->sequence($new_sequence);
174 my $sequence = $o_usat->sequence();
175 Function: Get/Set the sequence for this Microsatellite.
176 Returns : A scalar representing the current sequence of this
178 Args : none to get, OR string to set
183 my ($self,$sequence) = @_;
185 $self->{'_sequence'} = $sequence;
187 return $self->{'_sequence'};
193 Usage : $o_usat->repeats($new_repeats);
194 my $repeats = $o_usat->repeats()
195 Function: Get/Set the repeat repeats for this Microsatellite.
196 Returns : A scalar representing the current number of repeats of this
198 Args : none to get, OR int to set
203 my ($self,$repeats) = @_;
205 $self->{'_repeats'} = $repeats;
207 return $self->{'_repeats'};
210 =head2 repeat_start_position
212 Title : repeat_start_position
213 Usage : $o_usat->repeat_start_position($new_repeat_start_position);
214 my $repeat_start_position = $o_usat->repeat_start_position();
215 Function: Get/Set the repeat repeat_start_position for this
217 Returns : A scalar representing the repeat start position for this
219 Args : none to get, OR string to set
220 This method will also try to set the repeat end position. This
221 depends on having information for the motif and the number of
222 repeats. If you want to use methods like get_trailing_flank or
223 get_leading flank, be careful to include the right information.
227 sub repeat_start_position
{
228 my ($self,$repeat_start_position) = @_;
229 if ($repeat_start_position) {
230 $self->{'_repeat_start_position'} = $repeat_start_position;
231 $self->repeat_end_position("set");
233 return $self->{'_repeat_start_position'};
236 =head2 repeat_end_position
238 Title : repeat_end_position
239 Usage : $o_usat->repeat_end_position("set");
240 $o_usat->repeat_end_position($value);
241 $current_repeat_end_position = $o_usat->repeat_end_position();
242 Function: Get/set the end position of the repeat in this sequence.
243 Returns : A scalar representing the base index of the end of the
244 repeat in this Microsatellite. The first base in the sequence
246 Args : A scalar representing a value, the string "set", or no
247 argument (see Notes).
248 Notes : If you do not provide an argument to this method, the current
249 end position of the repeat in this Microsatellite will be
251 If you provide the string "set" to this method it will set the
252 end position based on the start position, the length of the
253 motif, and the number of repeats.
254 If you specify a value the current end position of the repeat
255 will be set to that value. This is a really bad idea. Don't do
260 sub repeat_end_position
{
261 my ($self,$caller) = @_;
262 if( defined $caller ) {
263 if ($caller eq "set") {
264 $self->{'_repeat_end_position'} =
265 $self->{'_repeat_start_position'} +
266 (length($self->motif()) * $self->repeats());
269 $self->{'_repeat_end_position'} = $caller;
272 return $self->{'_repeat_end_position'};
278 Usage : if ($mappable->equals($mapable2)) {...}
279 Function: Test if a position is equal to another position
281 Args : Bio::Map::MappableI
286 my ($self,@args) = @_;
287 $self->throw_not_implemented();
293 Usage : if ($mappable->less_than($m2)) {...}
294 Function: Tests if a position is less than another position
296 Args : Bio::Map::MappableI
301 my ($self,@args) = @_;
302 $self->throw_not_implemented();
308 Usage : if ($mappable->greater_than($m2)) {...}
309 Function: Tests if position is greater than another position
311 Args : Bio::Map::MappableI
316 my ($self,@args) = @_;
317 $self->throw_not_implemented();
320 =head2 get_leading_flank
322 Title : get_leading_flank
323 Usage : $leading_sequence = $o_usat->get_leading_flank();
324 Returns : A scalar representing the sequence before the repeats in this
330 sub get_leading_flank
{
332 return substr $self->sequence(),0,$self->repeat_start_position-1;
335 =head2 get_trailing_flank
337 Title : get_trailing_flank
338 Usage : $trailing_flank = $o_usat->get_trailing_flank();
339 Returns : A scalar representing the sequence after the repeats in this
345 sub get_trailing_flank
{
347 return substr $self->sequence(),$self->repeat_end_position()-1;