Class: Bio::AssemblyGraphAlgorithms::HeightFinder::CyclicTraversalNode

Inherits:
TraversalNode
  • Object
show all
Defined in:
lib/assembly/height_finder.rb

Defined Under Namespace

Classes: CyclePath

Instance Attribute Summary collapse

Attributes inherited from TraversalNode

#height, #nodes_in, #nodes_out, #onode

Instance Method Summary collapse

Methods inherited from TraversalNode

#describe, #node_id

Instance Attribute Details

#cyclesObject

Returns the value of attribute cycles.



175
176
177
# File 'lib/assembly/height_finder.rb', line 175

def cycles
  @cycles
end

Instance Method Details

#initiate_cycle(onode) ⇒ Object



177
178
179
180
181
# File 'lib/assembly/height_finder.rb', line 177

def initiate_cycle(onode)
  cycle = CyclePath.new
  cycle.onodes = [onode]
  merge_unclosed_cycle cycle
end

#merge_unclosed_cycle(cycle) ⇒ Object



183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/assembly/height_finder.rb', line 183

def merge_unclosed_cycle(cycle)
  return if cycle.closed?
  if cycle.onodes.last == @onode
    cycle.closed = true
  else
    cycle.onodes.unshift @onode
  end
  if @cycles.nil?
    @cycles = [cycle]
  else
    @cycles.push(cycle)
  end
  return cycle
end