src/hg/lib/wigAsciiToBinary.c 1.35
1.35 2010/06/05 00:47:47 kent
Making wigEncode abort on second track it sees.
Index: src/hg/lib/wigAsciiToBinary.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/wigAsciiToBinary.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -b -B -U 4 -r1.34 -r1.35
--- src/hg/lib/wigAsciiToBinary.c 25 May 2010 19:45:34 -0000 1.34
+++ src/hg/lib/wigAsciiToBinary.c 5 Jun 2010 00:47:47 -0000 1.35
@@ -319,8 +319,9 @@
boolean bedData = FALSE; /* in bed format data */
boolean variableStep = FALSE; /* in variableStep data */
boolean fixedStep = FALSE; /* in fixedStep data */
char *prevChromName = (char *)NULL; /* to watch for chrom name changes */
+int trackCount = 0; /* We abort if we see more than one track. */
if ((wigAscii == (char *)NULL) || (wigFile == (char *)NULL) ||
(wibFile == (char *)NULL))
errAbort("wigAsciiToBinary: missing data file names, ascii: %s, wig: %s, wib: %s", wigAscii, wigFile, wibFile);
@@ -382,11 +383,20 @@
continue; /* !!! go to next line of input */
wordCount = chopByWhite(line, words, ArraySize(words));
- if (sameWord("track",words[0]) || sameWord("browser",words[0]))
+ if (sameWord("track",words[0]))
{
- continue; /* ignore track,browser lines if present */
+ /* Allow (and ignore) one track line, but no more. */
+ ++trackCount;
+ if (trackCount > 1)
+ errAbort("Multiple tracks seen, second at line %d of %s, can only handle one.",
+ lf->lineIx, lf->fileName);
+ continue;
+ }
+ else if (sameWord("browser", words[0]))
+ {
+ continue; /* ignore browser lines if present */
}
else if (sameWord("variableStep",words[0]))
{
int i;