Class | Bio::Map::Mapping
In: | lib/bio/map.rb
Parent: | Object

## Description

Creates a new Bio::Map::Mapping object, which links Bio::Map::ActsAsMap- and Bio::Map::ActsAsMarker-like objects. This class is typically not accessed directly, but through map- or marker-like objects.

### Methods

<=> new

### Included Modules

Comparable

### Attributes

location | [RW] |
map | [RW] |
marker | [RW] |

### Public Class methods

new(map, marker, location = nil)

Creates a new Bio::Map::Mapping object

Arguments:

- map: a Bio::Map::SimpleMap object
- marker: a Bio::Map::Marker object
- location: a Bio::Locations object

[Source]

         # File lib/bio/map.rb, line 304
    304:       def initialize (map, marker, location = nil)
    305:         @map, @marker, @location = map, marker, location
    306:       end

### Public Instance methods

<=>(other)

Compares the location of this mapping to another mapping.

Arguments:

- other_mapping: Bio::Map::Mapping object

Returns::

- 1 if self < other location
- -1 if self > other location
- 0 if both location are the same
- nil if the argument is not a Bio::Location object

[Source]

         # File lib/bio/map.rb, line 318
    318:       def <=>(other)
    319:         unless other.kind_of?(Bio::Map::Mapping)
    320:           raise "[Error] markers are not comparable"
    321:         end
    322:             unless @map.equal?(other.map)
    323:           raise "[Error] maps have to be the same"
    324:         end
    325:
    326:         return self.location[0].<=>(other.location[0])
    327:       end

[Validate]