Sha256: a40d34db6286f72eca36bdae951fa855e9e5712846f1496e3186ac90aa1d708e
Contents?: true
Size: 367 Bytes
Versions: 1
Compression:
Stored size: 367 Bytes
Contents
module Hamming def self.compute(pair) set_strand_position_by_length(pair) unless pair.same? count_the_distance(pair) end private def self.count_the_distance(pair) pair.entries.map(&:chars).inject(:zip).select{|a,b| a!=b}.count end def self.set_strand_position_by_length(pair) pair.swap! if pair.inject{|a,b|a.length>b.length} end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dna_hamming-0.1.0 | lib/dna_hamming/hamming.rb |