hmmer-3.3/src/p7_hmm.c
/* Function:  p7_hmm_CalculateOccupancy()
 * Synopsis:  Calculate match occupancy and insert expected use count vectors.
 *
 * Purpose:   Calculate a vector <mocc[1..M]> containing probability
 *            that each match state is used in a sampled glocal path through
 *            the model. Caller provides allocated space (<M+1> floats)
 *            for <mocc>.
 *            
 *            Caller may optionally provide an array <iocc[0..M]> as
 *            well, which (if provided) will be set to contain the
 *            expected number of times that a sampled path would contain
 *            each insert state.
 *
 * Returns:   <eslOK> on success.
 */
p7_hmm_CalculateOccupancy()
Synopsis:  Calculate match occupancy and insert expected use count vectors.

Calculate a vector  containing probability
that each match state is used in a sampled glocal path through
the model. Caller provides allocated space ( floats)
for .

Caller may optionally provide an array  as
well, which (if provided) will be set to contain the
expected number of times that a sampled path would contain
each insert state.

 on success.
p7_hmm_CalculateOccupancy () Synopsis : Calculate match occupancy and insert expected use count vectors . Calculate a vector containing probability that each match state is used in a sampled glocal path through the model . Caller provides allocated space ( floats ) for . Caller may optionally provide an array as well which ( if provided ) will be set to contain the expected number of times that a sampled path would contain each insert state . on success .
int
p7_hmm_CalculateOccupancy(const P7_HMM *hmm, float *mocc, float *iocc)
{
  int k;
  mocc[0] = 0.;			                     
  mocc[1] = hmm->t[0][p7H_MI] + hmm->t[0][p7H_MM];   
  for (k = 2; k <= hmm->M; k++)
      mocc[k] = mocc[k-1] * (hmm->t[k-1][p7H_MM] + hmm->t[k-1][p7H_MI]) +
        (1.0-mocc[k-1]) * hmm->t[k-1][p7H_DM];
  if (iocc != NULL) {
    iocc[0] = hmm->t[0][p7H_MI] / hmm->t[0][p7H_IM];
    for (k = 1; k <= hmm->M; k++)
      iocc[k] = mocc[k] * hmm->t[k][p7H_MI] / hmm->t[k][p7H_IM];
  }
  return eslOK;
}
int p7_hmm_CalculateOccupancy ( const P7_HMM * hmm , float * mocc , float * iocc ) { int k ; mocc [ 0 ] = 0. ; mocc [ 1 ] = hmm -> t [ 0 ] [ p7H_MI ] + hmm -> t [ 0 ] [ p7H_MM ] ; for ( k = 2 ; k <= hmm -> M ; k ++ ) mocc [ k ] = mocc [ k - 1 ] * ( hmm -> t [ k - 1 ] [ p7H_MM ] + hmm -> t [ k - 1 ] [ p7H_MI ] ) + ( 1.0 - mocc [ k - 1 ] ) * hmm -> t [ k - 1 ] [ p7H_DM ] ; if ( iocc != NULL ) { iocc [ 0 ] = hmm -> t [ 0 ] [ p7H_MI ] / hmm -> t [ 0 ] [ p7H_IM ] ; for ( k = 1 ; k <= hmm -> M ; k ++ ) iocc [ k ] = mocc [ k ] * hmm -> t [ k ] [ p7H_MI ] / hmm -> t [ k ] [ p7H_IM ] ; } return eslOK ; }
Function:  p7_hmm_CalculateOccupancy()
 Synopsis:  Calculate match occupancy and insert expected use count vectors.
Function : p7_hmm_CalculateOccupancy () Synopsis : Calculate match occupancy and insert expected use count vectors .
/* no M_0 state */ /* initialize w/ 1 - B->D_1 */