Module: Bio::BioAlignment::DelShortSequences
- Includes:
- MarkRows
- Defined in:
- lib/bio-alignment/edit/del_short_sequences.rb
Instance Method Summary collapse
-
#del_short_sequences(percentage = 30) ⇒ Object
Return an alignment with the bridges removed.
-
#mark_short_sequences(percentage = 30) ⇒ Object
Return a new alignment with rows marked for deletion, i.e.
Methods included from MarkRows
#mark_row_elements, #mark_rows
Instance Method Details
#del_short_sequences(percentage = 30) ⇒ Object
Return an alignment with the bridges removed
23 24 25 |
# File 'lib/bio-alignment/edit/del_short_sequences.rb', line 23 def del_short_sequences percentage=30 mark_short_sequences.rows_where { |row| !row.state.deleted? } end |
#mark_short_sequences(percentage = 30) ⇒ Object
Return a new alignment with rows marked for deletion, i.e. mark rows that mostly contain gaps (threshold percentage
). The alignment returned is a cloned copy
12 13 14 15 16 17 18 19 20 |
# File 'lib/bio-alignment/edit/del_short_sequences.rb', line 12 def mark_short_sequences percentage = 30 mark_rows { |state,row| num = row.count { |e| e.gap? } if (num.to_f/row.length) > 1.0-percentage/100.0 state.delete! end state } end |