class Align::PairwiseAlgorithm

Provides a base for algorithms that align two sequences.

Attributes

scoring[R]
seq1[R]
seq2[R]

Public Class Methods

new(seq1, seq2, scoring) click to toggle source
# File lib/align/pairwise_algorithm.rb, line 6
def initialize(seq1, seq2, scoring)
  @seq1 = seq1
  @seq2 = seq2
  @scoring = scoring
end

Public Instance Methods

align() click to toggle source

Returns the sequences in aligned arrays. Gaps are filled with :skip_obj @return Two arrays containing the sequences, and their elements.

# File lib/align/pairwise_algorithm.rb, line 34
def align
  raise NotImplementedError.new("#{self.class}#align")
end
max2(a,b) click to toggle source

Max of 2

# File lib/align/pairwise_algorithm.rb, line 13
def max2(a,b)
  a >= b ? a : b
end
max3(a,b,c) click to toggle source

Determines the maximum value of three variables. 3-4 times faster than [a,b,c].max.

# File lib/align/pairwise_algorithm.rb, line 19
def max3(a,b,c)
  (a >= b) ? ((a >= c)? a : c) : ((b >= c)? b : c)
end
max4(a,b,c,d) click to toggle source

Returns the max of 4 integers

# File lib/align/pairwise_algorithm.rb, line 24
def max4(a,b,c,d)
  x = a >= b ? a : b
  y = c >= d ? c : d
  (x >= y) ? x : y
end