fc34db6836023ebaf94394bd9b21a5c26884f319
braney
  Fri Jun 13 10:23:41 2014 -0700
strip out parens and carriage returns from trackHub decriptionUrl's. Addroutine to get blat parameters

diff --git src/hg/lib/trackHub.c src/hg/lib/trackHub.c
index 9b99cee..0930429 100644
--- src/hg/lib/trackHub.c
+++ src/hg/lib/trackHub.c
@@ -62,31 +62,31 @@
 if (hasProtocol(path))
     return cloneString(path);
 
 /* If it's a remote hub, let html path expander handle it. */
 if (hasProtocol(hubUrl))
     return expandUrlOnBase(hubUrl, path);
 
 /* If we got to here hub is local, and so is path.  Do standard
  * path parsing. */
 return pathRelativeToFile(hubUrl, path);
 }
 
 static void badGenomeStanza(struct lineFile *lf)
 /* Put up semi-informative error message about a genome stanza being bad. */
 {
-errAbort("Genome stanza should have exactly two lines, one with 'genome' and one with 'trackDb'\n"
+errAbort("Genome stanza should have at least two lines, one with 'genome' and one with 'trackDb'\n"
          "Bad stanza format ending line %d of %s", lf->lineIx, lf->fileName);
 }
 
 char *trackHubCladeToGenome(char *clade) 
 /* Given a track hub clade(hub name) return the default genome. */
 {
 if (hubCladeHash == NULL)
     return FALSE;
 struct hashEl *hel = hashLookup(hubCladeHash, clade);
 if (hel == NULL)
     return FALSE;
 struct trackHub *trackHub = hel->val;
 struct trackHubGenome *hubGenome = trackHub->genomeList;
 for(; hubGenome; hubGenome=hubGenome->next)
     if (hubGenome->twoBitPath != NULL)
@@ -913,30 +913,35 @@
 /* Make sure that track is ok. */
 {
 int retVal = 0;
 struct errCatch *errCatch = errCatchNew();
 
 if (errCatchStart(errCatch))
     {
     if (searchFp != NULL)
 	{
 	addOneDescription(genome->trackDbFile, tdb);
 	if (tdb->html != NULL)
 	    {
 	    char *stripHtml =htmlTextStripTags(tdb->html);
 	    strSwapChar(stripHtml, '\n', ' ');
 	    strSwapChar(stripHtml, '\t', ' ');
+	    strSwapChar(stripHtml, '\r', ' ');
+	    strSwapChar(stripHtml, ')', ' ');
+	    strSwapChar(stripHtml, '(', ' ');
+	    strSwapChar(stripHtml, '[', ' ');
+	    strSwapChar(stripHtml, ']', ' ');
 	    fprintf(searchFp, "%s.%s\t%s\t%s\t%s\n",hub->url, tdb->track, 
 		tdb->shortLabel, tdb->longLabel, stripHtml);
 	    }
 	else
 	    fprintf(searchFp, "%s.%s\t%s\t%s\n",hub->url, tdb->track, 
 		tdb->shortLabel, tdb->longLabel);
 	}
     else 
 	{
 	char *relativeUrl = trackDbSetting(tdb, "bigDataUrl");
 	char *type = trackDbRequiredSetting(tdb, "type");
 
 	if (relativeUrl != NULL)
 	    {
 	    char *bigDataUrl = trackHubRelativeUrl(genome->trackDbFile, relativeUrl);
@@ -1107,30 +1112,35 @@
 
 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', ' ');
+	strSwapChar(stripHtml, '\015', ' ');
+	strSwapChar(stripHtml, ')', ' ');
+	strSwapChar(stripHtml, '(', ' ');
+	strSwapChar(stripHtml, '[', ' ');
+	strSwapChar(stripHtml, ']', ' ');
 	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, NULL);
     }
 trackHubClose(&hub);
 
 return retVal;
 }
@@ -1263,15 +1273,40 @@
 void trackHubFindPos(char *db, char *term, struct hgPositions *hgp)
 /* Look for term in track hubs.  Update hgp if found */
 {
 struct trackDb *tdbList = NULL;
 if (trackHubDatabase(db))
     {
     struct trackHubGenome *genome = trackHubGetGenome(db);
     tdbList = trackHubTracksForGenome(genome->trackHub, genome);
     }
 else
     tdbList = hubCollectTracks(db, NULL);
 
 findPosInTdbList(tdbList, term, hgp);
 }
 
+boolean trackHubGetBlatParams(char *database, boolean isTrans, char **pHost, char **pPort)
+{
+char *hostPort;
+
+if (isTrans)
+    {
+    hostPort = trackHubAssemblyField(database, "transBlat");
+    }
+else
+    {
+    hostPort = trackHubAssemblyField(database, "blat");
+    }
+
+if (hostPort == NULL)
+    return FALSE;
+   
+hostPort = cloneString(hostPort);
+
+*pHost = nextWord(&hostPort);
+if (hostPort == NULL)
+    return FALSE;
+*pPort = hostPort;
+
+return TRUE;
+}