Class: Bio::AssemblyGraphAlgorithms::CoverageBasedGraphFilter
- Inherits:
-
Object
- Object
- Bio::AssemblyGraphAlgorithms::CoverageBasedGraphFilter
- Includes:
- FinishM::Logging
- Defined in:
- lib/assembly/coverage_based_graph_filter.rb
Instance Method Summary collapse
-
#remove_low_coverage_nodes(graph, threshold, options = {}) ⇒ Object
Remove all nodes from the graph that do not have sufficient coverage (i.e. possibly are sequencing error artefacts).
Methods included from FinishM::Logging
Instance Method Details
#remove_low_coverage_nodes(graph, threshold, options = {}) ⇒ Object
Remove all nodes from the graph that do not have sufficient coverage (i.e. possibly are sequencing error artefacts)
Options: :whitelisted_sequences: provide an enumerable of sequence IDs, don’t remove any nodes that have reads tracked to any of these IDs
Returns nodes_removed, arcs_removed (as objects, in particular order)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/assembly/coverage_based_graph_filter.rb', line 14 def remove_low_coverage_nodes(graph, threshold, = {}) graph.delete_nodes_if do |node| deleting = false if node.coverage and (node.coverage < threshold) deleting = true end if deleting and [:whitelisted_sequences] and !node.short_reads.nil? [:whitelisted_sequences].each do |seq_id| if node.short_reads.collect{|r| r.read_id}.include?(seq_id) deleting = false log.debug "Preserving low coverage but whitelisted node: #{node.node_id}" if log.debug? end end end deleting end end |