Class: Bio::AssemblyGraphAlgorithms::SequenceHasher
- Inherits:
-
Object
- Object
- Bio::AssemblyGraphAlgorithms::SequenceHasher
- Includes:
- FinishM::Logging
- Defined in:
- lib/assembly/sequence_hasher.rb
Defined Under Namespace
Classes: DistancedOrientedNodeTrail
Instance Method Summary collapse
Methods included from FinishM::Logging
Instance Method Details
#extend_overlap(graph, oriented_onode, overlap, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/assembly/sequence_hasher.rb', line 8 def extend_overlap(graph, oriented_onode, overlap, ={}) trails = [] current_path = DistancedOrientedNodeTrail.new current_path.add_oriented_node oriented_onode current_path.distance = 0 stack = DS::Stack.new stack.push current_path # While there is more on the stack while current_path = stack.pop current_distance = current_path.distance if current_distance >= overlap # Found all the sequence we need trails.push current_path next end # Find neighbouring nodes neighbours = nil if [:neighbour_finder] neighbours = [:neighbour_finder].neighbours(oriented_onode) else neighbours = oriented_node.next_neighbours(graph) end neighbours.each do |onode| new_distance = current_distance if [:neighbour_finder] if onode.distance new_distance += onode.distance else new_distance += 0 end end new_distance += onode.node.length_alone new_path = current_path.copy new_path.add_oriented_node onode new_path.distance = new_distance stack.push new_path end end end |