Module: Bio::BioAlignment::MarkRows

Included in:
DelNonInformativeSequences, DelShortSequences, MaskIslands, MaskSerialMutations
Defined in:
lib/bio-alignment/edit/edit_rows.rb

Overview

Function for marking rows (sequences), when a row block returns the new state, and returning a newly cloned alignment

Instance Method Summary collapse

Instance Method Details

#mark_row_elements(&block) ⇒ Object

allow the marking of elements in a copied alignment, making sure each element is a proper Element object that can contain state.

A Sequence alignment will be turned into an Elements alignment.

Returns the new alignment



23
24
25
26
27
28
29
30
31
# File 'lib/bio-alignment/edit/edit_rows.rb', line 23

def mark_row_elements &block
  aln = markrows_clone
  aln.rows.each_with_index do | row,rownum |
    new_seq = block.call(Coerce::to_elements(row),rownum)
    # p [rownum,new_seq,row]
    aln.rows[rownum] = new_seq
  end
  aln
end

#mark_rows(&block) ⇒ Object

Mark each seq and return alignment



9
10
11
12
13
14
15
# File 'lib/bio-alignment/edit/edit_rows.rb', line 9

def mark_rows &block
  aln = markrows_clone
  aln.rows.each do | row |
    row.state = block.call(row.state,row)
  end
  aln
end