deps/kb_meme/meme-5.0.1/src/meme2images.c
/**************************************************************************
 * Generate logos for all motifs in a file
 **************************************************************************/
Generate logos for all motifs in a file
Generate logos for all motifs in a file
static void generate_file_logos(OPTIONS_T *options) {
  STR_T *path;
  MREAD_T *mread;
  MOTIF_T *motif;
  path = str_create(100);
  str_append(path, options->dir, strlen(options->dir));
  if (str_char(path, -1) != '/') str_append(path, "/", 1);
  if (create_output_directory(str_internal(path), true, false)) 
    exit(EXIT_FAILURE);
  mread = mread_create(options->motifs_file, OPEN_MFILE, true);
  while (mread_has_motif(mread)) {
    motif = mread_next_motif(mread);
    if (rbtree_size(options->ids) == 0 || rbtree_find(options->ids, get_motif_id(motif)) != NULL) {
      generate_motif_logos(options, path, motif);
    }
    destroy_motif(motif);
  }
  mread_destroy(mread);
  str_destroy(path, false);
}
static void generate_file_logos ( OPTIONS_T * options ) { STR_T * path ; MREAD_T * mread ; MOTIF_T * motif ; path = str_create ( 100 ) ; str_append ( path , options -> dir , strlen ( options -> dir ) ) ; if ( str_char ( path , -1 ) != ' ' ) str_append ( path , " " , 1 ) ; if ( create_output_directory ( str_internal ( path ) , true , false ) ) exit ( EXIT_FAILURE ) ; mread = mread_create ( options -> motifs_file , OPEN_MFILE , true ) ; while ( mread_has_motif ( mread ) ) { motif = mread_next_motif ( mread ) ; if ( rbtree_size ( options -> ids ) == 0 || rbtree_find ( options -> ids , get_motif_id ( motif ) ) != NULL ) { generate_motif_logos ( options , path , motif ) ; } destroy_motif ( motif ) ; } mread_destroy ( mread ) ; str_destroy ( path , false ) ; }
Generate logos for all motifs in a file
Generate logos for all motifs in a file
// file path buffer // create output directory // open motif file