hmmer-3.3/easel/esl_sq.c
/* Function:  esl_sq_Reuse()
 * Synopsis:  Reinitialize an <ESL_SQ> for re-use.
 * Incept:    SRE, Thu Dec 23 12:23:51 2004 [Zaragoza]
 *
 * Purpose:   Given a sequence object <sq> already in use;
 *            reinitialize all its data, so a new seq
 *            may be read into it. This allows sequential sequence
 *            input without a lot of wasted allocation/free cycling.
 *
 * Returns:   <eslOK> on success.
 */
esl_sq_Reuse()
Synopsis:  Reinitialize an  for re-use.

Given a sequence object  already in use;
reinitialize all its data, so a new seq
may be read into it. This allows sequential sequence
input without a lot of wasted allocation/free cycling.

 on success.
esl_sq_Reuse () Synopsis : Reinitialize an for re - use . Given a sequence object already in use ; reinitialize all its data so a new seq may be read into it . This allows sequential sequence input without a lot of wasted allocation / free cycling . on success .
int
esl_sq_Reuse(ESL_SQ *sq)
{
  int   x;        
  sq->name[0]   = '\0';
  sq->acc[0]    = '\0';
  sq->desc[0]   = '\0';
  sq->tax_id    = -1;
  sq->source[0] = '\0';
  if (sq->seq != NULL) sq->seq[0] = '\0';
  if (sq->dsq != NULL) sq->dsq[0] = sq->dsq[1] = eslDSQ_SENTINEL;
  if (sq->ss  != NULL) {
    if (sq->seq != NULL) sq->ss[0] = '\0';
    else                 sq->ss[0] = sq->ss[1] = '\0'; 
  }
  if (sq->nxr > 0) {
    for (x = 0; x < sq->nxr; x++) {
      if (sq->xr[x]     != NULL) { free(sq->xr[x]);     sq->xr[x]     = NULL; }
      if (sq->xr_tag[x] != NULL) { free(sq->xr_tag[x]); sq->xr_tag[x] = NULL; }
    }     
    if (sq->xr     != NULL) { free(sq->xr);     sq->xr     = NULL; }
    if (sq->xr_tag != NULL) { free(sq->xr_tag); sq->xr_tag = NULL; }
    sq->nxr = 0;
  }
  sq->n     = 0;
  sq->start = 0;
  sq->end   = 0;
  sq->C     = 0;
  sq->W     = 0;
  sq->L     = -1;
  sq->idx   = -1;
  sq->doff  = -1;
  sq->hoff  = -1;
  sq->roff  = -1;
  sq->eoff  = -1;
  return eslOK;
}
int esl_sq_Reuse ( ESL_SQ * sq ) { int x ; sq -> name [ 0 ] = ' \0 ' ; sq -> acc [ 0 ] = ' \0 ' ; sq -> desc [ 0 ] = ' \0 ' ; sq -> tax_id = -1 ; sq -> source [ 0 ] = ' \0 ' ; if ( sq -> seq != NULL ) sq -> seq [ 0 ] = ' \0 ' ; if ( sq -> dsq != NULL ) sq -> dsq [ 0 ] = sq -> dsq [ 1 ] = eslDSQ_SENTINEL ; if ( sq -> ss != NULL ) { if ( sq -> seq != NULL ) sq -> ss [ 0 ] = ' \0 ' ; else sq -> ss [ 0 ] = sq -> ss [ 1 ] = ' \0 ' ; } if ( sq -> nxr > 0 ) { for ( x = 0 ; x < sq -> nxr ; x ++ ) { if ( sq -> xr [ x ] != NULL ) { free ( sq -> xr [ x ] ) ; sq -> xr [ x ] = NULL ; } if ( sq -> xr_tag [ x ] != NULL ) { free ( sq -> xr_tag [ x ] ) ; sq -> xr_tag [ x ] = NULL ; } } if ( sq -> xr != NULL ) { free ( sq -> xr ) ; sq -> xr = NULL ; } if ( sq -> xr_tag != NULL ) { free ( sq -> xr_tag ) ; sq -> xr_tag = NULL ; } sq -> nxr = 0 ; } sq -> n = 0 ; sq -> start = 0 ; sq -> end = 0 ; sq -> C = 0 ; sq -> W = 0 ; sq -> L = -1 ; sq -> idx = -1 ; sq -> doff = -1 ; sq -> hoff = -1 ; sq -> roff = -1 ; sq -> eoff = -1 ; return eslOK ; }
Function:  esl_sq_Reuse()
 Synopsis:  Reinitialize an <ESL_SQ> for re-use.
Function : esl_sq_Reuse () Synopsis : Reinitialize an <ESL_SQ > for re - use .
/* index for optional extra residue markups */ /* in digital mode, ss string is 1..n; 0 is a dummy \0 byte*/ /* optional extra residue markup */