Exemple #1
0
static
inline
typename ST::element
subst_score(const ST& st, const Column<T>& x, const Column<T>& y)
{
  typedef typename ST::element value_type;
  const T GAP = RNASymbol<T>::GAP;
  value_type v_c = 0.0;
  uint n=0;
  for (uint s=0; s!=x.n_seqs(); ++s) {
    if (x[s]==GAP) continue;
    for (uint t=0; t!=y.n_seqs(); ++t) {
      if (y[t]==GAP) continue;
      v_c += st[index(x[s])][index(y[t])];
      ++n;
    }
  }
  return n==0 ? 1.0 : v_c / n;
}