797801aaef4865bebc8a7c79dfb3d642f34d229d hiram Thu Sep 15 18:09:41 2016 -0700 better to call chromXref as chromAlias and now is a three column table with primary key refs #18027 diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index f7c7c52..70c095b 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -186,42 +186,41 @@ } char *hgOfficialChromName(char *db, char *name) /* Returns "canonical" name of chromosome or NULL * if not a chromosome. (Case-insensitive search w/sameWord()) */ { struct chromInfo *ci = NULL; char buf[HDB_MAX_CHROM_STRING]; strncpy(buf, name, HDB_MAX_CHROM_STRING); buf[HDB_MAX_CHROM_STRING-1] = 0; ci = hGetChromInfo(db, buf); if (ci != NULL) return cloneString(ci->chrom); else { - if (hTableExists(db, "chromXref")) + if (hTableExists(db, "chromAlias")) { struct sqlConnection *conn = hAllocConn(db); char query[512]; - char *chrName; + char *chrom; sqlSafef(query, sizeof(query), - "select ucsc from chromXref where refseq='%s' or genbank='%s' or ensembl='%s' limit 1", - name, name, name); - chrName = sqlQuickString(conn, query); + "select chrom from chromAlias where alias='%s'", name); + chrom = sqlQuickString(conn, query); hFreeConn(&conn); - if (isNotEmpty(chrName)) // chrName is already a cloneString result - return chrName; + if (isNotEmpty(chrom)) // chrom is already a cloneString result + return chrom; } return NULL; } } boolean hgIsOfficialChromName(char *db, char *name) /* Determine if name is exact (case-sensitive) match with * a chromosome in the given assembly */ { char *chrom; return ((chrom = hgOfficialChromName(db, name)) != NULL && sameString(name, chrom)); }