deps/kb_meme/meme-5.0.1/src/momo-algorithm.c
/**
 * For each mod inside the mod table that passes all the
 * filters specified by the user, create a motif. This also
 * sets the number of (passing) mods/modtypes.
 */
For each mod inside the mod table that passes all the
filters specified by the user, create a motif. This also
sets the number of (passing) mods/modtypes.
For each mod inside the mod table that passes all the filters specified by the user create a motif . This also sets the number of ( passing ) mods / modtypes .
void create_motifs(MOMO_OPTIONS_T* options,
                          SUMMARY_T* summary,
                          SEQ_T** all_sequences,
                          int num_sequences) {
  ALPH_T* alph = summary->alph;
  const char* alph_letters = summary->alph_letters;
  int i;
  HASH_TABLE mod_table = summary->mod_table;
  ARRAYLST_T * mod_table_keys = summary->mod_table_keys;
  unsigned long num_mods = 0;
  unsigned long num_types = 0;
  unsigned long pass_mods = 0;
  unsigned long pass_types = 0;
  for (i = 0; i < arraylst_size(mod_table_keys); i++) {
    HASH_TABLE_ENTRY * hash_entry = arraylst_get(i, mod_table_keys);
    MOD_INFO_T * mod_entry = (MOD_INFO_T *) hash_get_entry_value(hash_entry);
    mod_entry->mod_name = hash_get_entry_key(hash_entry);
    unsigned long num_occurrences = mod_entry->mod_occurrences;
    num_mods += num_occurrences;
    num_types++;
    unsigned long num_passing = arraylst_size(mod_entry->seq_list);
    if (num_passing >= options->min_occurrences) {
      pass_mods += num_passing;
      pass_types++;
      if (options->algorithm == Simple) {
        create_simple_motif(summary, options, mod_entry);
      } else if (options->algorithm == Motifx) {
        create_motifx_motifs(summary, options, mod_entry, all_sequences, num_sequences);
      } else if (options->algorithm == Modl) {
        create_modl_motifs(summary, options, mod_entry, all_sequences, num_sequences);
      }
    }
  }
  summary->num_mod = num_mods;
  summary->num_modtype = num_types;
  summary->num_mod_passing = pass_mods;
  summary->num_modtype_passing = pass_types;
}
void create_motifs ( MOMO_OPTIONS_T * options , SUMMARY_T * summary , SEQ_T * * all_sequences , int num_sequences ) { ALPH_T * alph = summary -> alph ; const char * alph_letters = summary -> alph_letters ; int i ; HASH_TABLE mod_table = summary -> mod_table ; ARRAYLST_T * mod_table_keys = summary -> mod_table_keys ; unsigned long num_mods = 0 ; unsigned long num_types = 0 ; unsigned long pass_mods = 0 ; unsigned long pass_types = 0 ; for ( i = 0 ; i < arraylst_size ( mod_table_keys ) ; i ++ ) { HASH_TABLE_ENTRY * hash_entry = arraylst_get ( i , mod_table_keys ) ; MOD_INFO_T * mod_entry = ( MOD_INFO_T * ) hash_get_entry_value ( hash_entry ) ; mod_entry -> mod_name = hash_get_entry_key ( hash_entry ) ; unsigned long num_occurrences = mod_entry -> mod_occurrences ; num_mods += num_occurrences ; num_types ++ ; unsigned long num_passing = arraylst_size ( mod_entry -> seq_list ) ; if ( num_passing >= options -> min_occurrences ) { pass_mods += num_passing ; pass_types ++ ; if ( options -> algorithm == Simple ) { create_simple_motif ( summary , options , mod_entry ) ; } else if ( options -> algorithm == Motifx ) { create_motifx_motifs ( summary , options , mod_entry , all_sequences , num_sequences ) ; } else if ( options -> algorithm == Modl ) { create_modl_motifs ( summary , options , mod_entry , all_sequences , num_sequences ) ; } } } summary -> num_mod = num_mods ; summary -> num_modtype = num_types ; summary -> num_mod_passing = pass_mods ; summary -> num_modtype_passing = pass_types ; }
For each mod inside the mod table that passes all the
 filters specified by the user, create a motif.
For each mod inside the mod table that passes all the filters specified by the user create a motif .
// Get the mod table // Initialize statistic counters. // For each mod inside the mod table // Get the mod entry // Count the number of mods and mod types and add to overall counter // For each passing mod, we will add to passing mod and mod type counter and create a motif // Increment counters // Create motif