deps/kb_meme/meme-5.0.1/src/display.c
/**********************************************************************
  print_meme_training_set_xml

  Print XML elements for the training set. See DTD embeded in
  print_meme_header_xml for description of the training set XML syntax.
**********************************************************************/
print_meme_training_set_xml
Print XML elements for the training set. See DTD embeded in
print_meme_header_xml for description of the training set XML syntax.
print_meme_training_set_xml Print XML elements for the training set . See DTD embeded in print_meme_header_xml for description of the training set XML syntax .
static void print_meme_training_set_xml(
  DATASET *dataset, 
  DATASET *neg_dataset, 
  int nmotifs,      
  FILE* outfile     
) {
  int i = 0;
  STR_T *b = str_create(10);
  fprintf(
    outfile,
    "<training_set primary_sequences=\"%s\" primary_count=\"%d\" primary_positions=\"%d\" ", 
    xmlify(dataset->datafile, b, true),
    dataset->n_samples, dataset->total_res
  );
  fprintf(
    outfile,
    "control_sequences=\"%s\" control_count=\"%d\" control_positions=\"%d\">\n",
    xmlify(dataset->negfile, b, true),
    neg_dataset ? neg_dataset->n_samples : 0,
    neg_dataset ? neg_dataset->total_res : 0
  );
  alph_print_xml(dataset->alph, "alphabet", "", "", outfile);
  if (dataset->n_samples <= dataset->brief) {
    int n_samples = (dataset->objfun==NZ) ? dataset->n_group[0] : dataset->n_samples;
    for(i = 0; i < n_samples; i++) {
      SAMPLE *s = dataset->input_order[i];
      char *name = s->sample_name;
      fprintf(
	outfile,
	"<sequence "
	"id=\"sequence_%d\" "
	"name=\"%s\" "
	"length=\"%ld\" "
	"weight=\"%f\" "
	"/>\n",
	i,
	xmlify(name, b, true),
	dataset->input_order[i]->length,
	dataset->input_order[i]->sw
      );
    }
  } 
  fprintf(outfile, "<letter_frequencies>\n");
  fprintf(outfile, "<alphabet_array>\n");
  for(i = 0; i < alph_size_core(dataset->alph); i++) {
    fprintf(
      outfile,
      "<value letter_id=\"%s\">%.3g</value>\n",
	alph_xml_id(dataset->alph, i, b),
	dataset->res_freq[i]
      );
  }
  fprintf(outfile, "</alphabet_array>\n");
  fprintf(outfile, "</letter_frequencies>\n");
  fprintf(outfile, "</training_set>\n");
  str_destroy(b, false);
}
static void print_meme_training_set_xml ( DATASET * dataset , DATASET * neg_dataset , int nmotifs , FILE * outfile ) { int i = 0 ; STR_T * b = str_create ( 10 ) ; fprintf ( outfile , " \" \" \" \" \" \" " , xmlify ( dataset -> datafile , b , true ) , dataset -> n_samples , dataset -> total_res ) ; fprintf ( outfile , " \" \" \" \" \" \" \n " , xmlify ( dataset -> negfile , b , true ) , neg_dataset ? neg_dataset -> n_samples : 0 , neg_dataset ? neg_dataset -> total_res : 0 ) ; alph_print_xml ( dataset -> alph , " " , " " , " " , outfile ) ; if ( dataset -> n_samples <= dataset -> brief ) { int n_samples = ( dataset -> objfun == NZ ) ? dataset -> n_group [ 0 ] : dataset -> n_samples ; for ( i = 0 ; i < n_samples ; i ++ ) { SAMPLE * s = dataset -> input_order [ i ] ; char * name = s -> sample_name ; fprintf ( outfile , " " " \" \" " " \" \" " " \" \" " " \" \" " " \n " , i , xmlify ( name , b , true ) , dataset -> input_order [ i ] -> length , dataset -> input_order [ i ] -> sw ) ; } } fprintf ( outfile , " \n " ) ; fprintf ( outfile , " \n " ) ; for ( i = 0 ; i < alph_size_core ( dataset -> alph ) ; i ++ ) { fprintf ( outfile , " \" \" \n " , alph_xml_id ( dataset -> alph , i , b ) , dataset -> res_freq [ i ] ) ; } fprintf ( outfile , " \n " ) ; fprintf ( outfile , " \n " ) ; fprintf ( outfile , " \n " ) ; str_destroy ( b , false ) ; }
print_meme_training_set_xml
Print XML elements for the training set.
print_meme_training_set_xml Print XML elements for the training set .
// the dataset IN  // the control dataset IN  // number of motifs IN  // file for output IN  // allocate a buffer for create ids and escaping XML // Print training set // Have to split print to keep from overwriting xmlify buffer. // Don't print sequences in -brief mode // Print sequences in training set // Handle noise samples in NZ mode. // not -brief