hmmer-3.3/src/p7_trace.c
/* Function:  p7_trace_SetPP()
 * Synopsis:  Set posterior probs of an arbitrary trace.
 * Incept:    SRE, Tue Aug 19 14:16:10 2008 [Janelia]
 *
 * Purpose:   Set the posterior probability fields of an arbitrary
 *            trace <tr>, by accessing posterior residue probabilities
 *            in decoding matrix <pp>.
 *            
 *            In general, <pp> was created by <p7_GDecoding()> 
 *            or converted from the optimized matrix created by
 *            <p7_Decoding()>.
 *            
 *            This is classed as a debugging function for the moment,
 *            because in general traces with posterior probabilities are
 *            created directly using optimal accuracy DP routines.
 *            This function allows us to add PP annotation to any
 *            trace.
 * 
 * Returns:   <eslOK> on success.
 *
 * Throws:    <eslEMEM> on allocation error.
 *            <eslEINVAL> on internal corruptions.
 */
p7_trace_SetPP()
Synopsis:  Set posterior probs of an arbitrary trace.

Set the posterior probability fields of an arbitrary
trace , by accessing posterior residue probabilities
in decoding matrix .

In general,  was created by 
or converted from the optimized matrix created by
.

This is classed as a debugging function for the moment,
because in general traces with posterior probabilities are
created directly using optimal accuracy DP routines.
This function allows us to add PP annotation to any
trace.

 on success.

 on allocation error.
 on internal corruptions.
p7_trace_SetPP () Synopsis : Set posterior probs of an arbitrary trace . Set the posterior probability fields of an arbitrary trace by accessing posterior residue probabilities in decoding matrix . In general was created by or converted from the optimized matrix created by . This is classed as a debugging function for the moment because in general traces with posterior probabilities are created directly using optimal accuracy DP routines . This function allows us to add PP annotation to any trace . on success . on allocation error . on internal corruptions .
int
p7_trace_SetPP(P7_TRACE *tr, const P7_GMX *pp)
{
  float **dp  = pp->dp;		
  float  *xmx = pp->xmx;	
  int z;
  int status;
  if (tr->pp == NULL) ESL_ALLOC(tr->pp, sizeof(float) * tr->nalloc);
  for (z = 0; z < tr->N; z++)
    {
      if (tr->i[z] > 0)		
	{
	  switch (tr->st[z]) {
	  case p7T_M:  tr->pp[z] = MMX(tr->i[z], tr->k[z]); break;
	  case p7T_I:  tr->pp[z] = IMX(tr->i[z], tr->k[z]); break;
	  case p7T_N:  tr->pp[z] = XMX(tr->i[z], p7G_N);    break;
	  case p7T_C:  tr->pp[z] = XMX(tr->i[z], p7G_C);    break;
	  case p7T_J:  tr->pp[z] = XMX(tr->i[z], p7G_J);    break;
	  default:     ESL_EXCEPTION(eslEINVAL, "no such emitting state");
	  }
	}
      else
	tr->pp[z] = 0.0;
    }
  return eslOK;
 ERROR:
  return status;
}
int p7_trace_SetPP ( P7_TRACE * tr , const P7_GMX * pp ) { float * * dp = pp -> dp ; float * xmx = pp -> xmx ; int z ; int status ; if ( tr -> pp == NULL ) ESL_ALLOC ( tr -> pp , sizeof ( float ) * tr -> nalloc ) ; for ( z = 0 ; z < tr -> N ; z ++ ) { if ( tr -> i [ z ] > 0 ) { switch ( tr -> st [ z ] ) { case p7T_M : tr -> pp [ z ] = MMX ( tr -> i [ z ] , tr -> k [ z ] ) ; break ; case p7T_I : tr -> pp [ z ] = IMX ( tr -> i [ z ] , tr -> k [ z ] ) ; break ; case p7T_N : tr -> pp [ z ] = XMX ( tr -> i [ z ] , p7G_N ) ; break ; case p7T_C : tr -> pp [ z ] = XMX ( tr -> i [ z ] , p7G_C ) ; break ; case p7T_J : tr -> pp [ z ] = XMX ( tr -> i [ z ] , p7G_J ) ; break ; default : ESL_EXCEPTION ( eslEINVAL , " " ) ; } } else tr -> pp [ z ] = 0.0 ; } return eslOK ; ERROR : return status ; }
Function:  p7_trace_SetPP()
 Synopsis:  Set posterior probs of an arbitrary trace.
Function : p7_trace_SetPP () Synopsis : Set posterior probs of an arbitrary trace .
/* so {MDI}MX() macros work */ /* so XMX() macro works     */ /* an emitting state? */