d6709bfb566932f938be236be3a20c2c15e4c205
kate
  Tue Apr 12 18:38:51 2011 -0700
Normalize CV inconsistencies.  Remove uninformative experimental vars
diff --git src/hg/lib/cv.c src/hg/lib/cv.c
index e0273fc..41caa6e 100644
--- src/hg/lib/cv.c
+++ src/hg/lib/cv.c
@@ -33,30 +33,55 @@
 
 return sloppyTerm;
 }
 
 char *cvTermNormalized(char *sloppyTerm)
 // returns (on stack) the proper term to use when requesting a cvTerm hash
 {
 if (sameWord(sloppyTerm,CV_UGLY_TOT_CELLTYPE) || sameWord(sloppyTerm,CV_UGLY_TERM_CELL_LINE))
     return CV_TERM_CELL;
 if (sameWord(sloppyTerm,CV_UGLY_TERM_ANTIBODY))
     return CV_TERM_ANTIBODY;
 
 return sloppyTerm;
 }
 
+char *cvLabNormalize(char *sloppyTerm)
+/* CV inconsistency work-arounds.  Return lab name trimmed of parenthesized trailing 
+ * info (a few ENCODE labs have this in metaDb and/or in CV term -- 
+ * PI name embedded in parens in the CV term).  Also fixes other problems until
+ * cleaned up in CV, metaDb and user processes.  Caller must free mem. */
+{
+char *lab = sloppyTerm;
+
+if (containsStringNoCase(sloppyTerm, "Weissman"))
+    lab = "Yale-Weissman";
+
+char *ret = cloneString(lab);
+chopSuffixAt(ret, '(');
+return ret;
+}
+
+/*
+TBD
+char *cvLabDeNormalize(char *minimalTerm)
+// returns lab name with parenthesized trailing info, by lookup in cv.ra, and restores
+// other oddities caught by Normalize
+}
+*/
+
+
 // TODO: decide to make this public or hide it away inside the one function so far that uses it.
 static char *cv_file()
 // return default location of cv.ra
 {
 static char filePath[PATH_LEN];
 char *root = hCgiRoot();
 if (root == NULL || *root == 0)
     root = "/usr/local/apache/cgi-bin/"; // Make this check out sandboxes?
 //    root = "/cluster/home/tdreszer/kent/src/hg/makeDb/trackDb/cv/alpha/"; // Make this check out sandboxes?
 safef(filePath, sizeof(filePath), "%s/encode/%s", root,CV_FILE_NAME);
 if(!fileExists(filePath))
     errAbort("Error: can't locate %s; %s doesn't exist\n", CV_FILE_NAME, filePath);
 return filePath;
 }