deps/kb_meme/meme-5.0.1/src/mhmm-state.c
/*************************************************************************
 * Given an HMM state, choose the most frequently occuring character.
 *
 * RETURN: The most common character in the given state's log-odds 
 *         emission distribution.
 *************************************************************************/
Given an HMM state, choose the most frequently occuring character.
RETURN: The most common character in the given state's log-odds
emission distribution.
Given an HMM state choose the most frequently occuring character . RETURN : The most common character in the given state ' s log - odds emission distribution .
char choose_consensus
  (ALPH_T*        alph,
   bool      log_space, 
   MHMM_STATE_T * a_state)   
{
  PROB_T maximum;
  int    i_max;
  int    i_freq;
  int    len;
  if ((a_state->type == SPACER_STATE) || (a_state->type == START_STATE)
      || (a_state->type == END_STATE)) {
    return('.');
  }
  if (log_space) {
    maximum = LOG_ZERO;
  } else {
    maximum = 0.0;
  }
  i_max = 0;
  for (i_freq = 0; i_freq < alph_size_core(alph); i_freq++) {
    if (log_space) {
      if (get_array_item(i_freq, a_state->emit_odds) > maximum) {
        i_max = i_freq;
        maximum = get_array_item(i_max, a_state->emit_odds);
      }
    } else {
      if (get_array_item(i_freq, a_state->emit) > maximum) {
        i_max = i_freq;
        maximum = get_array_item(i_max, a_state->emit);
      }
    }
  }
  return(alph_char(alph, i_max));
}
char choose_consensus ( ALPH_T * alph , bool log_space , MHMM_STATE_T * a_state ) { PROB_T maximum ; int i_max ; int i_freq ; int len ; if ( ( a_state -> type == SPACER_STATE ) || ( a_state -> type == START_STATE ) || ( a_state -> type == END_STATE ) ) { return ( ' ' ) ; } if ( log_space ) { maximum = LOG_ZERO ; } else { maximum = 0.0 ; } i_max = 0 ; for ( i_freq = 0 ; i_freq < alph_size_core ( alph ) ; i_freq ++ ) { if ( log_space ) { if ( get_array_item ( i_freq , a_state -> emit_odds ) > maximum ) { i_max = i_freq ; maximum = get_array_item ( i_max , a_state -> emit_odds ) ; } } else { if ( get_array_item ( i_freq , a_state -> emit ) > maximum ) { i_max = i_freq ; maximum = get_array_item ( i_max , a_state -> emit ) ; } } } return ( alph_char ( alph , i_max ) ) ; }
Given an HMM state, choose the most frequently occuring character.
Given an HMM state choose the most frequently occuring character .
/* Choose based on log-odds probs. */ /* State to be analyzed. */ /* Don't bother with start, end and spacer states. */ /* Find out which character has maximum logodds frequency. */ /* Convert the index to a character. */