mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-24 13:48:12 +08:00
introduce TypedArray + NumericArray
This commit is contained in:
@@ -1,3 +1,73 @@
|
||||
// If a globally shared type or interface doesn't have a clear owner, put it here
|
||||
|
||||
export {};
|
||||
|
||||
export interface AnnotationColumn {
|
||||
categories?: Category[];
|
||||
name: string;
|
||||
type: "string" | "float32" | "int32" | "categorical" | "boolean";
|
||||
writable: boolean;
|
||||
}
|
||||
|
||||
interface DataFrame {
|
||||
nObs: number;
|
||||
nVar: number;
|
||||
// TODO(thuang): Not sure what other types are available
|
||||
type: "float32";
|
||||
}
|
||||
|
||||
export interface LayoutColumn {
|
||||
dims: string[];
|
||||
name: string;
|
||||
// TODO(thuang): Not sure what other types are available
|
||||
type: "float32";
|
||||
}
|
||||
interface RawLayout {
|
||||
obs: LayoutColumn[];
|
||||
var?: LayoutColumn[];
|
||||
}
|
||||
|
||||
interface RawAnnotations {
|
||||
obs: {
|
||||
columns: AnnotationColumn[];
|
||||
index: string;
|
||||
};
|
||||
var: {
|
||||
columns: AnnotationColumn[];
|
||||
index: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface RawSchema {
|
||||
annotations: RawAnnotations;
|
||||
dataframe: DataFrame;
|
||||
layout: RawLayout;
|
||||
}
|
||||
|
||||
interface Annotations extends RawAnnotations {
|
||||
obsByName: { [name: string]: AnnotationColumn };
|
||||
varByName: { [name: string]: AnnotationColumn };
|
||||
}
|
||||
|
||||
interface Layout extends RawLayout {
|
||||
obsByName: { [name: string]: LayoutColumn };
|
||||
varByName: { [name: string]: LayoutColumn };
|
||||
}
|
||||
|
||||
export interface Schema extends RawSchema {
|
||||
annotations: Annotations;
|
||||
layout: Layout;
|
||||
}
|
||||
|
||||
export type TypedArray =
|
||||
| Uint8Array
|
||||
| Uint8ClampedArray
|
||||
| Uint16Array
|
||||
| Uint32Array
|
||||
| Int8Array
|
||||
| Int16Array
|
||||
| Int32Array
|
||||
| Float32Array
|
||||
| Float64Array;
|
||||
|
||||
export type NumericArray = TypedArray | Array<number>;
|
||||
|
||||
Reference in New Issue
Block a user