deps/kb_meme/meme-5.0.1/src/beadstring.c
/***********************************************************************
  Create diagrams of HMM in Postscript and PNG format using
  'dot'  and  'convert' programs.
 ***********************************************************************/
Create diagrams of HMM in Postscript and PNG format using
'dot'  and  'convert' programs.
Create diagrams of HMM in Postscript and PNG format using ' dot ' and ' convert ' programs .
static void create_hmm_diagram_files(char *mhmm_xml_path, char *mhmm_ps_path,  char *mhmm_png_path) {
  int cmd_buff_size = strlen(mhmm_ps_path) + strlen(mhmm_png_path) + 80;
  char *cmd = mm_malloc(cmd_buff_size * sizeof(char));
  int num_char_printed = snprintf(
    cmd,
    cmd_buff_size,
    "draw-mhmm -consensus %s |dot -Tps > %s",
    mhmm_xml_path,
    mhmm_ps_path
  );
  if (num_char_printed > cmd_buff_size) {
    die("Command buffer too small: %s\n", cmd);
  }
  int result = system(cmd);
  if (result < 0) {
    die("Command %s failed with status %d.\n", cmd, result);
  }
  num_char_printed = snprintf(cmd, cmd_buff_size, "convert %s %s", mhmm_ps_path, mhmm_png_path);
  if (num_char_printed > cmd_buff_size) {
    die("Command buffer too small: %s\n", cmd);
  }
  result = system(cmd);
  if (result < 0) {
    die("Command %s failed with status %d.\n", cmd, result);
  }
  myfree(cmd);
}
static void create_hmm_diagram_files ( char * mhmm_xml_path , char * mhmm_ps_path , char * mhmm_png_path ) { int cmd_buff_size = strlen ( mhmm_ps_path ) + strlen ( mhmm_png_path ) + 80 ; char * cmd = mm_malloc ( cmd_buff_size * sizeof ( char ) ) ; int num_char_printed = snprintf ( cmd , cmd_buff_size , " " , mhmm_xml_path , mhmm_ps_path ) ; if ( num_char_printed > cmd_buff_size ) { die ( " \n " , cmd ) ; } int result = system ( cmd ) ; if ( result < 0 ) { die ( " \n " , cmd , result ) ; } num_char_printed = snprintf ( cmd , cmd_buff_size , " " , mhmm_ps_path , mhmm_png_path ) ; if ( num_char_printed > cmd_buff_size ) { die ( " \n " , cmd ) ; } result = system ( cmd ) ; if ( result < 0 ) { die ( " \n " , cmd , result ) ; } myfree ( cmd ) ; }
Create diagrams of HMM in Postscript and PNG format using
'dot'  and  'convert' programs.
Create diagrams of HMM in Postscript and PNG format using ' dot ' and ' convert ' programs .
// Create diagram of HMM in Postscript format // Convert Postscript to PNG