51b12665a66876e1bbf7b022682a2050d4eb227d braney Fri Sep 12 13:03:18 2025 -0700 some fixes for quickLifted custom tracks diff --git src/hg/lib/quickLift.c src/hg/lib/quickLift.c index 8eb6f882c2c..42a241b0b18 100644 --- src/hg/lib/quickLift.c +++ src/hg/lib/quickLift.c @@ -192,32 +192,37 @@ if (cb == NULL) continue; int qStart = cb->qStart; int qEnd = cb->qEnd; // get the range for the links on the "other" species for(; cb; cb = cb->next) { if (cb->qStart < qStart) qStart = cb->qStart; if (cb->qEnd > qEnd) qEnd = cb->qEnd; } + // correct for strand if (chain->qStrand == '-') - qStart = chain->qSize - qStart; + { + int saveStart = qStart; + qStart = chain->qSize - qEnd; + qEnd = chain->qSize - saveStart; + } // now grab the items if (query == NULL) sr = hRangeQuery(conn, table, chain->qName, qStart, qEnd, extraWhere, &rowOffset); else sr = sqlGetResult(conn, query); while ((row = sqlNextRow(sr)) != NULL) { item = loader(row + rowOffset, numFields); slAddHead(&itemList, item); } // now squirrel the swapped chains we used to use to make the retrieved items back to us @@ -234,30 +239,34 @@ struct bed *liftedBedList = NULL; struct bed *nextBed; struct bed *bed; for(bed = bedList; bed; bed = nextBed) { // remapBlockedBed may want to add new beds after this bed if the region maps to more than one location nextBed = bed->next; bed->next = NULL; char *error; if (!blocked) { error = liftOverRemapRange(chainHash, 0.0, bed->chrom, bed->chromStart, bed->chromEnd, bed->strand[0], 0.001, &bed->chrom, (int *)&bed->chromStart, (int *)&bed->chromEnd, &bed->strand[0]); + + // probably this should keep track of cases where the input does NOT have thickStart == chromStart + bed->thickStart = bed->chromStart; + bed->thickEnd = bed->chromEnd; } else error = remapBlockedBed(chainHash, bed, 0.0, 0.1, TRUE, TRUE, NULL, NULL); if (error == NULL) { slAddHead(&liftedBedList, bed); } } return liftedBedList; } boolean quickLiftEnabled() /* Return TRUE if feature is available */ {