Module: Bio::Map

Defined in:
lib/bio/map.rb

Overview

Description

The Bio::Map contains classes that describe mapping information and can be used to contain linkage maps, radiation-hybrid maps, etc. As the same marker can be mapped to more than one map, and a single map typically contains more than one marker, the link between the markers and maps is handled by Bio::Map::Mapping objects. Therefore, to link a map to a marker, a Bio::Map::Mapping object is added to that Bio::Map. See usage below.

Not only maps in the strict sense have map-like features (and similarly not only markers in the strict sense have marker-like features). For example, a microsatellite is something that can be mapped on a linkage map (and hence becomes a ‘marker’), but a clone can also be mapped to a cytogenetic map. In that case, the clone acts as a marker and has marker-like properties. That same clone can also be considered a ‘map’ when BAC-end sequences are mapped to it. To reflect this flexibility, the modules Bio::Map::ActsLikeMap and Bio::Map::ActsLikeMarker define methods that are typical for maps and markers.

– In a certain sense, a biological sequence also has map- and marker-like properties: things can be mapped to it at certain locations, and the sequence itself can be mapped to something else (e.g. the BAC-end sequence example above, or a BLAST-result). ++

Usage

my_marker1 = Bio::Map::Marker.new('marker1')
my_marker2 = Bio::Map::Marker.new('marker2')
my_marker3 = Bio::Map::Marker.new('marker3')

my_map1 = Bio::Map::SimpleMap.new('RH_map_ABC (2006)', 'RH', 'cR')
my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM')

my_map1.add_mapping_as_map(my_marker1, '17')
my_map1.add_mapping_as_map(Bio::Map::Marker.new('marker2'), '5')
my_marker3.add_mapping_as_marker(my_map1, '9')

print "Does my_map1 contain marker3? => "
puts my_map1.contains_marker?(my_marker3).to_s
print "Does my_map2 contain marker3? => "
puts my_map2.contains_marker?(my_marker3).to_s

my_map1.mappings_as_map.sort.each do |mapping|
  puts [ mapping.map.name,
         mapping.marker.name,
         mapping.location.from.to_s,
         mapping.location.to.to_s ].join("\t")
end
puts my_map1.mappings_as_map.min.marker.name

my_map2.mappings_as_map.each do |mapping|
  puts [ mapping.map.name,
         mapping.marker.name,
         mapping.location.from.to_s,
         mapping.location.to.to_s ].join("\t")
end

Defined Under Namespace

Modules: ActsLikeMap, ActsLikeMarker Classes: Mapping, Marker, SimpleMap