c4ebea6f863d96a9e9dbfe40ac67193ece91b346
braney
  Tue May 13 17:26:39 2014 -0700
adding the ability to search hubs for content.
diff --git src/hg/lib/trackHub.c src/hg/lib/trackHub.c
index 05d16cd..cca97f9 100644
--- src/hg/lib/trackHub.c
+++ src/hg/lib/trackHub.c
@@ -512,30 +512,33 @@
     errAbort("multiple records in %s", url);
 
 /* Allocate hub and fill in settings field and url. */
 struct trackHub *hub;
 AllocVar(hub);
 hub->url = cloneString(url);
 hub->name = cloneString(hubName);
 hub->settings = hubRa;
 
 /* Fill in required fields from settings. */
 trackHubRequiredSetting(hub, "hub");
 trackHubRequiredSetting(hub, "email");
 hub->shortLabel = trackHubRequiredSetting(hub, "shortLabel");
 hub->longLabel = trackHubRequiredSetting(hub, "longLabel");
 hub->genomesFile = trackHubRequiredSetting(hub, "genomesFile");
+char *descriptionUrl = trackHubSetting(hub, "descriptionUrl");
+if (descriptionUrl != NULL)
+    hub->descriptionUrl = trackHubRelativeUrl(hub->url, descriptionUrl);
 
 lineFileClose(&lf);
 char *genomesUrl = trackHubRelativeUrl(hub->url, hub->genomesFile);
 
 hub->genomeHash = hashNew(8);
 hub->genomeList = trackHubGenomeReadRa(genomesUrl, hub);
 freez(&genomesUrl);
 
 return hub;
 }
 
 void trackHubClose(struct trackHub **pHub)
 /* Close up and free resources from hub. */
 {
 struct trackHub *hub = *pHub;
@@ -1032,34 +1035,49 @@
     hub = trackHubOpen(hubUrl, "");
 errCatchEnd(errCatch);
 
 if (errCatch->gotError)
     {
     retVal = 1;
     dyStringPrintf(errors, "%s", errCatch->message->string);
     }
 errCatchFree(&errCatch);
 
 if (hub == NULL)
     return 1;
 
 verbose(2, "hub %s\nshortLabel %s\nlongLabel %s\n", hubUrl, hub->shortLabel, hub->longLabel);
 verbose(2, "%s has %d elements\n", hub->genomesFile, slCount(hub->genomeList));
+
+if (searchFp != NULL)
+    {
+    if (hub->descriptionUrl != NULL)
+	{
+	char *html = netReadTextFileIfExists(hub->descriptionUrl);
+	char *stripHtml =htmlTextStripTags(html);
+	strSwapChar(stripHtml, '\n', ' ');
+	strSwapChar(stripHtml, '\t', ' ');
+	fprintf(searchFp, "%s\t%s\t%s\t%s\n",hub->url, hub->shortLabel, hub->longLabel, stripHtml);
+	}
+
+    return 0;
+    }
+
 struct trackHubGenome *genome;
 for (genome = hub->genomeList; genome != NULL; genome = genome->next)
     {
-    retVal |= hubCheckGenome(hub, genome, errors, checkTracks, searchFp);
+    retVal |= hubCheckGenome(hub, genome, errors, checkTracks, NULL);
     }
 trackHubClose(&hub);
 
 return retVal;
 }
 
 
 static struct hgPos *bigBedIntervalListToHgPositions(struct bbiFile *bbi, char *term, struct bigBedInterval *intervalList, char *description)
 /* Given an open bigBed file, and an interval list, return a pointer to a list of hgPos structures. */
 {
 struct hgPos *posList = NULL;
 char chromName[bbi->chromBpt->keySize+1];
 int lastChromId = -1;
 struct bigBedInterval *interval;