81
77
=head2 get_position_object
83
79
Title : get_position_class
84
Usage : my $pos = $marker->get_position_object();
80
Usage : my $position = $marker->get_position_object();
85
81
Function: To get an object of the default Position class
86
82
for this Marker. Subclasses should redefine this method.
87
The Position needs to be L<Bio::Map::PositionI>.
88
Returns : L<Bio::Map::CytoPosition>
83
The Position returned needs to be a L<Bio::Map::PositionI> with
85
Returns : L<Bio::Map::PositionI>
86
Args : none for an 'empty' PositionI object, optionally
87
Bio::Map::MapI and value string to set the Position's -map and -value
93
92
sub get_position_object {
95
return new Bio::Map::CytoPosition();
93
my ($self, $map, $value) = @_;
94
$map ||= $self->default_map;
96
$self->throw("Value better be scalar, not [$value]") unless ref($value) eq '';
99
my $pos = new Bio::Map::CytoPosition();
100
$pos->map($map) if $map;
101
$pos->value($value) if $value;
102
$pos->element($self);
103
111
chromosomes, through X and end the the q tip of X. See
104
112
L<Bio::Map::CytoPosition::cytorange> for more details.
106
The numeric values for cytogenetic positions are ranges of type
107
L<Bio::Range>, so MarkerI type of operators (equals, less_than,
108
greater_than) are not very meaningful, but they might be of some use
109
combined with L<Bio::RangeI> methods (overlaps, contains, equals,
110
intersection, union). equals(), present in both interfaces is treated
111
as a more precice RangeI method.
113
CytoMarker has a method L<get_chr> which might turn out to be useful
116
The L<less_than> and L<greater_than> methods are implemented by
117
comparing the end values of the range, so you better first check that
118
markers do not overlap, or you get an opposite result than expected.
119
The numerical values are not metric, so avarages are not meaningful.
121
Note: These methods always return a value. A false value (0) might
122
mean that you have not set the position! Check those warnings.
126
=head2 Bio::Map::MarkerI comparison methods
133
Usage : ($me, $you) = $self->_tuple($compare)
134
Function: Utility method to extract numbers and test for missing values.
135
Returns : two ranges or tuple of -1
136
Args : Bio::Map::MappableI or Bio::Map::PositionI
143
Usage : if( $mappable->less_than($m2) ) ...
144
Function: Tests if a position is less than another position
146
Args : Bio::Map::MappableI or Bio::Map::PositionI
152
my ($self,$compare) = @_;
154
my ($me, $you) = $self->tuple($compare);
155
return 0 if $me == -1 or $you == -1 ;
160
print STDERR "me=$me, you=$you\n" if $self->verbose > 0;
167
Usage : if( $mappable->greater_than($m2) ) ...
168
Function: Tests if position is greater than another position
170
Args : Bio::Map::MappableI or Bio::Map::PositionI
176
my ($self,$compare) = @_;
178
my ($me, $you) = $self->tuple($compare);
179
return 0 if $me == -1 or $you == -1 ;
183
print STDERR "me=$me, you=$you\n" if $self->verbose > 0;
187
=head2 RangeI methods
195
Usage : if( $mappable->equals($mapable2)) ...
196
Function: Test if a position is equal to another position
198
Args : Bio::Map::MappableI or Bio::Map::PositionI
203
my ($self,$compare) = @_;
205
my ($me, $you) = $self->tuple($compare);
206
return 0 unless $me->isa('Bio::RangeI') and $you->isa('Bio::RangeI');
208
return $me->equals($you);
214
Usage : if($r1->overlaps($r2)) { do stuff }
215
Function : tests if $r2 overlaps $r1
216
Args : a range to test for overlap with
217
Returns : true if the ranges overlap, false otherwise
218
Inherited: Bio::RangeI
223
my ($self,$compare) = @_;
225
my ($me, $you) = $self->tuple($compare);
226
return 0 unless $me->isa('Bio::RangeI') and $you->isa('Bio::RangeI');
228
return $me->overlaps($you);
234
Usage : if($r1->contains($r2) { do stuff }
235
Function : tests wether $r1 totaly contains $r2
236
Args : a range to test for being contained
237
Returns : true if the argument is totaly contained within this range
238
Inherited: Bio::RangeI
243
my ($self,$compare) = @_;
245
my ($me, $you) = $self->tuple($compare);
246
return 0 unless $me->isa('Bio::RangeI') and $you->isa('Bio::RangeI');
247
print STDERR "me=", $me->start. "-", $me->end, " ",
248
"you=", $you->start. "-", $you->end, "\n"
249
if $self->verbose > 0;
251
return $me->contains($you);
257
Usage : ($start, $stop, $strand) = $r1->intersection($r2)
258
Function : gives the range that is contained by both ranges
259
Args : a range to compare this one to
260
Returns : nothing if they do not overlap, or the range that they do overlap
261
Inherited: Bio::RangeI::intersection
266
my ($self,$compare) = @_;
268
my ($me, $you) = $self->tuple($compare);
269
return 0 unless $me->isa('Bio::RangeI') and $you->isa('Bio::RangeI');
271
return $me->intersection($you);
277
Usage : ($start, $stop, $strand) = $r1->union($r2);
278
: ($start, $stop, $strand) = Bio::Range->union(@ranges);
279
Function : finds the minimal range that contains all of the ranges
280
Args : a range or list of ranges to find the union of
281
Returns : the range containing all of the ranges
282
Inherited: Bio::RangeI::union
287
my ($self,$compare) = @_;
289
my ($me, $you) = $self->tuple($compare);
290
return 0 unless $me->isa('Bio::RangeI') and $you->isa('Bio::RangeI');
292
return $me->union($you);
296
116
=head2 New methods
304
123
Usage : my $mychr = $marker->get_chr();
305
124
Function: Read only method for the chromosome string of the location.
306
A shotrcut to $marker->position->chr().
125
A shortcut to $marker->position->chr().
307
126
Returns : chromosome value
308
127
Args : [optional] new chromosome value
315
return undef unless $self->position;
133
return unless $self->position;
316
134
return $self->position->chr;