hmmer-3.3/src/p7_hmm.c
/* Function:  p7_hmm_Compare()
 * Synopsis:  Compare two HMMs for equality.
 *
 * Purpose:   Compare two HMMs <h1> and <h2> to each other;
 *            return <eslOK> if they're identical, and <eslFAIL>
 *            if they differ. Floating-point probabilities are 
 *            compared for equality within a fractional tolerance
 *            <tol>. 
 */
p7_hmm_Compare()
Synopsis:  Compare two HMMs for equality.

Compare two HMMs  and  to each other;
return  if they're identical, and 
if they differ. Floating-point probabilities are
compared for equality within a fractional tolerance
.
p7_hmm_Compare () Synopsis : Compare two HMMs for equality . Compare two HMMs and to each other ; return if they ' re identical and if they differ . Floating - point probabilities are compared for equality within a fractional tolerance .
int
p7_hmm_Compare(P7_HMM *h1, P7_HMM *h2, float tol)
{
  int k, z;
  if (h1->abc->type != h2->abc->type) return eslFAIL;
  if (h1->M         != h2->M)         return eslFAIL;
  if (h1->flags     != h2->flags)     return eslFAIL;
  for (k = 0; k <= h1->M; k++)	
    {
      if (esl_vec_FCompare(h1->mat[k], h2->mat[k], h1->abc->K, tol) != eslOK) return eslFAIL;
      if (esl_vec_FCompare(h1->ins[k], h2->ins[k], h1->abc->K, tol) != eslOK) return eslFAIL;
      if (esl_vec_FCompare(h1->t[k],   h2->t[k],   7,          tol) != eslOK) return eslFAIL;
    }
  if (strcmp(h1->name,   h2->name)   != 0) return eslFAIL;
  if (esl_strcmp(h1->comlog, h2->comlog) != 0) return eslFAIL;
  if (strcmp(h1->ctime,  h2->ctime)  != 0) return eslFAIL;
  if (h1->nseq     != h2->nseq)                                      return eslFAIL;
  if (esl_FCompare(h1->eff_nseq, h2->eff_nseq, tol) != eslOK)        return eslFAIL;
  if (h1->checksum != h2->checksum)        return eslFAIL;
  if (esl_strcmp(h1->acc,  h2->acc)  != 0) return eslFAIL;
  if (esl_strcmp(h1->desc, h2->desc) != 0) return eslFAIL;
  if ((h1->flags & p7H_RF)    && esl_strcmp(h1->rf,        h2->rf)           != 0) return eslFAIL;
  if ((h1->flags & p7H_MMASK) && esl_strcmp(h1->mm,        h2->mm)           != 0) return eslFAIL;
  if ((h1->flags & p7H_CONS)  && esl_strcmp(h1->consensus, h2->consensus)    != 0) return eslFAIL;
  if ((h1->flags & p7H_CS)    && esl_strcmp(h1->cs,        h2->cs)           != 0) return eslFAIL;
  if ((h1->flags & p7H_CA)    && esl_strcmp(h1->ca,        h2->ca)           != 0) return eslFAIL;
  if ((h1->flags & p7H_MAP)   && esl_vec_ICompare(h1->map, h2->map, h1->M+1) != 0) return eslFAIL;
  if (h1->flags & p7H_GA) {
    if (esl_FCompare(h1->cutoff[p7_GA1], h2->cutoff[p7_GA1], tol) != eslOK) return eslFAIL;
    if (esl_FCompare(h1->cutoff[p7_GA2], h2->cutoff[p7_GA2], tol) != eslOK) return eslFAIL;
  }
  if (h1->flags & p7H_TC) {
    if (esl_FCompare(h1->cutoff[p7_TC1], h2->cutoff[p7_TC1], tol) != eslOK) return eslFAIL;
    if (esl_FCompare(h1->cutoff[p7_TC2], h2->cutoff[p7_TC2], tol) != eslOK) return eslFAIL;
  }
  if (h1->flags & p7H_NC) {
    if (esl_FCompare(h1->cutoff[p7_NC1], h2->cutoff[p7_NC1], tol) != eslOK) return eslFAIL;
    if (esl_FCompare(h1->cutoff[p7_NC2], h2->cutoff[p7_NC2], tol) != eslOK) return eslFAIL;
  }
  if (h1->flags & p7H_STATS) {
    for (z = 0; z < p7_NEVPARAM; z++)
      if (esl_FCompare(h1->evparam[z], h2->evparam[z], tol) != eslOK) return eslFAIL;
  }
  return eslOK;
}
int p7_hmm_Compare ( P7_HMM * h1 , P7_HMM * h2 , float tol ) { int k , z ; if ( h1 -> abc -> type != h2 -> abc -> type ) return eslFAIL ; if ( h1 -> M != h2 -> M ) return eslFAIL ; if ( h1 -> flags != h2 -> flags ) return eslFAIL ; for ( k = 0 ; k <= h1 -> M ; k ++ ) { if ( esl_vec_FCompare ( h1 -> mat [ k ] , h2 -> mat [ k ] , h1 -> abc -> K , tol ) != eslOK ) return eslFAIL ; if ( esl_vec_FCompare ( h1 -> ins [ k ] , h2 -> ins [ k ] , h1 -> abc -> K , tol ) != eslOK ) return eslFAIL ; if ( esl_vec_FCompare ( h1 -> t [ k ] , h2 -> t [ k ] , 7 , tol ) != eslOK ) return eslFAIL ; } if ( strcmp ( h1 -> name , h2 -> name ) != 0 ) return eslFAIL ; if ( esl_strcmp ( h1 -> comlog , h2 -> comlog ) != 0 ) return eslFAIL ; if ( strcmp ( h1 -> ctime , h2 -> ctime ) != 0 ) return eslFAIL ; if ( h1 -> nseq != h2 -> nseq ) return eslFAIL ; if ( esl_FCompare ( h1 -> eff_nseq , h2 -> eff_nseq , tol ) != eslOK ) return eslFAIL ; if ( h1 -> checksum != h2 -> checksum ) return eslFAIL ; if ( esl_strcmp ( h1 -> acc , h2 -> acc ) != 0 ) return eslFAIL ; if ( esl_strcmp ( h1 -> desc , h2 -> desc ) != 0 ) return eslFAIL ; if ( ( h1 -> flags & p7H_RF ) && esl_strcmp ( h1 -> rf , h2 -> rf ) != 0 ) return eslFAIL ; if ( ( h1 -> flags & p7H_MMASK ) && esl_strcmp ( h1 -> mm , h2 -> mm ) != 0 ) return eslFAIL ; if ( ( h1 -> flags & p7H_CONS ) && esl_strcmp ( h1 -> consensus , h2 -> consensus ) != 0 ) return eslFAIL ; if ( ( h1 -> flags & p7H_CS ) && esl_strcmp ( h1 -> cs , h2 -> cs ) != 0 ) return eslFAIL ; if ( ( h1 -> flags & p7H_CA ) && esl_strcmp ( h1 -> ca , h2 -> ca ) != 0 ) return eslFAIL ; if ( ( h1 -> flags & p7H_MAP ) && esl_vec_ICompare ( h1 -> map , h2 -> map , h1 -> M + 1 ) != 0 ) return eslFAIL ; if ( h1 -> flags & p7H_GA ) { if ( esl_FCompare ( h1 -> cutoff [ p7_GA1 ] , h2 -> cutoff [ p7_GA1 ] , tol ) != eslOK ) return eslFAIL ; if ( esl_FCompare ( h1 -> cutoff [ p7_GA2 ] , h2 -> cutoff [ p7_GA2 ] , tol ) != eslOK ) return eslFAIL ; } if ( h1 -> flags & p7H_TC ) { if ( esl_FCompare ( h1 -> cutoff [ p7_TC1 ] , h2 -> cutoff [ p7_TC1 ] , tol ) != eslOK ) return eslFAIL ; if ( esl_FCompare ( h1 -> cutoff [ p7_TC2 ] , h2 -> cutoff [ p7_TC2 ] , tol ) != eslOK ) return eslFAIL ; } if ( h1 -> flags & p7H_NC ) { if ( esl_FCompare ( h1 -> cutoff [ p7_NC1 ] , h2 -> cutoff [ p7_NC1 ] , tol ) != eslOK ) return eslFAIL ; if ( esl_FCompare ( h1 -> cutoff [ p7_NC2 ] , h2 -> cutoff [ p7_NC2 ] , tol ) != eslOK ) return eslFAIL ; } if ( h1 -> flags & p7H_STATS ) { for ( z = 0 ; z < p7_NEVPARAM ; z ++ ) if ( esl_FCompare ( h1 -> evparam [ z ] , h2 -> evparam [ z ] , tol ) != eslOK ) return eslFAIL ; } return eslOK ; }
Function:  p7_hmm_Compare()
 Synopsis:  Compare two HMMs for equality.
Function : p7_hmm_Compare () Synopsis : Compare two HMMs for equality .
/* (it's safe to include 0 here.) */