314b81670d2d1446d4da81108ac0ce2a72fc569d markd Fri Jan 6 15:32:57 2017 -0800 bigTransMap hgc working diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c index ff84cef..148f10b 100644 --- src/hg/hgTracks/simpleTracks.c +++ src/hg/hgTracks/simpleTracks.c @@ -6745,85 +6745,59 @@ heightPer, tg->track, tg->mapItemName(tg, bed), s, directUrl, withHgsid, NULL); } } else errAbort("No color for track %s in rgdQtlDrawAt.", tg->track); } void rgdQtlMethods(struct track *tg) /* Fill in methods for rgdQtl track. */ { tg->drawItemAt = rgdQtlDrawAt; tg->drawName = TRUE; } -char *orgShortName(char *org) -/* Get the short name for an organism. Returns NULL if org is NULL. - * WARNING: static return */ -{ -static int maxOrgSize = 7; -static char orgNameBuf[128]; -if (org == NULL) - return NULL; -strncpy(orgNameBuf, org, sizeof(orgNameBuf)-1); -orgNameBuf[sizeof(orgNameBuf)-1] = '\0'; -char *shortOrg = firstWordInLine(orgNameBuf); -if (strlen(shortOrg) > maxOrgSize) - shortOrg[maxOrgSize] = '\0'; -return shortOrg; -} - -char *orgShortForDb(char *db) -/* look up the short organism scientific name given an organism db. - * WARNING: static return */ -{ -char *org = hScientificName(db); -char *shortOrg = orgShortName(org); -freeMem(org); -return shortOrg; -} - char *getOrganism(struct sqlConnection *conn, char *acc) /* lookup the organism for an mrna, or NULL if not found */ { // cache results, as this can be called a lot of times trying to pack tracks and test // for row overflow static struct hash *cache = NULL; if (cache == NULL) cache = hashNew(0); // N.B. NULL is a valid value in the cache struct hashEl *cacheEl = hashLookup(cache, acc); if (cacheEl == NULL) { char query[256]; sqlSafef(query, sizeof query, "select o.name from %s g,%s o where g.acc = '%s' and g.organism = o.id", gbCdnaInfoTable, organismTable, acc); char *org = sqlQuickString(conn, query); if ((org != NULL) && (org[0] == '\0')) org = NULL; cacheEl = hashAdd(cache, acc, org); } return cacheEl->val; } char *getOrganismShort(struct sqlConnection *conn, char *acc) /* lookup the organism for an mrna, or NULL if not found. This will * only return the genus, and only the first seven letters of that. * WARNING: static return */ { -return orgShortName(getOrganism(conn, acc)); +return hOrgShortName(getOrganism(conn, acc)); } char *getGeneName(struct sqlConnection *conn, char *acc) /* get geneName from refLink or NULL if not found. * WARNING: static return */ { static char nameBuf[256]; char query[256], *name = NULL; if (sqlTableExists(conn, refLinkTable)) { /* remove the version number if any */ static char accBuf[1024]; safecpy(accBuf, sizeof accBuf, acc); chopSuffix(accBuf);