3446d0006f2c776afd02a36d351d79611383615e
angie
Tue Sep 25 13:26:29 2018 -0700
Chop at ':', if there is one, in {alt,fix}Locations.name when matching an alt or fix sequence name. refs #18854
diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index 48bdf30..9e260a4 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -3309,31 +3309,32 @@
errAbort("unexpected error in initSingleAltHaplotype: virtRegionList is NULL, should contain all chroms");
struct virtRegion *after = virtRegionList;
virtRegionList = NULL;
struct sqlResult *sr;
char **row;
char *table = endsWith(haplotypeId, "_fix") ? "fixLocations" : "altLocations";
if (! hTableExists(database, table))
{
warn("initSingleAltHaplotype: table '%s' not found in database %s, "
"can't find %s", table, database, haplotypeId);
return FALSE;
}
// where is the alt haplo placed?
char query[256];
-sqlSafef(query, sizeof(query), "select chrom, chromStart, chromEnd from %s where name='%s'", table, haplotypeId);
+sqlSafef(query, sizeof(query), "select chrom, chromStart, chromEnd from %s "
+ "where name rlike '^%s(:[0-9-]+?)'", table, haplotypeId);
sr = sqlGetResult(conn, query);
row = sqlNextRow(sr);
if (!row)
{
warn("no haplotype found for [%s] in %s", haplotypeId, table);
return FALSE;
}
char *haploChrom = cloneString(row[0]);
int haploStart = sqlUnsigned(row[1]);
int haploEnd = sqlUnsigned(row[2]);
sqlFreeResult(&sr);
// what is the size of the alt haplo?
int haploSize = hChromSize(database, haplotypeId); // hopefully this will work
// insert into list replacing original haploChrom record