deps/kb_meme/meme-5.0.1/src/motif-in.c
/*
 * Convert the motifs to the given alphabet (or die trying).
 *
 * This cancels any previously set background option.
 */
Convert the motifs to the given alphabet (or die trying).
This cancels any previously set background option.
Convert the motifs to the given alphabet ( or die trying ) . This cancels any previously set background option .
void mread_set_conversion(
  MREAD_T *mread, 
  ALPH_T *alph, 
  const ARRAY_T *bg
) {
  if (bg != NULL) {
    if (get_array_length(bg) < alph_size_core(alph)) {
      die("Background from '%s' too short for alphabet '%s'.\n"
       "       Has %d entries but needs at least %d.", 
        (mread->other_bg_src ? mread->other_bg_src : "null"),
        alph_name(alph), get_array_length(bg), alph_size_core(alph));
    }
  }
  if (mread->other_bg != NULL) free_array(mread->other_bg);
  mread->other_bg = NULL;
  mread->other_bg_src = NULL;
  if (bg != NULL) {
    if (mread->other_bg_src != NULL) free(mread->other_bg_src);
    mread->other_bg = allocate_array(get_array_length(bg));
    copy_array(bg, mread->other_bg);
  } else {
    mread->other_bg = get_uniform_frequencies(alph, NULL);
  }
  mread->conv_alph = alph_hold(alph);
  if (mread->success) set_pseudo_bg(mread, mread->conv_alph);
}
void mread_set_conversion ( MREAD_T * mread , ALPH_T * alph , const ARRAY_T * bg ) { if ( bg != NULL ) { if ( get_array_length ( bg ) < alph_size_core ( alph ) ) { die ( " \n " " " , ( mread -> other_bg_src ? mread -> other_bg_src : " " ) , alph_name ( alph ) , get_array_length ( bg ) , alph_size_core ( alph ) ) ; } } if ( mread -> other_bg != NULL ) free_array ( mread -> other_bg ) ; mread -> other_bg = NULL ; mread -> other_bg_src = NULL ; if ( bg != NULL ) { if ( mread -> other_bg_src != NULL ) free ( mread -> other_bg_src ) ; mread -> other_bg = allocate_array ( get_array_length ( bg ) ) ; copy_array ( bg , mread -> other_bg ) ; } else { mread -> other_bg = get_uniform_frequencies ( alph , NULL ) ; } mread -> conv_alph = alph_hold ( alph ) ; if ( mread -> success ) set_pseudo_bg ( mread , mread -> conv_alph ) ; }
Convert the motifs to the given alphabet (or die trying).
Convert the motifs to the given alphabet ( or die trying ) .
// Sanity check. // clean up old bg // copy bg // no background so generate one based on the alphabet // copy alphabet // set the pseudocount background