hmmer-3.3/easel/esl_sq.c
/* Function:  esl_sq_Compare()
 * Synopsis:  Compare two sequence objects for equality.
 * Incept:    SRE, Tue May 13 09:00:41 2008 [Janelia]
 *
 * Purpose:   Compare the contents of two sequence objects <sq1> 
 *            and <sq2> for equality.
 *            
 *            Disk offsets are only compared if they are set in both
 *            <sq1> and <sq2>. Allocation sizes are not compared at
 *            all.
 *
 * Returns:   <eslOK> if identical, <eslFAIL> if not.
 */
esl_sq_Compare()
Synopsis:  Compare two sequence objects for equality.

Compare the contents of two sequence objects 
and  for equality.

Disk offsets are only compared if they are set in both
 and . Allocation sizes are not compared at
all.

 if identical,  if not.
esl_sq_Compare () Synopsis : Compare two sequence objects for equality . Compare the contents of two sequence objects and for equality . Disk offsets are only compared if they are set in both and . Allocation sizes are not compared at all . if identical if not .
int
esl_sq_Compare(ESL_SQ *sq1, ESL_SQ *sq2)
{
  int   x;        
  if (strcmp(sq1->name,   sq2->name)   != 0) return eslFAIL;
  if (strcmp(sq1->acc,    sq2->acc)    != 0) return eslFAIL;
  if (strcmp(sq1->desc,   sq2->desc)   != 0) return eslFAIL;
  if (strcmp(sq1->source, sq2->source) != 0) return eslFAIL;
  if (sq1->ss != NULL && sq2->ss != NULL) {
    if (strcmp(sq1->ss, sq2->ss) != 0)       return eslFAIL;
  } else
    if (sq1->ss != NULL || sq2->ss != NULL)  return eslFAIL;
  if (sq1->n != sq2->n)                      return eslFAIL;
  if        (sq1->seq != NULL && sq2->seq != NULL) {
    if (strcmp(sq1->seq, sq2->seq) != 0)     return eslFAIL;
  } 
  else if (sq1->dsq != NULL && sq2->dsq != NULL) {
    if (memcmp(sq1->dsq, sq2->dsq, sizeof(ESL_DSQ) * (sq1->n+2)) != 0) return eslFAIL;
  }
  else return eslFAIL;
  if (sq1->start != sq2->start)              return eslFAIL;
  if (sq1->end   != sq2->end)                return eslFAIL;
  if (sq1->C     != sq2->C)                  return eslFAIL;
  if (sq1->W     != sq2->W)                  return eslFAIL;
  if (sq1->L     != sq2->L)                  return eslFAIL;
  if (sq1->roff != -1 && sq2->roff != -1 && sq1->roff != sq2->roff) return eslFAIL;
  if (sq1->doff != -1 && sq2->doff != -1 && sq1->doff != sq2->doff) return eslFAIL;
  if (sq1->hoff != -1 && sq2->hoff != -1 && sq1->hoff != sq2->hoff) return eslFAIL;
  if (sq1->eoff != -1 && sq2->eoff != -1 && sq1->eoff != sq2->eoff) return eslFAIL;
  if (sq1->nxr != sq2->nxr) return eslFAIL;
  for (x = 0; x < sq1->nxr; x++) {
    if (sq1->xr_tag[x] != NULL && sq2->xr_tag[x] != NULL) {
      if (strcmp(sq1->xr_tag[x], sq2->xr_tag[x]) != 0)      return eslFAIL;
    } else
      if (sq1->xr_tag[x] != NULL || sq2->xr_tag[x] != NULL) return eslFAIL;
    if (sq1->xr[x] != NULL && sq2->xr[x] != NULL) {
      if (strcmp(sq1->xr[x], sq2->xr[x]) != 0)      return eslFAIL;
    } else
      if (sq1->xr[x] != NULL || sq2->xr[x] != NULL) return eslFAIL;
  }
  if (sq1->abc != NULL && (sq1->abc->type != sq2->abc->type)) return eslFAIL;
  return eslOK;
}
int esl_sq_Compare ( ESL_SQ * sq1 , ESL_SQ * sq2 ) { int x ; if ( strcmp ( sq1 -> name , sq2 -> name ) != 0 ) return eslFAIL ; if ( strcmp ( sq1 -> acc , sq2 -> acc ) != 0 ) return eslFAIL ; if ( strcmp ( sq1 -> desc , sq2 -> desc ) != 0 ) return eslFAIL ; if ( strcmp ( sq1 -> source , sq2 -> source ) != 0 ) return eslFAIL ; if ( sq1 -> ss != NULL && sq2 -> ss != NULL ) { if ( strcmp ( sq1 -> ss , sq2 -> ss ) != 0 ) return eslFAIL ; } else if ( sq1 -> ss != NULL || sq2 -> ss != NULL ) return eslFAIL ; if ( sq1 -> n != sq2 -> n ) return eslFAIL ; if ( sq1 -> seq != NULL && sq2 -> seq != NULL ) { if ( strcmp ( sq1 -> seq , sq2 -> seq ) != 0 ) return eslFAIL ; } else if ( sq1 -> dsq != NULL && sq2 -> dsq != NULL ) { if ( memcmp ( sq1 -> dsq , sq2 -> dsq , sizeof ( ESL_DSQ ) * ( sq1 -> n + 2 ) ) != 0 ) return eslFAIL ; } else return eslFAIL ; if ( sq1 -> start != sq2 -> start ) return eslFAIL ; if ( sq1 -> end != sq2 -> end ) return eslFAIL ; if ( sq1 -> C != sq2 -> C ) return eslFAIL ; if ( sq1 -> W != sq2 -> W ) return eslFAIL ; if ( sq1 -> L != sq2 -> L ) return eslFAIL ; if ( sq1 -> roff != -1 && sq2 -> roff != -1 && sq1 -> roff != sq2 -> roff ) return eslFAIL ; if ( sq1 -> doff != -1 && sq2 -> doff != -1 && sq1 -> doff != sq2 -> doff ) return eslFAIL ; if ( sq1 -> hoff != -1 && sq2 -> hoff != -1 && sq1 -> hoff != sq2 -> hoff ) return eslFAIL ; if ( sq1 -> eoff != -1 && sq2 -> eoff != -1 && sq1 -> eoff != sq2 -> eoff ) return eslFAIL ; if ( sq1 -> nxr != sq2 -> nxr ) return eslFAIL ; for ( x = 0 ; x < sq1 -> nxr ; x ++ ) { if ( sq1 -> xr_tag [ x ] != NULL && sq2 -> xr_tag [ x ] != NULL ) { if ( strcmp ( sq1 -> xr_tag [ x ] , sq2 -> xr_tag [ x ] ) != 0 ) return eslFAIL ; } else if ( sq1 -> xr_tag [ x ] != NULL || sq2 -> xr_tag [ x ] != NULL ) return eslFAIL ; if ( sq1 -> xr [ x ] != NULL && sq2 -> xr [ x ] != NULL ) { if ( strcmp ( sq1 -> xr [ x ] , sq2 -> xr [ x ] ) != 0 ) return eslFAIL ; } else if ( sq1 -> xr [ x ] != NULL || sq2 -> xr [ x ] != NULL ) return eslFAIL ; } if ( sq1 -> abc != NULL && ( sq1 -> abc -> type != sq2 -> abc -> type ) ) return eslFAIL ; return eslOK ; }
Function:  esl_sq_Compare()
 Synopsis:  Compare two sequence objects for equality.
Function : esl_sq_Compare () Synopsis : Compare two sequence objects for equality .
/* index for optional extra residue markups */ /* Annotation comparison */ /* Sequence comparison */ /* Coordinate comparison */ /* Disk offset comparison */ /* optional extra residue markup comparison */ /* alphabet comparison */