Class: GFA::Record::Segment

Inherits:
GFA::Record show all
Defined in:
lib/gfa/record/segment.rb

Constant Summary collapse

CODE =
:S
REQ_FIELDS =
%i[name sequence]
OPT_FIELDS =
{
  LN: :i, # Segment length
  RC: :i, # Read count
  FC: :i, # Fragment count
  KC: :i, # k-mer count
  SH: :H, # SHA-256 checksum of the sequence
  UR: :Z, # URI or local file-system path of the sequence
  # Non-cannonical
  DP: :f  # (From SAM)
}

Constants inherited from GFA::Record

CODES, TYPES

Instance Attribute Summary

Attributes inherited from GFA::Record

#fields

Instance Method Summary collapse

Methods inherited from GFA::Record

#[], [], #code, code_class, #empty?, #eql?, #hash, name_class, #to_s, #type

Constructor Details

#initialize(name, sequence, *opt_fields) ⇒ Segment

Returns a new instance of Segment.



20
21
22
23
24
25
# File 'lib/gfa/record/segment.rb', line 20

def initialize(name, sequence, *opt_fields)
  @fields = {}
  add_field(2, :Z, name,     /[!-)+-<>-~][!-~]*/)
  add_field(3, :Z, sequence, /\*|[A-Za-z=.]+/)
  opt_fields.each { |f| add_opt_field(f, OPT_FIELDS) }
end