Sha256: f80587958b589d1ba5f978f699446603ed07947b64713ba5f804853e1f4625ec

Contents?: true

Size: 768 Bytes

Versions: 1

Compression:

Stored size: 768 Bytes

Contents

module Macroape
  class PWMCompare
    attr_reader :first, :second
    def initialize(first, second)
      @first = first
      @second = second
    end

    def jaccard(threshold_first, threshold_second)
      self.map_each_alignment do |alignment|
        alignment.alignment_infos.merge( alignment.jaccard(threshold_first, threshold_second) )
      end.max_by {|alignment_infos| alignment_infos[:similarity] }
    end

    def each_alignment
      (-second.length..first.length).to_a.product([:direct,:revcomp]) do |shift, orientation|
        yield PWMCompareAligned.new(first, second, shift, orientation)
      end
    end

    include Enumerable
    alias_method :each, :each_alignment
    alias_method :map_each_alignment, :map
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
macroape-3.3.3 lib/macroape/pwm_compare.rb