deps/kb_meme/meme-5.0.1/src/momo-modl.c
/**
 * Modifies list of motifs by executing the given step.
 */
Modifies list of motifs by executing the given step.
Modifies list of motifs by executing the given step .
void do_step(MODL_STEP_T* step,
             ARRAYLST_T* regexmotifs,
             MATRIX_T* bg_freqs,
             int max_motifs,
             MOMO_OPTIONS_T* options,
             SUMMARY_T* summary,
             MOD_INFO_T* mod_info) {
  if (step->op == MERGE) {
    merge_motifs(regexmotifs, bg_freqs, max_motifs, step->mtfIdx1, step->mtfIdx2,
                 options, summary, mod_info, true);
  } else if (step->op == ADD) {
    REGEX_MOTIF_T* empty_motif = init_regexmotif(options, summary);
    arraylst_add(empty_motif, regexmotifs);
    add_residue(regexmotifs, bg_freqs, max_motifs, arraylst_size(regexmotifs)-1,
                step->position, step->residue, options, summary, mod_info, true);
  } else if (step->op == APPEND) {
    REGEX_MOTIF_T* dup = duplicate_regexmotif(arraylst_get(step->mtfIdx1, regexmotifs), options, summary);
    arraylst_add(dup, regexmotifs);
    add_residue(regexmotifs, bg_freqs, max_motifs, arraylst_size(regexmotifs)-1,
                step->position, step->residue, options, summary, mod_info, true);
    if (step->mtfIdx2 < arraylst_size(regexmotifs)-1) {
      arraylst_remove(step->mtfIdx2, regexmotifs);
    }
  } else if (step->op == REPLACE) {
    REGEX_MOTIF_T* replace_motif = arraylst_remove(step->mtfIdx1, regexmotifs);
    arraylst_add(replace_motif, regexmotifs);
    add_residue(regexmotifs, bg_freqs, max_motifs, arraylst_size(regexmotifs)-1,
                step->position, step->residue, options, summary, mod_info, true);
    if (step->mtfIdx2 < arraylst_size(regexmotifs)-1) {
      arraylst_remove(step->mtfIdx2, regexmotifs);
    }
  } else if (step->op == REMOVE) {
    arraylst_remove(step->mtfIdx1, regexmotifs);
  }
}
void do_step ( MODL_STEP_T * step , ARRAYLST_T * regexmotifs , MATRIX_T * bg_freqs , int max_motifs , MOMO_OPTIONS_T * options , SUMMARY_T * summary , MOD_INFO_T * mod_info ) { if ( step -> op == MERGE ) { merge_motifs ( regexmotifs , bg_freqs , max_motifs , step -> mtfIdx1 , step -> mtfIdx2 , options , summary , mod_info , true ) ; } else if ( step -> op == ADD ) { REGEX_MOTIF_T * empty_motif = init_regexmotif ( options , summary ) ; arraylst_add ( empty_motif , regexmotifs ) ; add_residue ( regexmotifs , bg_freqs , max_motifs , arraylst_size ( regexmotifs ) - 1 , step -> position , step -> residue , options , summary , mod_info , true ) ; } else if ( step -> op == APPEND ) { REGEX_MOTIF_T * dup = duplicate_regexmotif ( arraylst_get ( step -> mtfIdx1 , regexmotifs ) , options , summary ) ; arraylst_add ( dup , regexmotifs ) ; add_residue ( regexmotifs , bg_freqs , max_motifs , arraylst_size ( regexmotifs ) - 1 , step -> position , step -> residue , options , summary , mod_info , true ) ; if ( step -> mtfIdx2 < arraylst_size ( regexmotifs ) - 1 ) { arraylst_remove ( step -> mtfIdx2 , regexmotifs ) ; } } else if ( step -> op == REPLACE ) { REGEX_MOTIF_T * replace_motif = arraylst_remove ( step -> mtfIdx1 , regexmotifs ) ; arraylst_add ( replace_motif , regexmotifs ) ; add_residue ( regexmotifs , bg_freqs , max_motifs , arraylst_size ( regexmotifs ) - 1 , step -> position , step -> residue , options , summary , mod_info , true ) ; if ( step -> mtfIdx2 < arraylst_size ( regexmotifs ) - 1 ) { arraylst_remove ( step -> mtfIdx2 , regexmotifs ) ; } } else if ( step -> op == REMOVE ) { arraylst_remove ( step -> mtfIdx1 , regexmotifs ) ; } }
Modifies list of motifs by executing the given step.
Modifies list of motifs by executing the given step .