src/lib/bwgCreate.c 1.16

1.16 2009/09/24 20:07:38 kent
Making wigToBigWig creation check for overlaps in sections for a better error message rather than the internal error message.
Index: src/lib/bwgCreate.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/bwgCreate.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -b -B -U 4 -r1.15 -r1.16
--- src/lib/bwgCreate.c	27 Aug 2009 03:57:12 -0000	1.15
+++ src/lib/bwgCreate.c	24 Sep 2009 20:07:38 -0000	1.16
@@ -981,8 +981,28 @@
 	parseBedGraphSection(lf, clipDontDie, chromSizeHash, lm, maxSectionSize, &sectionList);
 	}
     }
 slSort(&sectionList, bwgSectionCmp);
+
+/* Check for overlap. */
+struct bwgSection *section, *nextSection;
+for (section = sectionList; section != NULL; section = nextSection)
+    {
+    nextSection = section->next;
+    if (nextSection != NULL)
+        {
+	if (sameString(section->chrom, nextSection->chrom))
+	    {
+	    if (section->end > nextSection->start)
+	        {
+		errAbort("data format error: sections overlap %s:%d-%d and %s:%d-%d", 
+		     section->chrom, section->start+1, section->end,
+		     nextSection->chrom, nextSection->start+1, nextSection->end);
+		}
+	    }
+	}
+    }
+
 return sectionList;
 }
 
 void bigWigFileCreate(