Index: src/hg/instinct/raToDb/raToDb.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/raToDb/raToDb.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -b -B -U 4 -r1.3 -r1.4
--- src/hg/instinct/raToDb/raToDb.c	9 Apr 2010 22:58:36 -0000	1.3
+++ src/hg/instinct/raToDb/raToDb.c	9 Apr 2010 23:56:03 -0000	1.4
@@ -51,8 +51,9 @@
 dyStringPrintf(dy, "accessTable varchar(255),\n");
 dyStringPrintf(dy, "shortLabel varchar(255),\n");
 dyStringPrintf(dy, "longLabel varchar(255),\n");
 dyStringPrintf(dy, "expCount int unsigned,\n");
+dyStringPrintf(dy, "height int unsigned,\n");
 dyStringPrintf(dy, "groupName varchar(255),\n");
 dyStringPrintf(dy, "raFile varchar(255),\n");
 dyStringPrintf(dy, "patDb varchar(255),\n");
 dyStringPrintf(dy, "sampleField varchar(255),\n");
@@ -107,8 +108,9 @@
 dyAddStringNULL(update, el->accessTable, TRUE);
 dyAddStringNULL(update, el->shortLabel, TRUE);
 dyAddStringNULL(update, el->longLabel, TRUE);
 dyStringPrintf(update, "%u,", *(el->expCount));
+dyStringPrintf(update, "%u,", *(el->height));
 dyAddStringNULL(update, el->groupName, TRUE);
 dyAddStringNULL(update, el->raFile, TRUE);
 dyAddStringNULL(update, el->patDb, TRUE);
 dyAddStringNULL(update, el->sampleField, TRUE);
@@ -253,14 +255,8 @@
 ret = sqlEscapeString(ret);
 return ret;
 }
 
-
-int checkSampleCount(struct sqlConnection *conn, struct raDb *ra)
-{
-return 1;
-}
-
 struct raDb *initRA()
 {
 struct raDb *ra = AllocA(struct raDb);
 ra->next = NULL;
@@ -268,8 +264,9 @@
 ra->name = NULL;
 ra->profile = NULL;
 ra->dataType = NULL;
 ra->expCount = AllocA(uint);
+ra->height      = AllocA(uint);
 ra->accessTable = NULL;
 ra->aliasTable  = NULL;
 ra->displayNameTable = NULL;
 ra->shortLabel  = NULL;
@@ -298,25 +295,39 @@
 
 return ra;
 }
 
+int checkSampleCount(struct sqlConnection *conn, struct raDb *ra)
+{
+char query[256];
+safef(query, sizeof(query), "select expCount from %s limit 1", ra->name);
+
+int count = sqlQuickNum(conn, query);
+
+if (count != *(ra->expCount))
+    {
+    printf("FAIL\t%s\tMicroarray groups count != count in dataset (%d != %d)\n", 
+	   ra->name, count, *(ra->expCount));
+    return 0;
+    }
+return 1;
+}
+
+
 struct raDb *validateRa(struct hash *raHash)
 {
 struct raDb *ra = initRA();
 
 ra->name = mustGetString(raHash, "name");
 ra->profile = getOptionalString(raHash, "profile", localDbProfile);
 
 struct sqlConnection *conn = hAllocConnProfile(ra->profile, genomicDb);
-
-printf("validating %s :\n", ra->name);
 if (!sqlTableExists(conn, ra->name))
     {
-    printf("\tFAIL\tTable '%s' not in hg18 (%s).\n", ra->name, ra->profile);
+    printf("FAIL\t%s\tGenomic data not in hg18 (%s).\n", ra->name, ra->profile);
     hFreeConn(&conn);  // No longer need connection
     return NULL;
     }
-
 ra->dataType = mustGetString(raHash, "dataType");
 
 *(ra->expCount) = 0;
 /* microarray specific settings*/
@@ -324,9 +335,9 @@
     {
     struct microarrayGroups *maGs = maGroupingsForRa(genomicDb, ra->name);
     if (!maGs)
 	{
-	printf("\tFAIL\tBad microarray groups for '%s'\n", ra->name);
+	printf("FAIL\t%s\tBad microarray groups\n", ra->name);
 	hFreeConn(&conn);  // No longer need connection
 	return NULL;
 	}
     struct maGrouping *allA = maGs->allArrays;
@@ -341,23 +352,23 @@
 
 ra->accessTable = getOptionalString(raHash, "accessTable", ra->name);
 if (!sqlTableExists(conn, ra->accessTable))
     {
-    printf("\tWARN\tDown-sampled table '%s' not in database.\n", ra->accessTable);
+    printf("WARN\t%s\tDown-sampled table '%s' not in database.\n", ra->name, ra->accessTable);
     ra->accessTable = cloneString(ra->name);
     }
 
 ra->aliasTable  = getOptionalString(raHash, "aliasTable", NULL);
 if (ra->aliasTable && !sqlTableExists(conn, ra->aliasTable))
     {
-    printf("\tWARN\tProbe->Gene Alias table '%s' not in database.\n", ra->aliasTable);
+    printf("WARN\t%s\tProbe->Gene Alias table '%s' not in database.\n", ra->name, ra->aliasTable);
     ra->aliasTable = NULL;
     }
 
 ra->displayNameTable = getOptionalString(raHash, "displayNameTable", NULL);
 if (ra->displayNameTable && !sqlTableExists(conn, ra->displayNameTable))
     {
-    printf("\tWARN\tDisplay Name table '%s' not in database.\n", ra->displayNameTable);
+    printf("WARN\t%s\tDisplay Name table '%s' not in database.\n", ra->name, ra->displayNameTable);
     ra->displayNameTable = NULL;
     }
 
 hFreeConn(&conn);  // No longer need connection
@@ -382,9 +391,9 @@
 
 ra->type = getOptionalString(raHash, "type", NULL);
 ra->url  = getOptionalString(raHash, "url", NULL);
 ra->visibility = getOptionalString(raHash, "visibility", "off");
-ra->security = getOptionalString(raHash, "security", "public");
+ra->security   = getOptionalString(raHash, "security", "private");
 
 ra->wrangler            = getOptionalString(raHash, "wrangler", NULL);
 ra->citation            = getOptionalString(raHash, "citation", NULL);
 ra->article_title       = getOptionalString(raHash, "article_title", NULL);
@@ -411,9 +420,14 @@
     *(ra->priority) = atof(((char *) hashFindVal(raHash, "priority")));
 else
     *(ra->priority) = 0.0;
 
-printf("\tPASS\n");
+if (hashFindVal(raHash, "height"))
+    *(ra->height) = atoi(((char *) hashFindVal(raHash, "height")));
+else
+    *(ra->height) = 0;
+			     
+printf("PASS\t%s\n", ra->name);
 return ra;
 }
 
 

