c651c4580d382f9f6ae333c0d9f8a850b350be13
kent
  Wed Oct 27 19:03:38 2010 -0700
Adding trackDbFromOpenRa entry point.
diff --git src/hg/lib/trackDbCustom.c src/hg/lib/trackDbCustom.c
index 5f05958..2f514a1 100644
--- src/hg/lib/trackDbCustom.c
+++ src/hg/lib/trackDbCustom.c
@@ -247,34 +247,34 @@
 static char incFile[256];
 char *file;
 
 if (startsWith("include", line))
     {
     splitPath(raFile, incFile, NULL, NULL);
     nextWord(&line);
     file = nextQuotedWord(&line);
     strcat(incFile, file);
     return cloneString(incFile);
     }
 else
     return NULL;
 }
 
-struct trackDb *trackDbFromRa(char *raFile)
-/* Load track info from ra file into list. */
+struct trackDb *trackDbFromOpenRa(struct lineFile *lf)
+/* Load track info from ra file already opened as a lineFile into list. */
 {
-struct lineFile *lf = netLineFileOpen(raFile);
+char *raFile = lf->fileName;
 char *line, *word;
 struct trackDb *btList = NULL, *bt;
 boolean done = FALSE;
 char *incFile;
 
 for (;;)
     {
     /* Seek to next line that starts with 'track' */
     for (;;)
 	{
 	if (!lineFileNext(lf, &line, NULL))
 	   {
 	   done = TRUE;
 	   break;
 	   }
@@ -306,36 +306,43 @@
 	    break;
 
 	/* Skip comments. */
 	if (line[0] == '#')
 	    continue;
 
 	/* Parse out first word and decide what to do. */
 	word = nextWord(&line);
 	if (line == NULL)
 	    errAbort("No value for %s line %d of %s", word, lf->lineIx, lf->fileName);
 	line = trimSpaces(line);
 	trackDbUpdateOldTag(&word, &line);
 	trackDbAddInfo(bt, word, line, lf);
 	}
     }
-lineFileClose(&lf);
-
 slReverse(&btList);
 return btList;
 }
 
+struct trackDb *trackDbFromRa(char *raFile)
+/* Load track info from ra file into list. */
+{
+struct lineFile *lf = netLineFileOpen(raFile);
+struct trackDb *tdbList = trackDbFromOpenRa(lf);
+lineFileClose(&lf);
+return tdbList;
+}
+
 struct hash *trackDbHashSettings(struct trackDb *tdb)
 /* Force trackDb to hash up it's settings.  Usually this is just
  * done on demand. Returns settings hash. */
 {
 if (tdb->settingsHash == NULL)
     tdb->settingsHash = trackDbSettingsFromString(tdb->settings);
 return tdb->settingsHash;
 }
 
 struct hash *trackDbSettingsFromString(char *string)
 /* Return hash of key/value pairs from string.  Differs
  * from raFromString in that it passes the key/val
  * pair through the backwards compatability routines. */
 {
 char *dupe = cloneString(string);