2c2dccd49a52de0e98c2d81e2f0f1b31c313b6f1
angie
  Mon Oct 14 16:14:32 2013 -0700
Added comment method to annoFormatter.
diff --git src/lib/annoFormatTab.c src/lib/annoFormatTab.c
index 70db700..7ea37cb 100644
--- src/lib/annoFormatTab.c
+++ src/lib/annoFormatTab.c
@@ -147,30 +147,39 @@
 int i;
 for (i = 0;  i < colCount;  i++)
     {
     if (!isFirst || i > 0)
 	fputc('\t', f);
     if (words != NULL)
 	fputs((words[i] ? words[i] : ""), f);
     }
 if (freeWhenDone)
     {
     freeMem(words[0]);
     freeMem(words);
     }
 }
 
+static void aftComment(struct annoFormatter *fSelf, char *content)
+/* Print out a comment line. */
+{
+if (strchr(content, '\n'))
+    errAbort("aftComment: no multi-line input");
+struct annoFormatTab *self = (struct annoFormatTab *)fSelf;
+fprintf(self->f, "# %s\n", content);
+}
+
 static void aftFormatOne(struct annoFormatter *vSelf, struct annoStreamRows *primaryData,
 			 struct annoStreamRows *gratorData, int gratorCount)
 /* Print out tab-separated columns that we have gathered in prior calls to aftCollect,
  * and start over fresh for the next line of output. */
 {
 struct annoFormatTab *self = (struct annoFormatTab *)vSelf;
 // Got one row from primary; what's the largest # of rows from any grator?
 int maxRows = 1;
 int iG;
 for (iG = 0;  iG < gratorCount;  iG++)
     {
     int gratorRowCount = slCount(gratorData[iG].rowList);
     if (gratorRowCount > maxRows)
 	maxRows = gratorRowCount;
     }
@@ -196,22 +205,23 @@
 struct annoFormatTab *self = *(struct annoFormatTab **)pVSelf;
 freeMem(self->fileName);
 carefulClose(&(self->f));
 annoFormatterFree(pVSelf);
 }
 
 struct annoFormatter *annoFormatTabNew(char *fileName)
 /* Return a formatter that will write its tab-separated output to fileName. */
 {
 struct annoFormatTab *aft;
 AllocVar(aft);
 struct annoFormatter *formatter = &(aft->formatter);
 formatter->getOptions = annoFormatterGetOptions;
 formatter->setOptions = annoFormatterSetOptions;
 formatter->initialize = aftInitialize;
+formatter->comment = aftComment;
 formatter->formatOne = aftFormatOne;
 formatter->close = aftClose;
 aft->fileName = cloneString(fileName);
 aft->f = mustOpen(fileName, "w");
 aft->needHeader = TRUE;
 return (struct annoFormatter *)aft;
 }