Class: GFA::Record::Link

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

Constant Summary collapse

CODE =
:L
REQ_FIELDS =
i[from from_orient to to_orient overlap]
OPT_FIELDS =
{
  MQ: :i, # Mapping quality
  NM: :i, # Number of mismatches/gaps
  EC: :i, # Read count
  FC: :i, # Fragment count
  KC: :i, # k-mer count
  ID: :Z  # Edge identifier
}

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(from, from_orient, to, to_orient, overlap, *opt_fields) ⇒ Link



18
19
20
21
22
23
24
25
26
# File 'lib/gfa/record/link.rb', line 18

def initialize(from, from_orient, to, to_orient, overlap, *opt_fields)
  @fields = {}
  add_field(2, :Z, from,        /[!-)+-<>-~][!-~]*/)
  add_field(3, :Z, from_orient, /[+-]/)
  add_field(4, :Z, to,          /[!-)+-<>-~][!-~]*/)
  add_field(5, :Z, to_orient,   /[+-]/)
  add_field(6, :Z, overlap,     /\*|([0-9]+[MIDNSHPX=])+/)
  opt_fields.each { |f| add_opt_field(f, OPT_FIELDS) }
end

Instance Method Details

#from?(segment, orient = nil) ⇒ Boolean



28
29
30
# File 'lib/gfa/record/link.rb', line 28

def from?(segment, orient = nil)
  links_from_to?(segment, orient, true)
end

#to?(segment, orient = nil) ⇒ Boolean



32
33
34
# File 'lib/gfa/record/link.rb', line 32

def to?(segment, orient = nil)
  links_from_to?(segment, orient, false)
end