lib/assembly/contig_printer.rb in finishm-0.0.6 vs lib/assembly/contig_printer.rb in finishm-0.0.7
- old
+ new
@@ -82,14 +82,10 @@
# Stage2 - path sequence, beginning and ending with
# beginning and ending probes
begin
example_path = anchored_connection.paths[0]
- path_sequence, variants = sequences_to_variants_conservative(
- anchored_connection.paths.collect{|path| path.sequence}
- )
- log.debug "Reference path has a sequence length #{path_sequence.length}" if log.debug?
# Find start index
begin_onode = example_path[0]
begin_noded_read = anchored_connection.start_probe_noded_read
raise if begin_noded_read.nil?
@@ -105,9 +101,23 @@
# extra bit on read needs to be reverse complemented
extra_bit_on_start = Bio::Sequence::NA.new(extra_bit_on_start).reverse_complement.to_s.upcase unless extra_bit_on_start == ''
else
offset_of_begin_probe_on_path = begin_noded_read.offset_from_start_of_node
end
+
+ path_sequence, variants = sequences_to_variants_conservative(
+ anchored_connection.paths.collect do |path|
+ seq = nil
+ begin
+ seq = path.sequence
+ rescue Bio::Velvet::Graph::OrientedNodeTrail::InsufficientLengthException => e
+ log.warn "Failed to join two contigs together because of inability to get sequence out of a trail of nodes. In the past this has been caused by low coverage thus making finishM inappropriate, so returning an unconnected contig now. However, this may be legitimate in the case of an unlucky misassembly at both ends of the contigs being joined, so please report this error to the author."
+ return nil, nil
+ end
+ seq
+ end
+ )
+ log.debug "Reference path has a sequence length #{path_sequence.length}" if log.debug?
# Correct variants' positions to be relative to the full contig,
# not just the path sequence
variants.each do |variant|
variant.position = variant.position - offset_of_begin_probe_on_path + to_return.length + 1