bd2d35635bdfcfa6ddea367370bcab60b490291d
chmalee
  Tue Jun 2 17:27:24 2020 -0700
Make hgvsToVcf write error messages to stderr so comment lines don't mess up the VCF header

diff --git src/hg/utils/hgvsToVcf/hgvsToVcf.c src/hg/utils/hgvsToVcf/hgvsToVcf.c
index d1bbd54..707941d 100644
--- src/hg/utils/hgvsToVcf/hgvsToVcf.c
+++ src/hg/utils/hgvsToVcf/hgvsToVcf.c
@@ -52,32 +52,32 @@
 struct lineFile *lf = lineFileOpen(inFile, TRUE);
 FILE *f = mustOpen(outFile, "w");
 writeVcfHeader(f, db, inFile);
 struct vcfRow *rowList = NULL;
 struct dyString *dyError = dyStringNew(0);
 char *term = NULL;
 while (lineFileNextReal(lf, &term))
     {
     // In order to output position-sorted VCF, we need to accumulate VCF rows and sort before
     // printing.  In the meantime, print out a comment line for each HGVS term that we are
     // unable to parse/map/etc.
     dyStringClear(dyError);
     struct vcfRow *row = hgvsToVcfRow(db, term, doLeftShift, dyError);
     if (row)
         slAddHead(&rowList, row);
-    else
-        fprintf(f, "# %s\n", dyStringContents(dyError));
+    else // comments cannot come after the VCF header, so ensure errors report to stderr
+        fprintf(stderr, "# %s\n", dyStringContents(dyError));
     }
 // Reverse so that when multiple terms map to a position, they are more or less in the
 // same order that we saw in the input.
 slReverse(&rowList);
 slSort(&rowList, vcfRowCmp);
 vcfRowTabOutList(f, rowList);
 }
 
 int main(int argc, char *argv[])
 /* Process command line. */
 {
 optionInit(&argc, argv, options);
 noLeftShift = optionExists("noLeftShift");
 if (argc != 4)
     usage();