Exemplo n.º 1
0
alignment add_internal(alignment A,const Tree& T) 
{
  // Complain if A and T don't correspond
  if (A.n_sequences() != T.n_leaves())
    throw myexception()<<"Number of sequence in alignment doesn't match number of leaves in tree"
		       <<"- can't add internal sequences";

  // Add empty sequences
  for(int i=T.n_leaves();i<T.n_nodes();i++) {
    sequence s;
    s.name = string("A") + convertToString(i);
    A.add_sequence(s);
  }

  // Set them to all gaps
  for(int column=0;column<A.length();column++)
    for(int i=T.n_leaves();i<T.n_nodes();i++)
      A(column,i) = alphabet::gap;

  return A;
}