Module: Bio::BioAlignment::DelNonInformativeSequences

Includes:
MarkRows
Defined in:
lib/bio-alignment/edit/del_non_informative_sequences.rb

Instance Method Summary collapse

Methods included from MarkRows

#mark_row_elements, #mark_rows

Instance Method Details

#del_non_informative_sequences(percentage = 30) ⇒ Object



22
23
24
# File 'lib/bio-alignment/edit/del_non_informative_sequences.rb', line 22

def del_non_informative_sequences percentage=30
  mark_non_informative_sequences.rows_where { |row| !row.state.deleted? }
end

#mark_non_informative_sequences(percentage = 30) ⇒ Object

Return a new alignment with rows marked for deletion, i.e. mark rows that mostly contain undefined elements and 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_non_informative_sequences.rb', line 12

def mark_non_informative_sequences percentage = 30
  mark_rows { |state,row| 
    num = row.count { |e| e.gap? or e.undefined? }
    if (num.to_f/row.length) > 1.0-percentage/100.0
      state.delete!
    end
    state
  }
end