src/hg/encode/validateFiles/validateFiles.c 1.32

1.32 2009/12/15 22:59:06 tdreszer
Exception for chrM should not be an option. If end > chromSize and chrM, then make sure start <= chromSize
Index: src/hg/encode/validateFiles/validateFiles.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/encode/validateFiles/validateFiles.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -b -B -U 4 -r1.31 -r1.32
--- src/hg/encode/validateFiles/validateFiles.c	9 Dec 2009 19:33:31 -0000	1.31
+++ src/hg/encode/validateFiles/validateFiles.c	15 Dec 2009 22:59:06 -0000	1.32
@@ -19,9 +19,8 @@
 
 int maxErrors;
 boolean colorSpace;
 boolean zeroSizeOk;
-boolean chrMSizeOk;
 boolean printOkLines;
 boolean printFailLines;
 boolean mmPerPair;
 boolean nMatch;
@@ -103,9 +102,8 @@
    {"chromInfo", OPTION_STRING},
    {"maxErrors", OPTION_INT},
    {"colorSpace", OPTION_BOOLEAN},
    {"zeroSizeOk", OPTION_BOOLEAN},
-   {"chrMSizeOk", OPTION_BOOLEAN},
    {"printOkLines", OPTION_BOOLEAN},
    {"printFailLines", OPTION_BOOLEAN},
    {"genome", OPTION_STRING},
    {"mismatches", OPTION_INT},
@@ -443,9 +441,9 @@
 boolean checkStartEnd(char *file, int line, char *row, char *start, char *end, char *chrom, unsigned chromSize, unsigned *sVal, unsigned *eVal)
 // Return TRUE if start and end are both >= 0,
 // and if zeroSizeOk then start <= end
 //        otherwise  then start < end
-// Also check end <= chromSize (as a special case, ignore chrM end if chrMSizeOk)
+// Also check end <= chromSize (special case circular chrM start <= chromSize)
 // start and end values are returned in sVal and eVal
 // Othewise print warning and return FALSE
 {
 verbose(3,"[%s %3d] inputLine=%d [%s..%s] (chrom=%s,size=%u) [%s]\n", __func__, __LINE__, line, start, end, chrom, chromSize, row);
@@ -456,9 +454,9 @@
 *sVal = s;
 *eVal = e;
 if (chromSize > 0)
     {
-    if (e > chromSize && !(chrMSizeOk && sameString(chrom, "chrM")))
+    if (e > chromSize && (differentString(chrom, "chrM") || s > chromSize)) // passes test if end < chromSize or chrM and start < chromSize
 	{
 	warn("Error [file=%s, line=%d]: end(%u) > chromSize(%s=%u) [%s]", file, line, e, chrom, chromSize, row);
 	return FALSE;
 	}
@@ -1092,9 +1090,8 @@
 if (strlen(type) == 0)
     errAbort("please specify type");
 maxErrors      = optionInt("maxErrors", MAX_ERRORS);
 zeroSizeOk     = optionExists("zeroSizeOk");
-chrMSizeOk     = optionExists("chrMSizeOk");
 printOkLines   = optionExists("printOkLines");
 printFailLines = optionExists("printFailLines");
 genome         = optionExists("genome") ? twoBitOpen(optionVal("genome",NULL)) : NULL;
 mismatches     = optionInt("mismatches",0);