f0add51e132dbab425e76cabc6626a31a74f47e9 kate Tue Apr 28 12:29:40 2020 -0700 Support TPM in GTEx V8 gene expression. refs #25130 diff --git src/hg/hgTracks/gtexTracks.c src/hg/hgTracks/gtexTracks.c index 6a0ac36..0162d2b 100644 --- src/hg/hgTracks/gtexTracks.c +++ src/hg/hgTracks/gtexTracks.c @@ -907,40 +907,41 @@ bottomGraphHeight = max(gtexGeneGraphHeight(tg, geneInfo, FALSE), tl.fontHeight) + gtexGeneMargin(); } height = topGraphHeight + bottomGraphHeight + gtexGeneMargin() + gtexGeneModelHeight(extras); return height; } static int gtexGeneItemHeight(struct track *tg, void *item) { int height = gtexGeneItemHeightOptionalMax(tg, item, FALSE); return height; } static char *tissueExpressionText(struct gtexTissue *tissue, double expScore, - boolean doLogTransform, char *qualifier) + boolean doLogTransform, char *qualifier, char *version) /* Construct mouseover text for tissue graph */ { static char buf[128]; -doLogTransform = FALSE; // for now, always display expression level on graph as raw RPKM -safef(buf, sizeof(buf), "%s (%.1f %s%s%sRPKM)", tissue->description, +doLogTransform = FALSE; // for now, always display expression level on graph as raw RPKM/TPM +safef(buf, sizeof(buf), "%s (%.1f %s%s%s%s)", tissue->description, doLogTransform ? log10(expScore+1.0) : expScore, qualifier != NULL ? qualifier : "", qualifier != NULL ? " " : "", - doLogTransform ? "log " : ""); + doLogTransform ? "log " : "", + sameString(version, "V8") ? "TPM" : "RPKM"); return buf; } static void getItemX(int start, int end, int *x1, int *x2) /* Return startX, endX based on item coordinates and current window */ // Residual (largely replaced by drawScaledBox -- still used by gene model bmap box { int s = max(start, winStart); int e = min(end, winEnd); double scale = scaleForWindow(insideWidth, winStart, winEnd); assert(x1); *x1 = round((double)((int)s-winStart)*scale + insideX); assert(x2); *x2 = round((double)((int)e-winStart)*scale + insideX); } @@ -1021,42 +1022,44 @@ int i = 0; double viewMax = (double)cartUsualIntClosestToHome(cart, tg->tdb, FALSE, GTEX_MAX_VIEW_LIMIT, GTEX_MAX_VIEW_LIMIT_DEFAULT); for (tissue = tissues; tissue != NULL; tissue = tissue->next, i++) { if (!filterTissue(tg, tissue->name)) continue; double expScore = (geneInfo->medians1 ? geneInfo->medians1[i] : geneBed->expScores[i]); int height = valToClippedHeight(expScore, maxMedian, viewMax, gtexMaxGraphHeight(), extras->doLogTransform); char *qualifier = NULL; if (extras->isComparison && extras->isDifference) qualifier = "F-M"; mapBoxHc(hvg, geneStart, geneEnd, x1, yZero-height, barWidth, height, tg->track, mapItemName, - tissueExpressionText(tissue, expScore, extras->doLogTransform, qualifier)); + tissueExpressionText(tissue, expScore, extras->doLogTransform, qualifier, + extras->version)); // add map box to comparison graph if (geneInfo->medians2) { double expScore = geneInfo->medians2[i]; int height = valToClippedHeight(expScore, maxMedian, viewMax, gtexMaxGraphHeight(), extras->doLogTransform); int y = yZero + gtexGeneModelHeight(extras) + gtexGeneMargin(); // y is top of bottom graph if (extras->isComparison && extras->isDifference) qualifier = "M-F"; mapBoxHc(hvg, geneStart, geneEnd, x1, y, barWidth, height, tg->track, mapItemName, - tissueExpressionText(tissue, expScore, extras->doLogTransform, qualifier)); + tissueExpressionText(tissue, expScore, extras->doLogTransform, qualifier, + extras->version)); } x1 = x1 + barWidth + padding; } // add map boxes with description to gene model if (geneInfo->geneModel && geneInfo->description) { // perhaps these are just start, end ? int itemStart = geneInfo->geneModel->txStart; int itemEnd = gtexGeneItemEnd(tg, item); int x1, x2; getItemX(itemStart, itemEnd, &x1, &x2); int w = x2-x1; int labelWidth = mgFontStringWidth(tl.font, itemName); if (x1-labelWidth <= insideX)