Class: StrideAlign::AlignmentPath

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

Direct Known Subclasses

AlignmentResult

Constant Summary collapse

ATTRIBUTES =
%i[
  score query_start query_end target_start target_end operations cigar
  matches mismatches insertions deletions aligned_length
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(score: 0, query_start: 0, query_end: 0, target_start: 0, target_end: 0, operations: "", cigar: "", matches: 0, mismatches: 0, insertions: 0, deletions: 0, aligned_length: nil) ⇒ AlignmentPath

Returns a new instance of AlignmentPath.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/stride_align/alignment_path.rb', line 12

def initialize(score: 0, query_start: 0, query_end: 0,
               target_start: 0, target_end: 0,
               operations: "", cigar: "", matches: 0,
               mismatches: 0, insertions: 0, deletions: 0,
               aligned_length: nil)
  @score = score
  @query_start = query_start
  @query_end = query_end
  @target_start = target_start
  @target_end = target_end
  @operations = operations
  @cigar = cigar
  @matches = matches
  @mismatches = mismatches
  @insertions = insertions
  @deletions = deletions
  @aligned_length = aligned_length.nil? ? operations.length : aligned_length
end

Instance Method Details

#inspectObject



35
36
37
38
# File 'lib/stride_align/alignment_path.rb', line 35

def inspect
  "#<#{self.class} score=#{score} query=[#{query_start},#{query_end}) " \
    "target=[#{target_start},#{target_end}) cigar=#{cigar.inspect}>"
end

#to_hObject



31
32
33
# File 'lib/stride_align/alignment_path.rb', line 31

def to_h
  ATTRIBUTES.each_with_object({}) { |name, output| output[name] = public_send(name) }
end