Example #1
0
alignment chop_internal(alignment A, bool keep_empty_columns) 
{
  int N = (A.n_sequences()+2)/2;

  bool internal_nodes = true;
  for(int i=N;i<A.n_sequences();i++) {
    if (A.seq(i).name.size() == 0 or A.seq(i).name[0] != 'A') {
      internal_nodes = false; 
      break;
    }
    for(int column=0;column<A.length();column++) {
      if (alphabet::is_letter_class( A(column,i) )) {
	internal_nodes = false; 
	break;
      }
    }
  }

  if (not internal_nodes)
    return A;

  while(A.n_sequences() > N)
    A.del_sequence(N);

  if (not keep_empty_columns)
    remove_empty_columns(A);

  return A;
}