hmmer-3.3/easel/miniapps/esl-alimanip.c
/* remove_gc_markup()
 *                   
 * Given a GC tag <tag>, remove that markup from an MSA.
 * Return eslEINVAL if <tag> does not exist.
 */


Given a GC tag , remove that markup from an MSA.
Return eslEINVAL if  does not exist.
Given a GC tag remove that markup from an MSA . Return eslEINVAL if does not exist .
static int
remove_gc_markup(ESL_MSA *msa, char *errbuf, char *tag)
{
  int    does_not_exist = FALSE;
  if (strcmp(tag, "RF") == 0) { 
    if   (msa->rf == NULL) does_not_exist = TRUE;
    else { free(msa->rf); msa->rf = NULL; }
  }
  else if(strcmp(tag, "SS_cons") == 0) { 
    if   (msa->ss_cons == NULL) does_not_exist = TRUE; 
    else { free(msa->ss_cons); msa->ss_cons = NULL; }
  }
  else if (strcmp(tag, "SA_cons") == 0) { 
    if   (msa->sa_cons == NULL) does_not_exist = TRUE;
    else { free(msa->sa_cons); msa->sa_cons = NULL; }
  }
  else if (strcmp(tag, "PP_cons") == 0) { 
    if   (msa->pp_cons == NULL) does_not_exist = TRUE;
    else { free(msa->pp_cons); msa->pp_cons = NULL; }
  }
  else { 
    ESL_FAIL(eslEINVAL, errbuf, "--rm-gc <s> only works if <s> is \'RF\', \'SS_cons\', \'SA_cons\', or \'PP_cons\'");
  }
  if(does_not_exist) { 
    ESL_FAIL(eslEINVAL, errbuf, "--rm-gc %s enabled but %s GC markup exists in the MSA.", tag, tag);
  }
  return eslOK;
}
static int remove_gc_markup ( ESL_MSA * msa , char * errbuf , char * tag ) { int does_not_exist = FALSE ; if ( strcmp ( tag , " " ) == 0 ) { if ( msa -> rf == NULL ) does_not_exist = TRUE ; else { free ( msa -> rf ) ; msa -> rf = NULL ; } } else if ( strcmp ( tag , " " ) == 0 ) { if ( msa -> ss_cons == NULL ) does_not_exist = TRUE ; else { free ( msa -> ss_cons ) ; msa -> ss_cons = NULL ; } } else if ( strcmp ( tag , " " ) == 0 ) { if ( msa -> sa_cons == NULL ) does_not_exist = TRUE ; else { free ( msa -> sa_cons ) ; msa -> sa_cons = NULL ; } } else if ( strcmp ( tag , " " ) == 0 ) { if ( msa -> pp_cons == NULL ) does_not_exist = TRUE ; else { free ( msa -> pp_cons ) ; msa -> pp_cons = NULL ; } } else { ESL_FAIL ( eslEINVAL , errbuf , " \' \' \' \' \' \' \' \' " ) ; } if ( does_not_exist ) { ESL_FAIL ( eslEINVAL , errbuf , " " , tag , tag ) ; } return eslOK ; }
remove_gc_markup()
remove_gc_markup ()
/* Currently, we can only handle removal of parsed GC markup, RF, SS_cons, SA_cons, PP_cons 
   * (the main reason is b/c I didn't know how to deal with possibility of the ESL_KEYHASH in msa->gc_idx).
   */