deps/kb_meme/meme-5.0.1/src/momo-modl.c
/**
 * Returns the resulting DL if the motifs an index 'mtfIdx1' and 'mtfIdx2' were removed 
 * and the merged result of the two motifs were appended to the end of the list. Modifies 
 * the list of motifs only if update is true.
 */
Returns the resulting DL if the motifs an index 'mtfIdx1' and 'mtfIdx2' were removed
and the merged result of the two motifs were appended to the end of the list. Modifies
the list of motifs only if update is true.
Returns the resulting DL if the motifs an index ' mtfIdx1 ' and ' mtfIdx2 ' were removed and the merged result of the two motifs were appended to the end of the list . Modifies the list of motifs only if update is true .
double merge_motifs(ARRAYLST_T* regexmotifs,
                    MATRIX_T* bg_freqs,
                    int max_motifs,
                    int mtfIdx1,
                    int mtfIdx2,
                    MOMO_OPTIONS_T* options,
                    SUMMARY_T* summary,
                    MOD_INFO_T* mod_info,
                    bool update) {
  int i;
  int j;
  const char* alph_letters = summary->alph_letters;
  int width_no_center = options->width - 1;
  REGEX_MOTIF_T* regexmtf2 = arraylst_remove(mtfIdx2, regexmotifs);
  REGEX_MOTIF_T* regexmtf1 = arraylst_remove(mtfIdx1, regexmotifs);
  REGEX_MOTIF_T* mergedmotif = init_regexmotif(options, summary);
  for (i = 0; i < width_no_center; ++i) {
    mergedmotif->conserved[i] = (regexmtf1->conserved[i] || regexmtf2->conserved[i]);
    for (j = 0; j < strlen(alph_letters); ++j) {
      if (get_matrix_cell(i, j, regexmtf1->residues) == 1.0
          || get_matrix_cell(i, j, regexmtf2->residues) == 1.0) {
        set_matrix_cell(i, j, 1.0, mergedmotif->residues);
      }
    }
  }
  arraylst_add(mergedmotif, regexmotifs);
  double dl = compute_MDL(regexmotifs, bg_freqs, max_motifs, options, summary, mod_info);
  if (update) {
    cleanup_regexmotif(regexmtf1);
    cleanup_regexmotif(regexmtf2);
  } else {
    arraylst_put(mtfIdx1, regexmtf1, regexmotifs);
    arraylst_put(mtfIdx2, regexmtf2, regexmotifs);
    arraylst_remove(arraylst_size(regexmotifs)-1, regexmotifs);
    cleanup_regexmotif(mergedmotif);
  }
  return dl;
}
double merge_motifs ( ARRAYLST_T * regexmotifs , MATRIX_T * bg_freqs , int max_motifs , int mtfIdx1 , int mtfIdx2 , MOMO_OPTIONS_T * options , SUMMARY_T * summary , MOD_INFO_T * mod_info , bool update ) { int i ; int j ; const char * alph_letters = summary -> alph_letters ; int width_no_center = options -> width - 1 ; REGEX_MOTIF_T * regexmtf2 = arraylst_remove ( mtfIdx2 , regexmotifs ) ; REGEX_MOTIF_T * regexmtf1 = arraylst_remove ( mtfIdx1 , regexmotifs ) ; REGEX_MOTIF_T * mergedmotif = init_regexmotif ( options , summary ) ; for ( i = 0 ; i < width_no_center ; ++ i ) { mergedmotif -> conserved [ i ] = ( regexmtf1 -> conserved [ i ] || regexmtf2 -> conserved [ i ] ) ; for ( j = 0 ; j < strlen ( alph_letters ) ; ++ j ) { if ( get_matrix_cell ( i , j , regexmtf1 -> residues ) == 1.0 || get_matrix_cell ( i , j , regexmtf2 -> residues ) == 1.0 ) { set_matrix_cell ( i , j , 1.0 , mergedmotif -> residues ) ; } } } arraylst_add ( mergedmotif , regexmotifs ) ; double dl = compute_MDL ( regexmotifs , bg_freqs , max_motifs , options , summary , mod_info ) ; if ( update ) { cleanup_regexmotif ( regexmtf1 ) ; cleanup_regexmotif ( regexmtf2 ) ; } else { arraylst_put ( mtfIdx1 , regexmtf1 , regexmotifs ) ; arraylst_put ( mtfIdx2 , regexmtf2 , regexmotifs ) ; arraylst_remove ( arraylst_size ( regexmotifs ) - 1 , regexmotifs ) ; cleanup_regexmotif ( mergedmotif ) ; } return dl ; }
Returns the resulting DL if the motifs an index 'mtfIdx1' and 'mtfIdx2' were removed
 and the merged result of the two motifs were appended to the end of the list.
Returns the resulting DL if the motifs an index ' mtfIdx1 ' and ' mtfIdx2 ' were removed and the merged result of the two motifs were appended to the end of the list .
// generate a merged motif