e27451032ae1c0f6f42a560ba4c88b7ee4c4b421 kate Thu Nov 19 12:59:41 2015 -0800 Fix hgc crash when a tissue has only zero-valued expression for a gene. refs #15645 diff --git src/hg/hgc/gtexClick.c src/hg/hgc/gtexClick.c index fd7ecca..094a32f 100644 --- src/hg/hgc/gtexClick.c +++ src/hg/hgc/gtexClick.c @@ -327,31 +327,38 @@ tsv = (struct tissueSampleVals *)hel->val; maxVal = max(maxVal, sd->score); val = slDoubleNew(sd->score); slAddHead(&tsv->valList, val); } /* Fill in tissue descriptions, fill values array and calculate stats for plotting Then make a list, suitable for sorting by tissue or score NOTE: Most of this not needed for R implementation */ struct gtexTissue *tis = NULL, *tissues = gtexGetTissues(); struct tissueSampleVals *tsList = NULL; int i; if (doLogTransform) maxVal = log10(maxVal+1.0); for (tis = tissues; tis != NULL; tis = tis->next) { - tsv = hashMustFindVal(tsHash, tis->name); + tsv = hashFindVal(tsHash, tis->name); + if (tsv == NULL) + { + /* no non-zero values for this tissue/gene */ + AllocVar(tsv); + val = slDoubleNew(0.0); + slAddHead(&tsv->valList, val); + } tsv->name = tis->name; tsv->description = tis->description; tsv->color = tis->color; int count = tsv->count = slCount(tsv->valList); double *vals = AllocArray(tsv->vals, count); for (i=0; i<count; i++) { val = slPopHead(&tsv->valList); if (doLogTransform) vals[i] = log10(val->val+1.0); else vals[i] = val->val; } doubleBoxWhiskerCalc(tsv->count, tsv->vals, &tsv->min, &tsv->q1, &tsv->median, &tsv->q3, &tsv->max);