Module: GFA::Record::HasFromTo

Included in:
Containment, Jump, Link
Defined in:
lib/gfa/record/has_from_to.rb

Instance Method Summary collapse

Instance Method Details

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

Returns:

  • (Boolean)


2
3
4
# File 'lib/gfa/record/has_from_to.rb', line 2

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

#include?(segment) ⇒ Boolean

Include a GFA::Record::Segment segment?

Returns:

  • (Boolean)


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

def include?(segment)
  # unless segment.is_a? GFA::Record::Segment
  #   raise "Unrecognized class: #{segment.class}"
  # end
  segment.name == from || segment.name == to
end

#segment_names_aObject

Array of strings with the names of the segments linked by the record



30
31
32
# File 'lib/gfa/record/has_from_to.rb', line 30

def segment_names_a
  [from.value, to.value]
end

#segments(gfa) ⇒ Object

Extracts all linked segments from gfa (which must be indexed)



12
13
14
15
16
# File 'lib/gfa/record/has_from_to.rb', line 12

def segments(gfa)
  raise 'Unindexed GFA' unless gfa.indexed?

  [gfa.segments[from.value], gfa.segments[to.value]]
end

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

Returns:

  • (Boolean)


6
7
8
# File 'lib/gfa/record/has_from_to.rb', line 6

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