Class: StrideAlign::Scores

Inherits:
Object
  • Object
show all
Defined in:
lib/stride_align/alignment_path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query, variant: :smith_waterman, match_score: 2, mismatch_score: -1,, gap_score: -1,, gap_open_score: nil, gap_extend_score: nil, width: nil) ⇒ Scores

Returns a new instance of Scores.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/stride_align/alignment_path.rb', line 69

def initialize(query, variant: :smith_waterman, match_score: 2,
               mismatch_score: -1, gap_score: -1,
               gap_open_score: nil, gap_extend_score: nil, width: nil)
  @query = StrideAlign.__send__(:scalar_query, query)
  @variant = variant.to_sym
  @variant = :smith_waterman_farrar if @variant == :farrar
  @compare_method = case @variant
                    when :smith_waterman then :smith_waterman_scores
                    when :needleman_wunsch then :needleman_wunsch_scores
                    when :smith_waterman_farrar then :smith_waterman_farrar_scores
                    else
                      raise ArgumentError, "unknown score variant: #{variant}"
                    end
  @options = {
    match_score: match_score, mismatch_score: mismatch_score,
    gap_score: gap_score, gap_open_score: gap_open_score,
    gap_extend_score: gap_extend_score, width: width
  }
end

Instance Attribute Details

#queryObject (readonly)

Returns the value of attribute query.



67
68
69
# File 'lib/stride_align/alignment_path.rb', line 67

def query
  @query
end

#variantObject (readonly)

Returns the value of attribute variant.



67
68
69
# File 'lib/stride_align/alignment_path.rb', line 67

def variant
  @variant
end

Instance Method Details

#compare(targets) ⇒ Object



89
90
91
# File 'lib/stride_align/alignment_path.rb', line 89

def compare(targets)
  StrideAlign.public_send(@compare_method, @query, targets, **@options)
end