deps/kb_meme/meme-5.0.1/src/tomtom.c
/*****************************************************************************
 * outputs the model section of the xml results
 *
 * the buffer must be expandable using realloc and the buffer_len must be set
 * to reflect the currently allocated size or zero if the buffer is unallocated
 * and set to null.
 *****************************************************************************/
outputs the model section of the xml results
the buffer must be expandable using realloc and the buffer_len must be set
to reflect the currently allocated size or zero if the buffer is unallocated
and set to null.
outputs the model section of the xml results the buffer must be expandable using realloc and the buffer_len must be set to reflect the currently allocated size or zero if the buffer is unallocated and set to null .
static void print_xml_model(FILE *xml_output,
    int argc, char**argv, 
    ALPH_T *alph, bool rc,
    char *distance_measure, 
    bool sig_type_q, double sig_thresh, 
    char *bg_file, ARRAY_T *bg_freqs_target,
    time_t now) {
  int i;
  bool bg_from_file;
  STR_T *b;
  b = str_create(10);
  fprintf(xml_output, "  <model>\n");
  fprintf(xml_output, "    <command_line>tomtom");
  for (i = 1; i < argc; ++i) {
    char *arg;
    arg = xmlify(argv[i], b,  true);
    if (strchr(argv[i], ' ')) {
      fprintf(xml_output, " &quot;%s&quot;", arg);
    } else {
      fprintf(xml_output, " %s", arg);
    }
  }
  fprintf(xml_output, "</command_line>\n");
  fprintf(xml_output, "    <distance_measure value=\"%s\"/>\n", distance_measure);
  fprintf(xml_output, "    <threshold type=\"%s\">%g</threshold>\n", (sig_type_q ? "qvalue" : "evalue"), sig_thresh);
  alph_print_xml(alph, "alphabet", "    ", "  ", xml_output);
  fprintf(xml_output, "    <strands>%s</strands>\n",  
      (alph_has_complement(alph) ? (rc ? "both" : "forward") : "none"));
  fprintf(xml_output, "    <background from=\"%s\"", xmlify(bg_file, b, true));
  for (i = 0; i < alph_size_core(alph); i++) {
    fprintf(xml_output, " %s=\"%g\"", alph_xml_id(alph, i, b),
        get_array_item(i, bg_freqs_target));
  }
  fprintf(xml_output, "/>\n");
  fprintf(xml_output, "    <host>%s</host>\n", hostname());
  fprintf(xml_output, "    <when>%s</when>\n", strtok(ctime(&now),"\n"));
  fprintf(xml_output, "  </model>\n");
  str_destroy(b, false);
}
static void print_xml_model ( FILE * xml_output , int argc , char * * argv , ALPH_T * alph , bool rc , char * distance_measure , bool sig_type_q , double sig_thresh , char * bg_file , ARRAY_T * bg_freqs_target , time_t now ) { int i ; bool bg_from_file ; STR_T * b ; b = str_create ( 10 ) ; fprintf ( xml_output , " \n " ) ; fprintf ( xml_output , " " ) ; for ( i = 1 ; i < argc ; ++ i ) { char * arg ; arg = xmlify ( argv [ i ] , b , true ) ; if ( strchr ( argv [ i ] , ' ' ) ) { fprintf ( xml_output , " " , arg ) ; } else { fprintf ( xml_output , " " , arg ) ; } } fprintf ( xml_output , " \n " ) ; fprintf ( xml_output , " \" \" \n " , distance_measure ) ; fprintf ( xml_output , " \" \" \n " , ( sig_type_q ? " " : " " ) , sig_thresh ) ; alph_print_xml ( alph , " " , " " , " " , xml_output ) ; fprintf ( xml_output , " \n " , ( alph_has_complement ( alph ) ? ( rc ? " " : " " ) : " " ) ) ; fprintf ( xml_output , " \" \" " , xmlify ( bg_file , b , true ) ) ; for ( i = 0 ; i < alph_size_core ( alph ) ; i ++ ) { fprintf ( xml_output , " \" \" " , alph_xml_id ( alph , i , b ) , get_array_item ( i , bg_freqs_target ) ) ; } fprintf ( xml_output , " \n " ) ; fprintf ( xml_output , " \n " , hostname ( ) ) ; fprintf ( xml_output , " \n " , strtok ( ctime ( & now ) , " \n " ) ) ; fprintf ( xml_output , " \n " ) ; str_destroy ( b , false ) ; }
outputs the model section of the xml results
 the buffer must be expandable using realloc and the buffer_len must be set
 to reflect the currently allocated size or zero if the buffer is unallocated
 and set to null.
outputs the model section of the xml results the buffer must be expandable using realloc and the buffer_len must be set to reflect the currently allocated size or zero if the buffer is unallocated and set to null .
//note that this doesn't correctly handle the case of a " character in a filename //in which case the correct output would be an escaped quote or \" //but I don't think that really matters since you could guess the original command