[BioRuby-cvs] bioruby/lib/bio map.rb,1.10,1.11

Jan Aerts aerts at dev.open-bio.org
Thu Apr 12 12:19:18 UTC 2007


Update of /home/repository/bioruby/bioruby/lib/bio
In directory dev.open-bio.org:/tmp/cvs-serv32200/lib/bio

Modified Files:
	map.rb 
Log Message:
* Added mappings_on method to Bio::Map::ActsLikeMarker.
* Extended unit tests to get 100% coverage.


Index: map.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/map.rb,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** map.rb	5 Apr 2007 23:45:10 -0000	1.10
--- map.rb	12 Apr 2007 12:19:16 -0000	1.11
***************
*** 263,266 ****
--- 263,286 ----
          return positions
        end
+ 
+       # Return all mappings of this marker on a given map.
+       # ---
+       # *Arguments*:
+       # * _map_: an object that mixes in Bio::Map::ActsLikeMap
+       # *Returns*:: array of Bio::Map::Mapping objects
+       def mappings_on(map)
+         unless map.class.include?(Bio::Map::ActsLikeMap)
+           raise "[Error] map is not object that implements Bio::Map::ActsLikeMap"
+         end
+         
+         m = Array.new
+         self.mappings_as_marker.each do |mapping|
+           if mapping.map == map
+             m.push(mapping)
+           end
+         end
+         
+         return m
+       end
        
  
***************
*** 304,308 ****
          end
  
!         return self.location.<=>(other.location)
        end
      end # Mapping
--- 324,328 ----
          end
  
!         return self.location[0].<=>(other.location[0])
        end
      end # Mapping




More information about the bioruby-cvs mailing list