mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-08 05:48:11 +08:00
TS typing for Dataframe (#2382)
* initial TS typing * first cut at Dataframe TS typing * more Dataframe typing * comments * more Dataframe cleanup * PR review fixes and improvements
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import cloneDeep from "lodash.clonedeep";
|
||||
|
||||
import { NumberArray } from "../../src/common/types/arraytypes";
|
||||
import calcCentroid from "../../src/util/centroid";
|
||||
import quantile from "../../src/util/quantile";
|
||||
import { matrixFBSToDataframe } from "../../src/util/stateManager/matrix";
|
||||
import * as REST from "./stateManager/sampleResponses";
|
||||
import { indexEntireSchema } from "../../src/util/stateManager/schemaHelpers";
|
||||
import { normalizeWritableCategoricalSchema } from "../../src/annoMatrix/normalize";
|
||||
import { Dataframe } from "../../src/util/dataframe";
|
||||
|
||||
describe("centroid", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let schema: any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let obsAnnotations: any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
let obsLayout: any;
|
||||
let obsAnnotations: Dataframe;
|
||||
let obsLayout: Dataframe;
|
||||
|
||||
beforeAll(() => {
|
||||
schema = indexEntireSchema(cloneDeep(REST.schema.schema));
|
||||
@@ -43,8 +43,8 @@ describe("centroid", () => {
|
||||
|
||||
// This expected result assumes that all cells belong in all categorical values inside of sample response
|
||||
const expectedResult = [
|
||||
quantile([0.5], obsLayout.col("umap_0").asArray())[0],
|
||||
quantile([0.5], obsLayout.col("umap_1").asArray())[0],
|
||||
quantile([0.5], obsLayout.col("umap_0").asArray() as NumberArray)[0],
|
||||
quantile([0.5], obsLayout.col("umap_1").asArray() as NumberArray)[0],
|
||||
];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
@@ -68,8 +68,8 @@ describe("centroid", () => {
|
||||
|
||||
// This expected result assumes that all cells belong in all categorical values inside of sample response
|
||||
const expectedResult = [
|
||||
quantile([0.5], obsLayout.col("umap_0").asArray())[0],
|
||||
quantile([0.5], obsLayout.col("umap_1").asArray())[0],
|
||||
quantile([0.5], obsLayout.col("umap_0").asArray() as NumberArray)[0],
|
||||
quantile([0.5], obsLayout.col("umap_1").asArray() as NumberArray)[0],
|
||||
];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
|
||||
Reference in New Issue
Block a user