src/hg/makeDb/hgTrackDb/hgTrackDb.c 1.54

1.54 2009/11/18 17:41:23 hiram
Add -settings option for debug scanning of trackDb settings hash variables
Index: src/hg/makeDb/hgTrackDb/hgTrackDb.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/makeDb/hgTrackDb/hgTrackDb.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -b -B -U 4 -r1.53 -r1.54
--- src/hg/makeDb/hgTrackDb/hgTrackDb.c	19 Jun 2009 23:53:39 -0000	1.53
+++ src/hg/makeDb/hgTrackDb/hgTrackDb.c	18 Nov 2009 17:41:23 -0000	1.54
@@ -39,8 +39,10 @@
   "  -strict - only include tables that exist (and complain about missing html files).\n"
   "  -raName=trackDb.ra - Specify a file name to use other than trackDb.ra\n"
   "   for the ra files.\n"
   "  -release=alpha|beta - Include trackDb entries with this release only.\n"
+  "  -settings - for trackDb scanning, output table name, type line,\n"
+  "            -  and settings hash to stderr while loading everything\n"
   );
 }
 
 static struct optionSpec optionSpecs[] = {
@@ -49,13 +51,15 @@
     {"raName", OPTION_STRING},
     {"strict", OPTION_BOOLEAN},
     {"hideFirst", OPTION_BOOLEAN},
     {"release", OPTION_STRING},
+    {"settings", OPTION_BOOLEAN},
     {NULL,      0}
 };
 
 static char *raName = "trackDb.ra";
 static char *release = "alpha";
+static bool showSettings = FALSE;
 
 static boolean hasNonAsciiChars(char *text)
 /* check if text has any non-printing or non-ascii characters */
 {
@@ -664,8 +668,20 @@
 	    {
 	    char *settings = settingsFromHash(td->settingsHash);
 	    updateBigTextField(conn, trackDbName, "tableName", td->tableName,
 	    	"settings", settings);
+	    if (showSettings)
+		{
+		verbose(1, "%s: type='%s';", td->tableName, td->type);
+		if (isNotEmpty(settings))
+		    {
+		    char *oneLine = replaceChars(settings, "\n", "; ");
+		    eraseTrailingSpaces(oneLine);
+		    verbose(1, " %s", oneLine);
+		    freeMem(oneLine);
+		    }
+		verbose(1, "\n");
+		}
 	    freeMem(settings);
 	    }
 	}
 
@@ -680,8 +696,9 @@
 optionInit(&argc, argv, optionSpecs);
 if (argc != 6)
     usage();
 raName = optionVal("raName", raName);
+showSettings = optionExists("settings");
 if (strchr(raName, '/') != NULL)
     errAbort("-raName value should be a file name without directories");
 release = optionVal("release", release);