Sha256: 4f421ec49c0950716a4f512853f9435657b430974a77329954f7304770f6b914
Contents?: true
Size: 375 Bytes
Versions: 1
Compression:
Stored size: 375 Bytes
Contents
module Hamming def self.compute(pair) set_strand_position_by_length(pair) unless pair.same? count_the_distance(pair) end module_function 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.1 | lib/dna_hamming/hamming.rb |