mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-02 02:58:12 +08:00
categorical type handling fix (#1342)
* fix numeric category conversion bug * correctly compute categorical summaries * lint * remove debugging print
This commit is contained in:
@@ -7,7 +7,10 @@ import {
|
||||
callOnceLazy,
|
||||
memoize
|
||||
} from "./util";
|
||||
import { summarizeContinuous, summarizeCategorical } from "./summarize";
|
||||
import {
|
||||
summarizeContinuous,
|
||||
summarizeCategorical as _summarizeCategorical
|
||||
} from "./summarize";
|
||||
import {
|
||||
histogramCategorical,
|
||||
hashCategorical,
|
||||
@@ -243,8 +246,11 @@ class Dataframe {
|
||||
};
|
||||
|
||||
/*
|
||||
Summarize the column data. Lazy eval;
|
||||
Summarize the column data. Lazy eval, memoized
|
||||
*/
|
||||
const summarizeCategorical = callOnceLazy(() =>
|
||||
_summarizeCategorical(column)
|
||||
);
|
||||
const summarize = callOnceLazy(() =>
|
||||
isTypedArray(column)
|
||||
? summarizeContinuous(column)
|
||||
@@ -263,6 +269,7 @@ class Dataframe {
|
||||
}
|
||||
|
||||
get.summarize = summarize;
|
||||
get.summarizeCategorical = summarizeCategorical;
|
||||
get.asArray = asArray;
|
||||
get.has = has;
|
||||
get.ihas = ihas;
|
||||
|
||||
@@ -103,7 +103,7 @@ export function createCategoricalSelection(world, names) {
|
||||
in sorted order, and must include all category values even if they are not
|
||||
actively used in the current world.
|
||||
*/
|
||||
const summary = obsAnnotations.col(name).summarize();
|
||||
const summary = obsAnnotations.col(name).summarizeCategorical();
|
||||
const [categoryValues, categoryValueCounts] = topNCategories(
|
||||
colSchema,
|
||||
summary,
|
||||
@@ -203,7 +203,9 @@ export function pruneVarDataCache(varData, needed) {
|
||||
|
||||
export function subsetAndResetGeneLists(state) {
|
||||
const { userDefinedGenes, diffexpGenes } = state;
|
||||
const newUserDefinedGenes = [].concat(userDefinedGenes, diffexpGenes).slice(0, globals.maxGenes);
|
||||
const newUserDefinedGenes = []
|
||||
.concat(userDefinedGenes, diffexpGenes)
|
||||
.slice(0, globals.maxGenes);
|
||||
const newDiffExpGenes = [];
|
||||
return [newUserDefinedGenes, newDiffExpGenes];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user