Class: GFA::Record::Segment
- Inherits:
-
GFA::Record
- Object
- GFA::Record
- GFA::Record::Segment
- 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 but uppercase (thus, reserved) DP: :f, # SAM SN: :Z, # rGFA: Name of stable sequence from which the segment is derived SO: :i, # rGFA: Offset on the stable sequence SR: :i # rGFA: Rank. 0 if on a linear reference genome; >0 otherwise }
Constants inherited from GFA::Record
Instance Attribute Summary
Attributes inherited from GFA::Record
Instance Method Summary collapse
-
#initialize(name, sequence, *opt_fields) ⇒ Segment
constructor
A new instance of Segment.
-
#length ⇒ Object
Returns the length of the sequence represented in this segment.
-
#rc ⇒ Object
Returns the reverse-complement of the sequence (as a Z field).
Methods inherited from GFA::Record
#[], [], #code, code_class, #dup, #empty?, #eql?, #hash, name_class, #to_s, #type
Constructor Details
#initialize(name, sequence, *opt_fields) ⇒ Segment
Returns a new instance of Segment.
23 24 25 26 27 28 |
# File 'lib/gfa/record/segment.rb', line 23 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 |
Instance Method Details
#length ⇒ Object
Returns the length of the sequence represented in this segment
32 33 34 |
# File 'lib/gfa/record/segment.rb', line 32 def length sequence.value.length end |