Module: RGFATools::InvertibleSegments

Included in:
RGFATools
Defined in:
lib/rgfatools/invertible_segments.rb

Overview

Methods which edit the graph components without traversal

Instance Method Summary collapse

Instance Method Details

#randomly_orient_invertible(segment) ⇒ RGFA

Selects a random orientation for an invertible segment

Parameters:

  • segment (String, RGFA::Line::Segment)

    segment name or instance

Returns:


20
21
22
23
24
25
26
27
28
# File 'lib/rgfatools/invertible_segments.rb', line 20

def randomly_orient_invertible(segment)
  segment_name = segment.kind_of?(RGFA::Line) ? segment.name : segment
  if !segment_same_links_both_ends?(segment_name)
    raise "Only segments with links to the same or equivalent segments "+
            "at both ends can be randomly oriented"
  end
  randomly_orient_proven_invertible_segment(segment_name)
  self
end

#randomly_orient_invertiblesRGFA

Selects a random orientation for all invertible segments

Returns:


8
9
10
11
12
13
14
15
# File 'lib/rgfatools/invertible_segments.rb', line 8

def randomly_orient_invertibles
  segment_names.each do |sn|
    if segment_same_links_both_ends?(sn)
      randomly_orient_proven_invertible_segment(sn)
    end
  end
  self
end