Class: Bio::AssemblyGraphAlgorithms::PairedEndAssembler

Inherits:
SingleEndedAssembler show all
Includes:
FinishM::Logging
Defined in:
lib/assembly/paired_end_assembler.rb

Constant Summary

Constants inherited from SingleEndedAssembler

SingleEndedAssembler::ASSEMBLY_OPTIONS, SingleEndedAssembler::DEFAULT_MAX_TIP_LENGTH, SingleEndedAssembler::DEFAULT_MIN_CONFIRMING_RECOHERENCE_READS, SingleEndedAssembler::DEFAULT_MIN_CONTIG_SIZE

Instance Attribute Summary

Attributes inherited from SingleEndedAssembler

#assembly_options, #graph

Instance Method Summary collapse

Methods included from FinishM::Logging

#log

Methods inherited from SingleEndedAssembler

#assemble, #find_beginning_trail_from_node, #find_tip_distance, #gather_starting_nodes, #initialize, #is_short_tip?, #remove_seen_nodes_from_end_of_path, #remove_tips, #seen_last_in_path?, #setup_progressbar

Constructor Details

This class inherits a constructor from Bio::AssemblyGraphAlgorithms::SingleEndedAssembler

Instance Method Details

#assemble_from(initial_path, visited_nodes) ⇒ Object

Assemble considering reads as a possibly paired-ended. Options are as per SingleEndedAssembler#assemble_from, with the addition of :min_insert_size: minimum length of fragment pair required to satisfy the additional constraints of the paired end assembler. :max_insert_size: maximum length of fragment pair.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/assembly/paired_end_assembler.rb', line 9

def assemble_from(initial_path, visited_nodes)
  visited_nodes = Set.new
  while true
    # Try to assemble using single ended techniques first, and only if that fails fall
    # back to paired-end techniques.
    path, visited_nodes, next_neighbours = super(initial_path, visited_nodes)

    # The next_neighbours
    if next_neighbours.empty?
      # No-where to go, do nothing
      # TODO: try to jump over the gap using paired-end sequences
    elsif next_neighbours.length < 2
      raise "Programming error"
    else
      # Choose between forks based on paired-end data
      next_neighbours.select! do |oneigh|
        confirm_connection_backwards(oneigh, path)
      end
    end
  end
end

#confirm_connection_backwards(new_onode, current_path, min_insert_size, max_insert_size) ⇒ Object

Return true if the backward connection is strong enough to warrant adding the new_node to the current_path. Else return false

In order to qualify as a warranted path, reads from the pair must have at least 1 connection backwards at least options backwards from the end of the current path, but not more than options Connection length is the length of the read pair’s insert size.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/assembly/paired_end_assembler.rb', line 38

def confirm_connection_backwards(new_onode, current_path, min_insert_size, max_insert_size)
  min_insert_size = @assembly_options[:min_insert_size]
  max_insert_size = @assembly_options[:max_insert_size]

  # Collect the reads that would qualify if they were in the new node
  qualifying_reads = Set.new
  current_path.reverse.each do |node|

  end

  # Look at all the sequences in the new onode. Do any of them qualify
  new_onode.node.short_reads.each do |short|

  end
end