Class: Bio::AssemblyGraphAlgorithms::AllOrfsFinder::AllProblemTrailsFinder

Inherits:
Object
  • Object
show all
Includes:
FinishM::Logging
Defined in:
lib/assembly/all_orfs.rb

Instance Method Summary collapse

Methods included from FinishM::Logging

#log

Constructor Details

#initialize(graph, initial_paths) ⇒ AllProblemTrailsFinder

Returns a new instance of AllProblemTrailsFinder.



639
640
641
642
643
644
645
# File 'lib/assembly/all_orfs.rb', line 639

def initialize(graph, initial_paths)
  @stack = DS::Stack.new
  initial_paths.each do |path|
    @stack.push path
  end
  @graph = graph
end

Instance Method Details

#popObject



647
648
649
# File 'lib/assembly/all_orfs.rb', line 647

def pop
  @stack.pop
end

#push_next_neighbours(current_path) ⇒ Object



655
656
657
658
659
660
661
662
663
664
665
# File 'lib/assembly/all_orfs.rb', line 655

def push_next_neighbours(current_path)
  next_nodes = current_path.neighbours_of_last_node(@graph)
  log.debug "Pushing #{next_nodes.length} new neighbours of #{current_path.last}" if log.debug?
  #TODO: not neccessary to copy all paths, can just continue one of them
  next_nodes.each do |n|
    log.debug "Pushing neighbour to stack: #{n}" if log.debug?
    path = current_path.copy
    path.add_oriented_node n
    @stack.push path
  end
end

#sizeObject



651
652
653
# File 'lib/assembly/all_orfs.rb', line 651

def size
  @stack.size
end