def _build_subs_mat(obs_freq_mat, exp_freq_mat):
 if (obs_freq_mat.ab_list != exp_freq_mat.ab_list):
  raise ValueError('Alphabet mismatch in passed matrices')
 subs_mat = SubstitutionMatrix(obs_freq_mat)
 for i in obs_freq_mat:
  subs_mat[i] = (obs_freq_mat[i] / exp_freq_mat[i])
 return subs_mat

def _build_subs_mat ( obs_freq_mat , exp_freq_mat ) : if ( obs_freq_mat . ab_list != exp_freq_mat . ab_list ) : raise ValueError ( 'Alphabet mismatch in passed matrices' ) subs_mat = SubstitutionMatrix ( obs_freq_mat ) for i in obs_freq_mat : subs_mat [ i ] = ( obs_freq_mat [ i ] / exp_freq_mat [ i ] ) return subs_mat
build the substitution matrix .