Module: RGFATools::Artifacts
- Included in:
- RGFATools
- Defined in:
- lib/rgfatools/artifacts.rb
Overview
Methods which edit the graph components without traversal
Instance Method Summary collapse
-
#remove_dead_ends(minlen) ⇒ RGFA
Remove end segments, whose sequence length is under a specified value.
-
#remove_small_components(minlen) ⇒ RGFA
Remove connected components whose sum of lengths of the segments is under a specified value.
Instance Method Details
#remove_dead_ends(minlen) ⇒ RGFA
Remove end segments, whose sequence length is under a specified value.
19 20 21 22 23 24 25 26 27 |
# File 'lib/rgfatools/artifacts.rb', line 19 def remove_dead_ends(minlen) segments.each do |s| c = connectivity(s) rm(s) if s.length < minlen and (c[0] == 0 or c[1] == 0) and !cut_segment?(s) end self end |
#remove_small_components(minlen) ⇒ RGFA
Remove connected components whose sum of lengths of the segments is under a specified value.
10 11 12 13 14 |
# File 'lib/rgfatools/artifacts.rb', line 10 def remove_small_components(minlen) rm(connected_components.select {|cc| cc.map{|sn|segment(sn).length}.reduce(:+) < minlen }) self end |