deps/kb_meme/meme-5.0.1/src/momo-simple.c
/**
 * Creates a motif for a given mod using a simple frequency matrix.
 */
Creates a motif for a given mod using a simple frequency matrix.
Creates a motif for a given mod using a simple frequency matrix .
void create_simple_motif(SUMMARY_T* summary,
                         MOMO_OPTIONS_T* options,
                         MOD_INFO_T * mod_info) {
  int i;
  int j;
  const char* alph_letters = summary->alph_letters;
  MATRIX_T* freqs = NULL;
  freqs = get_count_matrix(freqs, mod_info->seq_list, NULL, options, summary);
  normalize_rows(0.0, freqs);
  MOTIF_INFO_T* motifinfo = mm_malloc(sizeof(MOTIF_INFO_T));
  motifinfo->motif = allocate_motif(mod_info->mod_name, "", summary->alph, freqs, NULL);
  motifinfo->seqs = arraylst_create();
  for (i = 0; i < arraylst_size(mod_info->seq_list); ++i) {
    SEQ_T* seqobject = options->eliminate_repeat_width ? hash_get_entry_value(arraylst_get(i, mod_info->seq_list)) : arraylst_get(i, mod_info->seq_list);
    arraylst_add(get_raw_sequence(seqobject), motifinfo->seqs);
  }
  motifinfo->fg_match = arraylst_size(mod_info->seq_list);
  arraylst_add(motifinfo, mod_info->motifinfos);
  free_matrix(freqs);
}
void create_simple_motif ( SUMMARY_T * summary , MOMO_OPTIONS_T * options , MOD_INFO_T * mod_info ) { int i ; int j ; const char * alph_letters = summary -> alph_letters ; MATRIX_T * freqs = NULL ; freqs = get_count_matrix ( freqs , mod_info -> seq_list , NULL , options , summary ) ; normalize_rows ( 0.0 , freqs ) ; MOTIF_INFO_T * motifinfo = mm_malloc ( sizeof ( MOTIF_INFO_T ) ) ; motifinfo -> motif = allocate_motif ( mod_info -> mod_name , " " , summary -> alph , freqs , NULL ) ; motifinfo -> seqs = arraylst_create ( ) ; for ( i = 0 ; i < arraylst_size ( mod_info -> seq_list ) ; ++ i ) { SEQ_T * seqobject = options -> eliminate_repeat_width ? hash_get_entry_value ( arraylst_get ( i , mod_info -> seq_list ) ) : arraylst_get ( i , mod_info -> seq_list ) ; arraylst_add ( get_raw_sequence ( seqobject ) , motifinfo -> seqs ) ; } motifinfo -> fg_match = arraylst_size ( mod_info -> seq_list ) ; arraylst_add ( motifinfo , mod_info -> motifinfos ) ; free_matrix ( freqs ) ; }
Creates a motif for a given mod using a simple frequency matrix.
Creates a motif for a given mod using a simple frequency matrix .
// Create the frequency matrix // Create the motif // clean up