hmmer-3.3/src/p7_profile.c
/* Function:  p7_profile_Validate()
 *
 * Purpose:   Validates the internals of the generic profile structure
 *            <gm>.
 *            
 *            TODO: currently this function is incomplete, and only
 *            validates the entry distribution.
 *            
 * Returns:   <eslOK> if <gm> internals look fine. Returns <eslFAIL>
 *            if something is wrong, and leaves an error message in
 *            <errbuf> if caller passed it non-<NULL>.
 */
p7_profile_Validate()
Purpose:   Validates the internals of the generic profile structure
.

currently this function is incomplete, and only
validates the entry distribution.

 if  internals look fine. Returns 
if something is wrong, and leaves an error message in
 if caller passed it non-.
p7_profile_Validate () Purpose : Validates the internals of the generic profile structure . currently this function is incomplete and only validates the entry distribution . if internals look fine . Returns if something is wrong and leaves an error message in if caller passed it non - .
int
p7_profile_Validate(const P7_PROFILE *gm, char *errbuf, float tol)
{
  int     status;
  int     k;
  double *pstart = NULL;
  ESL_ALLOC(pstart, sizeof(double) * (gm->M+1));
  pstart[0] = 0.0;
  if (p7_profile_IsLocal(gm))
    {				
      for (k = 1; k <= gm->M; k++)
	pstart[k] = exp(p7P_TSC(gm, k-1, p7P_BM)) * (gm->M - k + 1); 
    }
  else
    {
      for (k = 1; k <= gm->M; k++)
	pstart[k] = exp(p7P_TSC(gm, k-1, p7P_BM));
    }
  if (esl_vec_DValidate(pstart, gm->M+1, tol, NULL) != eslOK) ESL_XFAIL(eslFAIL, errbuf, "profile entry distribution is not normalized properly");
  free(pstart);
  return eslOK;
 ERROR:
  if (pstart != NULL) free(pstart);
  return eslFAIL;
}
int p7_profile_Validate ( const P7_PROFILE * gm , char * errbuf , float tol ) { int status ; int k ; double * pstart = NULL ; ESL_ALLOC ( pstart , sizeof ( double ) * ( gm -> M + 1 ) ) ; pstart [ 0 ] = 0.0 ; if ( p7_profile_IsLocal ( gm ) ) { for ( k = 1 ; k <= gm -> M ; k ++ ) pstart [ k ] = exp ( p7P_TSC ( gm , k - 1 , p7P_BM ) ) * ( gm -> M - k + 1 ) ; } else { for ( k = 1 ; k <= gm -> M ; k ++ ) pstart [ k ] = exp ( p7P_TSC ( gm , k - 1 , p7P_BM ) ) ; } if ( esl_vec_DValidate ( pstart , gm -> M + 1 , tol , NULL ) != eslOK ) ESL_XFAIL ( eslFAIL , errbuf , " " ) ; free ( pstart ) ; return eslOK ; ERROR : if ( pstart != NULL ) free ( pstart ) ; return eslFAIL ; }
Function:  p7_profile_Validate()
 Purpose:   Validates the internals of the generic profile structure
            <gm>.
Function : p7_profile_Validate () Purpose : Validates the internals of the generic profile structure <gm > .
/* Validate the entry distribution.
   * In a glocal model, this is an explicit probability distribution,
   * corresponding to left wing retraction.
   * In a local model, this is an implicit probability distribution,
   * corresponding to the implicit local alignment model, and we have
   * to calculate the M(M+1)/2 fragment probabilities accordingly.
   */ /* the code block below is also in emit.c:sample_endpoints */ /* multiply p_ij by the number of exits j */