f90ad219df60f60f805f555eee38239aa2aa3d1a braney Sat May 6 06:37:31 2017 -0700 make density graphs use exons instead of the length of the whole feature #19300 diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c index 73f8f8e..d73b2ae 100644 --- src/hg/hgTracks/simpleTracks.c +++ src/hg/hgTracks/simpleTracks.c @@ -4376,44 +4376,68 @@ el->min = minVal; el->max = maxVal; el->sumData = sumData * normFactor; el->sumSquares = sumSquares * normFactor; return validCount; } static unsigned *countOverlaps(struct track *track) /* Count up overlap of linked features. */ { struct slList *items = track->items; struct slList *item; unsigned size = winEnd - winStart; unsigned *counts = needHugeZeroedMem(size * sizeof(unsigned)); +extern int linkedFeaturesItemStart(struct track *tg, void *item); +boolean isLinkedFeature = ( track->itemStart == linkedFeaturesItemStart); for (item = items; item; item = item->next) { + if (isLinkedFeature) + { + struct linkedFeatures *lf = (struct linkedFeatures *)item; + struct simpleFeature *sf; + + for (sf = lf->components; sf != NULL; sf = sf->next) + { + unsigned start = sf->start; + unsigned end = sf->end; + if (positiveRangeIntersection(start, end, winStart, winEnd) <= 0) + continue; + + int x1 = max((int)start - (int)winStart, 0); + int x2 = min((int)end - (int)winStart, size); + + for(; x1 < x2; x1++) + counts[x1]++; + } + } + else + { unsigned start = track->itemStart(track, item); unsigned end = track->itemEnd(track, item); if (positiveRangeIntersection(start, end, winStart, winEnd) <= 0) continue; int x1 = max((int)start - (int)winStart, 0); int x2 = min((int)end - (int)winStart, size); for(; x1 < x2; x1++) counts[x1]++; } + } return counts; } static void countsToPixelsUp(unsigned *counts, struct preDrawContainer *pre) /* Up sample counts into pixels. */ { int preDrawZero = pre->preDrawZero; unsigned size = winEnd - winStart; double countsPerPixel = size / (double) insideWidth; int pixel; for (pixel=0; pixelpreDraw[pixel + preDrawZero];