deps/kb_meme/meme-5.0.1/src/alph-in.c
/*
 * check_alphabet_extension
 * If the alphabet is flagged as extending one of the standard alphabets then
 * confirm that it contains all the core prime symbols and their complements.
 */
check_alphabet_extension
If the alphabet is flagged as extending one of the standard alphabets then
confirm that it contains all the core prime symbols and their complements.
check_alphabet_extension If the alphabet is flagged as extending one of the standard alphabets then confirm that it contains all the core prime symbols and their complements .
static void check_alphabet_extension(ALPH_READER_T *reader) {
  char *ext_name, *req_syms, *req_comp;
  char lookup[2];
  ALPH_SYM_T *sym;
  int i;
  lookup[1] = '\0';
  req_syms = NULL;
  req_comp = NULL;
  switch (reader->flags & ALPH_FLAG_EXTENDS) {
    case ALPH_FLAG_EXTENDS_RNA:
      ext_name = "RNA";
      req_syms = "ACGU";
      break;
    case ALPH_FLAG_EXTENDS_DNA:
      ext_name = "DNA";
      req_syms = "ACGT";
      req_comp = "TGCA";
      break;
    case ALPH_FLAG_EXTENDS_PROTEIN:
      ext_name = "protein";
      req_syms = "ACDEFGHIKLMNPQRSTVWY";
      break;
  }
  if (req_syms != NULL) {
    for (i = 0; req_syms[i] != '\0'; i++) {
      lookup[0] = req_syms[i];
      sym = (ALPH_SYM_T*)rbtree_get(reader->merged, lookup);
      if (sym == NULL) {
        add_msg(reader, parmsg_create(SEVERITY_ERROR, -1, -1, -1, 
              "not like %s alphabet as %c is not defined",
              ext_name, req_syms[i]));
      } else {
        ALPH_SYM_T *comp1 = NULL, *comp2 = NULL;
        if (req_comp != NULL) {
          lookup[0] = req_comp[i];
          comp1 = (ALPH_SYM_T*)rbtree_get(reader->merged, lookup);
        }
        if (sym->complement != '\0') {
          lookup[0] = sym->complement;
          comp2 = (ALPH_SYM_T*)rbtree_get(reader->merged, lookup);
        }
        if (comp1 && (comp1 != comp2)) {
          add_msg(reader, parmsg_create(SEVERITY_ERROR, -1, -1, -1, 
                "not like %s alphabet as %c complement rules are incorrect",
                ext_name, req_syms[i]));
        }
      }
    }
  }
}
static void check_alphabet_extension ( ALPH_READER_T * reader ) { char * ext_name , * req_syms , * req_comp ; char lookup [ 2 ] ; ALPH_SYM_T * sym ; int i ; lookup [ 1 ] = ' \0 ' ; req_syms = NULL ; req_comp = NULL ; switch ( reader -> flags & ALPH_FLAG_EXTENDS ) { case ALPH_FLAG_EXTENDS_RNA : ext_name = " " ; req_syms = " " ; break ; case ALPH_FLAG_EXTENDS_DNA : ext_name = " " ; req_syms = " " ; req_comp = " " ; break ; case ALPH_FLAG_EXTENDS_PROTEIN : ext_name = " " ; req_syms = " " ; break ; } if ( req_syms != NULL ) { for ( i = 0 ; req_syms [ i ] != ' \0 ' ; i ++ ) { lookup [ 0 ] = req_syms [ i ] ; sym = ( ALPH_SYM_T * ) rbtree_get ( reader -> merged , lookup ) ; if ( sym == NULL ) { add_msg ( reader , parmsg_create ( SEVERITY_ERROR , -1 , -1 , -1 , " " , ext_name , req_syms [ i ] ) ) ; } else { ALPH_SYM_T * comp1 = NULL , * comp2 = NULL ; if ( req_comp != NULL ) { lookup [ 0 ] = req_comp [ i ] ; comp1 = ( ALPH_SYM_T * ) rbtree_get ( reader -> merged , lookup ) ; } if ( sym -> complement != ' \0 ' ) { lookup [ 0 ] = sym -> complement ; comp2 = ( ALPH_SYM_T * ) rbtree_get ( reader -> merged , lookup ) ; } if ( comp1 && ( comp1 != comp2 ) ) { add_msg ( reader , parmsg_create ( SEVERITY_ERROR , -1 , -1 , -1 , " " , ext_name , req_syms [ i ] ) ) ; } } } } }
check_alphabet_extension
 If the alphabet is flagged as extending one of the standard alphabets then
 confirm that it contains all the core prime symbols and their complements.
check_alphabet_extension If the alphabet is flagged as extending one of the standard alphabets then confirm that it contains all the core prime symbols and their complements .