mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-07 23:58:11 +08:00
correctly handle categoricals that are not strings (#1346)
This commit is contained in:
@@ -101,7 +101,7 @@ class Occupancy extends React.PureComponent {
|
|||||||
const groupBy = world.obsAnnotations.col(metadataField);
|
const groupBy = world.obsAnnotations.col(metadataField);
|
||||||
const occupancyMap = world.obsAnnotations
|
const occupancyMap = world.obsAnnotations
|
||||||
.col(colorAccessor)
|
.col(colorAccessor)
|
||||||
.histogram(groupBy);
|
.histogramCategorical(groupBy);
|
||||||
|
|
||||||
const occupancy = occupancyMap.get(category.categoryValues[categoryIndex]);
|
const occupancy = occupancyMap.get(category.categoryValues[categoryIndex]);
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ class Occupancy extends React.PureComponent {
|
|||||||
|
|
||||||
let currentOffset = 0;
|
let currentOffset = 0;
|
||||||
const dfColumn = world.obsAnnotations.col(colorAccessor);
|
const dfColumn = world.obsAnnotations.col(colorAccessor);
|
||||||
const categoryValues = dfColumn.summarize().categories;
|
const categoryValues = dfColumn.summarizeCategorical().categories;
|
||||||
|
|
||||||
let o;
|
let o;
|
||||||
let scaledValue;
|
let scaledValue;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
summarizeCategorical as _summarizeCategorical
|
summarizeCategorical as _summarizeCategorical
|
||||||
} from "./summarize";
|
} from "./summarize";
|
||||||
import {
|
import {
|
||||||
histogramCategorical,
|
histogramCategorical as _histogramCategorical,
|
||||||
hashCategorical,
|
hashCategorical,
|
||||||
histogramContinuous,
|
histogramContinuous,
|
||||||
hashContinuous
|
hashContinuous
|
||||||
@@ -260,16 +260,20 @@ class Dataframe {
|
|||||||
/*
|
/*
|
||||||
Create histogram bins for this column. Memoized.
|
Create histogram bins for this column. Memoized.
|
||||||
*/
|
*/
|
||||||
|
const _memoHistoCat = memoize(_histogramCategorical, hashCategorical);
|
||||||
|
const histogramCategorical = by => _memoHistoCat(get, by);
|
||||||
|
let histogram = null;
|
||||||
if (isTypedArray(column)) {
|
if (isTypedArray(column)) {
|
||||||
const mFn = memoize(histogramContinuous, hashContinuous);
|
const mFn = memoize(histogramContinuous, hashContinuous);
|
||||||
get.histogram = (bins, domain, by) => mFn(get, bins, domain, by);
|
histogram = (bins, domain, by) => mFn(get, bins, domain, by);
|
||||||
} else {
|
} else {
|
||||||
const mFn = memoize(histogramCategorical, hashCategorical);
|
histogram = histogramCategorical;
|
||||||
get.histogram = by => mFn(get, by);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get.summarize = summarize;
|
get.summarize = summarize;
|
||||||
get.summarizeCategorical = summarizeCategorical;
|
get.summarizeCategorical = summarizeCategorical;
|
||||||
|
get.histogram = histogram;
|
||||||
|
get.histogramCategorical = histogramCategorical;
|
||||||
get.asArray = asArray;
|
get.asArray = asArray;
|
||||||
get.has = has;
|
get.has = has;
|
||||||
get.ihas = ihas;
|
get.ihas = ihas;
|
||||||
|
|||||||
Reference in New Issue
Block a user