class RGFA::CIGAR::Operation

An operation in a CIGAR string

Constants

CODE

CIGAR operation code

Attributes

code[RW]
len[RW]

Public Class Methods

new(len, code) click to toggle source

@param len [Integer] length of the operation @param code [RGFA::CIGAR::Operation::CODE] code of the operation

# File lib/rgfa/cigar.rb, line 102
def initialize(len, code)
  @len = len
  @code = code
end

Public Instance Methods

==(other) click to toggle source

Compare two operations @return [Boolean]

# File lib/rgfa/cigar.rb, line 115
def ==(other)
  other.len == len and other.code == code
end
to_cigar_operation() click to toggle source

@return [RGFA::CIGAR::Operation] self

# File lib/rgfa/cigar.rb, line 131
def to_cigar_operation
  self
end
to_s() click to toggle source

The string representation of the operation @return [String]

# File lib/rgfa/cigar.rb, line 109
def to_s
  "#{len}#{code}"
end
validate!() click to toggle source

Validate the operation @return [void] @raise [RGFA::CIGAR::ValueError] if the code is invalid or the length is not

an integer larger than zero
# File lib/rgfa/cigar.rb, line 123
def validate!
  if Integer(len) <= 0 or
       !RGFA::CIGAR::Operation::CODE.include?(code)
    raise RGFA::CIGAR::ValueError
  end
end