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



26
27
28
# File 'lib/bio-alignment/edit/del_non_informative_sequences.rb', line 26

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

#mark_non_informative_sequences(percentage = 30) ⇒ Object

Count the informative elements in a sequence. If the count is less than percentage mark the sequence for deletion.

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



15
16
17
18
19
20
21
22
23
24
# File 'lib/bio-alignment/edit/del_non_informative_sequences.rb', line 15

def mark_non_informative_sequences percentage = 30
  percentage=30 if not percentage # for CLI
  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