@milaboratories/pl-model-common 1.24.3 → 1.24.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base32_encode.cjs +11 -11
- package/dist/base32_encode.cjs.map +1 -1
- package/dist/base32_encode.d.ts +1 -1
- package/dist/base32_encode.js +11 -11
- package/dist/base32_encode.js.map +1 -1
- package/dist/base64.cjs +2 -2
- package/dist/base64.cjs.map +1 -1
- package/dist/base64.d.ts +1 -1
- package/dist/base64.d.ts.map +1 -1
- package/dist/base64.js +2 -2
- package/dist/base64.js.map +1 -1
- package/dist/block_state.d.ts +3 -3
- package/dist/bmodel/block_config.cjs +1 -1
- package/dist/bmodel/block_config.cjs.map +1 -1
- package/dist/bmodel/block_config.d.ts +3 -3
- package/dist/bmodel/block_config.d.ts.map +1 -1
- package/dist/bmodel/block_config.js +1 -1
- package/dist/bmodel/block_config.js.map +1 -1
- package/dist/bmodel/code.cjs +1 -1
- package/dist/bmodel/code.cjs.map +1 -1
- package/dist/bmodel/code.d.ts +2 -2
- package/dist/bmodel/code.js +1 -1
- package/dist/bmodel/code.js.map +1 -1
- package/dist/bmodel/container.d.ts +5 -5
- package/dist/bmodel/index.d.ts +5 -5
- package/dist/bmodel/normalization.cjs +17 -17
- package/dist/bmodel/normalization.cjs.map +1 -1
- package/dist/bmodel/normalization.d.ts +2 -2
- package/dist/bmodel/normalization.d.ts.map +1 -1
- package/dist/bmodel/normalization.js +17 -17
- package/dist/bmodel/normalization.js.map +1 -1
- package/dist/bmodel/types.d.ts +1 -1
- package/dist/branding.d.ts +2 -2
- package/dist/common_types.d.ts +1 -1
- package/dist/driver_kit.d.ts +1 -1
- package/dist/drivers/ChunkedStreamReader.cjs +13 -12
- package/dist/drivers/ChunkedStreamReader.cjs.map +1 -1
- package/dist/drivers/ChunkedStreamReader.d.ts +2 -2
- package/dist/drivers/ChunkedStreamReader.d.ts.map +1 -1
- package/dist/drivers/ChunkedStreamReader.js +13 -12
- package/dist/drivers/ChunkedStreamReader.js.map +1 -1
- package/dist/drivers/blob.cjs +1 -1
- package/dist/drivers/blob.cjs.map +1 -1
- package/dist/drivers/blob.d.ts +4 -4
- package/dist/drivers/blob.d.ts.map +1 -1
- package/dist/drivers/blob.js +1 -1
- package/dist/drivers/blob.js.map +1 -1
- package/dist/drivers/index.d.ts +8 -8
- package/dist/drivers/log.cjs +1 -1
- package/dist/drivers/log.cjs.map +1 -1
- package/dist/drivers/log.js +1 -1
- package/dist/drivers/log.js.map +1 -1
- package/dist/drivers/ls.cjs +3 -3
- package/dist/drivers/ls.cjs.map +1 -1
- package/dist/drivers/ls.d.ts +6 -6
- package/dist/drivers/ls.d.ts.map +1 -1
- package/dist/drivers/ls.js +3 -3
- package/dist/drivers/ls.js.map +1 -1
- package/dist/drivers/pframe/column_filter.d.ts +1 -1
- package/dist/drivers/pframe/data_info.cjs +119 -110
- package/dist/drivers/pframe/data_info.cjs.map +1 -1
- package/dist/drivers/pframe/data_info.d.ts +10 -10
- package/dist/drivers/pframe/data_info.d.ts.map +1 -1
- package/dist/drivers/pframe/data_info.js +119 -110
- package/dist/drivers/pframe/data_info.js.map +1 -1
- package/dist/drivers/pframe/data_types.cjs +7 -4
- package/dist/drivers/pframe/data_types.cjs.map +1 -1
- package/dist/drivers/pframe/data_types.d.ts +2 -2
- package/dist/drivers/pframe/data_types.d.ts.map +1 -1
- package/dist/drivers/pframe/data_types.js +7 -4
- package/dist/drivers/pframe/data_types.js.map +1 -1
- package/dist/drivers/pframe/driver.d.ts +10 -10
- package/dist/drivers/pframe/driver.d.ts.map +1 -1
- package/dist/drivers/pframe/find_columns.d.ts +2 -2
- package/dist/drivers/pframe/index.d.ts +14 -14
- package/dist/drivers/pframe/linker_columns.cjs +13 -5
- package/dist/drivers/pframe/linker_columns.cjs.map +1 -1
- package/dist/drivers/pframe/linker_columns.d.ts +2 -2
- package/dist/drivers/pframe/linker_columns.d.ts.map +1 -1
- package/dist/drivers/pframe/linker_columns.js +13 -5
- package/dist/drivers/pframe/linker_columns.js.map +1 -1
- package/dist/drivers/pframe/pframe.d.ts +6 -6
- package/dist/drivers/pframe/pframe.d.ts.map +1 -1
- package/dist/drivers/pframe/query/index.d.ts +2 -2
- package/dist/drivers/pframe/query/query_common.d.ts +37 -37
- package/dist/drivers/pframe/query/query_data.d.ts +2 -2
- package/dist/drivers/pframe/query/query_data.d.ts.map +1 -1
- package/dist/drivers/pframe/query/query_spec.d.ts +3 -3
- package/dist/drivers/pframe/query/query_spec.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/anchored.cjs +6 -6
- package/dist/drivers/pframe/spec/anchored.cjs.map +1 -1
- package/dist/drivers/pframe/spec/anchored.d.ts +4 -4
- package/dist/drivers/pframe/spec/anchored.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/anchored.js +6 -6
- package/dist/drivers/pframe/spec/anchored.js.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.cjs +1 -1
- package/dist/drivers/pframe/spec/filtered_column.cjs.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.d.ts +1 -1
- package/dist/drivers/pframe/spec/filtered_column.js +1 -1
- package/dist/drivers/pframe/spec/filtered_column.js.map +1 -1
- package/dist/drivers/pframe/spec/ids.cjs.map +1 -1
- package/dist/drivers/pframe/spec/ids.d.ts +5 -5
- package/dist/drivers/pframe/spec/ids.js.map +1 -1
- package/dist/drivers/pframe/spec/index.d.ts +6 -6
- package/dist/drivers/pframe/spec/native_id.cjs.map +1 -1
- package/dist/drivers/pframe/spec/native_id.d.ts +3 -3
- package/dist/drivers/pframe/spec/native_id.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/native_id.js.map +1 -1
- package/dist/drivers/pframe/spec/selectors.cjs +1 -1
- package/dist/drivers/pframe/spec/selectors.cjs.map +1 -1
- package/dist/drivers/pframe/spec/selectors.d.ts +4 -4
- package/dist/drivers/pframe/spec/selectors.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/selectors.js +1 -1
- package/dist/drivers/pframe/spec/selectors.js.map +1 -1
- package/dist/drivers/pframe/spec/spec.cjs +64 -59
- package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
- package/dist/drivers/pframe/spec/spec.d.ts +15 -15
- package/dist/drivers/pframe/spec/spec.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/spec.js +64 -59
- package/dist/drivers/pframe/spec/spec.js.map +1 -1
- package/dist/drivers/pframe/table.d.ts +2 -2
- package/dist/drivers/pframe/table_calculate.cjs +11 -11
- package/dist/drivers/pframe/table_calculate.cjs.map +1 -1
- package/dist/drivers/pframe/table_calculate.d.ts +30 -30
- package/dist/drivers/pframe/table_calculate.d.ts.map +1 -1
- package/dist/drivers/pframe/table_calculate.js +11 -11
- package/dist/drivers/pframe/table_calculate.js.map +1 -1
- package/dist/drivers/pframe/table_common.cjs +4 -4
- package/dist/drivers/pframe/table_common.cjs.map +1 -1
- package/dist/drivers/pframe/table_common.d.ts +6 -6
- package/dist/drivers/pframe/table_common.js +4 -4
- package/dist/drivers/pframe/table_common.js.map +1 -1
- package/dist/drivers/pframe/type_util.d.ts.map +1 -1
- package/dist/drivers/pframe/unique_values.d.ts +4 -4
- package/dist/drivers/urls.cjs +2 -2
- package/dist/drivers/urls.cjs.map +1 -1
- package/dist/drivers/urls.d.ts +1 -1
- package/dist/drivers/urls.js +2 -2
- package/dist/drivers/urls.js.map +1 -1
- package/dist/errors.cjs +12 -12
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +12 -12
- package/dist/errors.js.map +1 -1
- package/dist/flags/block_flags.cjs +2 -2
- package/dist/flags/block_flags.cjs.map +1 -1
- package/dist/flags/block_flags.d.ts.map +1 -1
- package/dist/flags/block_flags.js +2 -2
- package/dist/flags/block_flags.js.map +1 -1
- package/dist/flags/flag_utils.cjs +31 -29
- package/dist/flags/flag_utils.cjs.map +1 -1
- package/dist/flags/flag_utils.d.ts +33 -33
- package/dist/flags/flag_utils.d.ts.map +1 -1
- package/dist/flags/flag_utils.js +31 -29
- package/dist/flags/flag_utils.js.map +1 -1
- package/dist/flags/index.d.ts +3 -3
- package/dist/flags/type_utils.d.ts +1 -1
- package/dist/flags/type_utils.d.ts.map +1 -1
- package/dist/httpAuth.cjs +4 -5
- package/dist/httpAuth.cjs.map +1 -1
- package/dist/httpAuth.d.ts +1 -1
- package/dist/httpAuth.d.ts.map +1 -1
- package/dist/httpAuth.js +4 -5
- package/dist/httpAuth.js.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/json.cjs +1 -1
- package/dist/json.cjs.map +1 -1
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +1 -1
- package/dist/json.js.map +1 -1
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.cjs.map +1 -1
- package/dist/navigation.d.ts +3 -3
- package/dist/navigation.js +1 -1
- package/dist/navigation.js.map +1 -1
- package/dist/plid.cjs +4 -4
- package/dist/plid.cjs.map +1 -1
- package/dist/plid.d.ts +1 -1
- package/dist/plid.js +4 -4
- package/dist/plid.js.map +1 -1
- package/dist/pool/entry.d.ts +1 -1
- package/dist/pool/index.d.ts +3 -3
- package/dist/pool/query.cjs +23 -23
- package/dist/pool/query.cjs.map +1 -1
- package/dist/pool/query.d.ts +9 -9
- package/dist/pool/query.d.ts.map +1 -1
- package/dist/pool/query.js +23 -23
- package/dist/pool/query.js.map +1 -1
- package/dist/pool/spec.cjs +9 -9
- package/dist/pool/spec.cjs.map +1 -1
- package/dist/pool/spec.d.ts +4 -4
- package/dist/pool/spec.d.ts.map +1 -1
- package/dist/pool/spec.js +9 -9
- package/dist/pool/spec.js.map +1 -1
- package/dist/ref.cjs +20 -18
- package/dist/ref.cjs.map +1 -1
- package/dist/ref.d.ts +1 -1
- package/dist/ref.d.ts.map +1 -1
- package/dist/ref.js +20 -18
- package/dist/ref.js.map +1 -1
- package/dist/utag.d.ts +1 -1
- package/dist/util.cjs +1 -1
- package/dist/util.cjs.map +1 -1
- package/dist/util.js +1 -1
- package/dist/util.js.map +1 -1
- package/dist/value_or_error.cjs.map +1 -1
- package/dist/value_or_error.d.ts.map +1 -1
- package/dist/value_or_error.js.map +1 -1
- package/package.json +18 -17
- package/src/base32_encode.ts +12 -12
- package/src/base64.ts +12 -8
- package/src/block_state.ts +3 -3
- package/src/bmodel/block_config.ts +12 -6
- package/src/bmodel/code.ts +3 -3
- package/src/bmodel/container.ts +5 -5
- package/src/bmodel/index.ts +5 -5
- package/src/bmodel/normalization.ts +33 -25
- package/src/bmodel/types.ts +1 -1
- package/src/branding.ts +2 -2
- package/src/common_types.ts +1 -1
- package/src/driver_kit.ts +1 -1
- package/src/drivers/ChunkedStreamReader.ts +16 -14
- package/src/drivers/blob.ts +7 -11
- package/src/drivers/index.ts +8 -8
- package/src/drivers/log.ts +3 -3
- package/src/drivers/ls.ts +18 -18
- package/src/drivers/pframe/column_filter.ts +1 -1
- package/src/drivers/pframe/data_info.ts +146 -146
- package/src/drivers/pframe/data_types.ts +56 -36
- package/src/drivers/pframe/driver.ts +20 -36
- package/src/drivers/pframe/find_columns.ts +2 -2
- package/src/drivers/pframe/index.ts +14 -14
- package/src/drivers/pframe/linker_columns.test.ts +280 -273
- package/src/drivers/pframe/linker_columns.ts +65 -39
- package/src/drivers/pframe/pframe.ts +6 -9
- package/src/drivers/pframe/query/index.ts +2 -2
- package/src/drivers/pframe/query/query_common.ts +46 -46
- package/src/drivers/pframe/query/query_data.ts +17 -10
- package/src/drivers/pframe/query/query_spec.ts +18 -10
- package/src/drivers/pframe/spec/anchored.ts +44 -33
- package/src/drivers/pframe/spec/filtered_column.ts +2 -2
- package/src/drivers/pframe/spec/ids.ts +6 -6
- package/src/drivers/pframe/spec/index.ts +6 -6
- package/src/drivers/pframe/spec/native_id.ts +7 -9
- package/src/drivers/pframe/spec/selectors.test.ts +170 -146
- package/src/drivers/pframe/spec/selectors.ts +22 -31
- package/src/drivers/pframe/spec/spec.test.ts +163 -176
- package/src/drivers/pframe/spec/spec.ts +132 -117
- package/src/drivers/pframe/table.ts +2 -2
- package/src/drivers/pframe/table_calculate.ts +44 -50
- package/src/drivers/pframe/table_common.ts +10 -10
- package/src/drivers/pframe/type_util.ts +2 -7
- package/src/drivers/pframe/unique_values.ts +4 -4
- package/src/drivers/urls.ts +3 -3
- package/src/errors.test.ts +20 -20
- package/src/errors.ts +24 -20
- package/src/flags/block_flags.ts +8 -7
- package/src/flags/flag_utils.test.ts +94 -73
- package/src/flags/flag_utils.ts +73 -50
- package/src/flags/index.ts +3 -3
- package/src/flags/type_utils.ts +10 -7
- package/src/httpAuth.ts +5 -6
- package/src/index.ts +19 -19
- package/src/json.ts +28 -17
- package/src/navigation.ts +4 -4
- package/src/plid.ts +6 -6
- package/src/pool/entry.ts +1 -1
- package/src/pool/index.ts +3 -3
- package/src/pool/query.ts +52 -56
- package/src/pool/spec.ts +20 -17
- package/src/ref.ts +25 -19
- package/src/utag.ts +1 -1
- package/src/util.ts +1 -1
- package/src/value_or_error.ts +6 -6
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import { ensureError } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type StringifiedJson,
|
|
6
|
-
} from '../../../json';
|
|
7
|
-
import type {
|
|
8
|
-
PObject,
|
|
9
|
-
PObjectId,
|
|
10
|
-
PObjectSpec,
|
|
11
|
-
} from '../../../pool';
|
|
12
|
-
import { z } from 'zod';
|
|
1
|
+
import { ensureError } from "../../../errors";
|
|
2
|
+
import { canonicalizeJson, type CanonicalizedJson, type StringifiedJson } from "../../../json";
|
|
3
|
+
import type { PObject, PObjectId, PObjectSpec } from "../../../pool";
|
|
4
|
+
import { z } from "zod";
|
|
13
5
|
|
|
14
6
|
export const ValueType = {
|
|
15
|
-
Int:
|
|
16
|
-
Long:
|
|
17
|
-
Float:
|
|
18
|
-
Double:
|
|
19
|
-
String:
|
|
20
|
-
Bytes:
|
|
7
|
+
Int: "Int",
|
|
8
|
+
Long: "Long",
|
|
9
|
+
Float: "Float",
|
|
10
|
+
Double: "Double",
|
|
11
|
+
String: "String",
|
|
12
|
+
Bytes: "Bytes",
|
|
21
13
|
} as const;
|
|
22
14
|
|
|
23
|
-
export type AxisValueType = Extract<ValueType,
|
|
15
|
+
export type AxisValueType = Extract<ValueType, "Int" | "Long" | "String">;
|
|
24
16
|
export type ColumnValueType = ValueType;
|
|
25
17
|
|
|
26
18
|
/** PFrame columns and axes within them may store one of these types. */
|
|
@@ -36,7 +28,9 @@ export function readMetadata<U extends Metadata, T extends keyof U = keyof U>(
|
|
|
36
28
|
}
|
|
37
29
|
|
|
38
30
|
type MetadataJsonImpl<M> = {
|
|
39
|
-
[P in keyof M as
|
|
31
|
+
[P in keyof M as M[P] extends StringifiedJson ? P : never]: M[P] extends StringifiedJson<infer U>
|
|
32
|
+
? z.ZodType<U>
|
|
33
|
+
: never;
|
|
40
34
|
};
|
|
41
35
|
export type MetadataJson<M> = MetadataJsonImpl<Required<M>>;
|
|
42
36
|
|
|
@@ -44,7 +38,7 @@ export function readMetadataJsonOrThrow<M extends Metadata, T extends keyof Meta
|
|
|
44
38
|
metadata: Metadata | undefined,
|
|
45
39
|
metadataJson: MetadataJson<M>,
|
|
46
40
|
key: T,
|
|
47
|
-
methodNameInError: string =
|
|
41
|
+
methodNameInError: string = "readMetadataJsonOrThrow",
|
|
48
42
|
): z.infer<MetadataJson<M>[T]> | undefined {
|
|
49
43
|
const json = readMetadata<M, T>(metadata, key);
|
|
50
44
|
if (json === undefined) return undefined;
|
|
@@ -55,10 +49,10 @@ export function readMetadataJsonOrThrow<M extends Metadata, T extends keyof Meta
|
|
|
55
49
|
return schema.parse(value);
|
|
56
50
|
} catch (error: unknown) {
|
|
57
51
|
throw new Error(
|
|
58
|
-
`${methodNameInError} failed, `
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
`${methodNameInError} failed, ` +
|
|
53
|
+
`key: ${String(key)}, ` +
|
|
54
|
+
`value: ${json}, ` +
|
|
55
|
+
`error: ${ensureError(error)}`,
|
|
62
56
|
);
|
|
63
57
|
}
|
|
64
58
|
}
|
|
@@ -77,20 +71,21 @@ export function readMetadataJson<M extends Metadata, T extends keyof MetadataJso
|
|
|
77
71
|
|
|
78
72
|
/// Well-known domains
|
|
79
73
|
export const Domain = {
|
|
80
|
-
Alphabet:
|
|
81
|
-
BlockId:
|
|
74
|
+
Alphabet: "pl7.app/alphabet",
|
|
75
|
+
BlockId: "pl7.app/blockId",
|
|
82
76
|
VDJ: {
|
|
83
77
|
ScClonotypeChain: {
|
|
84
|
-
Index:
|
|
78
|
+
Index: "pl7.app/vdj/scClonotypeChain/index",
|
|
85
79
|
},
|
|
86
80
|
},
|
|
87
81
|
} as const;
|
|
88
82
|
|
|
89
|
-
export type Domain = Metadata &
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
83
|
+
export type Domain = Metadata &
|
|
84
|
+
Partial<{
|
|
85
|
+
[Domain.Alphabet]: "nucleotide" | "aminoacid" | (string & {});
|
|
86
|
+
[Domain.BlockId]: string;
|
|
87
|
+
[Domain.VDJ.ScClonotypeChain.Index]: "primary" | "secondary" | (string & {});
|
|
88
|
+
}>;
|
|
94
89
|
|
|
95
90
|
export type DomainJson = MetadataJson<Domain>;
|
|
96
91
|
export const DomainJson: DomainJson = {};
|
|
@@ -108,7 +103,7 @@ export function readDomainJsonOrThrow<T extends keyof DomainJson>(
|
|
|
108
103
|
spec: { domain?: Metadata | undefined } | undefined,
|
|
109
104
|
key: T,
|
|
110
105
|
): z.infer<DomainJson[T]> | undefined {
|
|
111
|
-
return readMetadataJsonOrThrow<Domain, T>(spec?.domain, DomainJson, key,
|
|
106
|
+
return readMetadataJsonOrThrow<Domain, T>(spec?.domain, DomainJson, key, "readDomainJsonOrThrow");
|
|
112
107
|
}
|
|
113
108
|
|
|
114
109
|
/// Helper function for reading json-encoded domain values, returns undefined on JSON parsing error
|
|
@@ -121,84 +116,87 @@ export function readDomainJson<T extends keyof DomainJson>(
|
|
|
121
116
|
|
|
122
117
|
/// Well-known annotations
|
|
123
118
|
export const Annotation = {
|
|
124
|
-
AxisNature:
|
|
125
|
-
Alphabet:
|
|
126
|
-
Description:
|
|
127
|
-
DiscreteValues:
|
|
128
|
-
Format:
|
|
119
|
+
AxisNature: "pl7.app/axisNature",
|
|
120
|
+
Alphabet: "pl7.app/alphabet",
|
|
121
|
+
Description: "pl7.app/description",
|
|
122
|
+
DiscreteValues: "pl7.app/discreteValues",
|
|
123
|
+
Format: "pl7.app/format",
|
|
129
124
|
Graph: {
|
|
130
125
|
Axis: {
|
|
131
|
-
HighCardinality:
|
|
132
|
-
LowerLimit:
|
|
133
|
-
SymmetricRange:
|
|
134
|
-
UpperLimit:
|
|
126
|
+
HighCardinality: "pl7.app/graph/axis/highCardinality",
|
|
127
|
+
LowerLimit: "pl7.app/graph/axis/lowerLimit",
|
|
128
|
+
SymmetricRange: "pl7.app/graph/axis/symmetricRange",
|
|
129
|
+
UpperLimit: "pl7.app/graph/axis/upperLimit",
|
|
135
130
|
},
|
|
136
|
-
IsDenseAxis:
|
|
137
|
-
IsVirtual:
|
|
138
|
-
Palette:
|
|
139
|
-
Thresholds:
|
|
140
|
-
TreatAbsentValuesAs:
|
|
131
|
+
IsDenseAxis: "pl7.app/graph/isDenseAxis",
|
|
132
|
+
IsVirtual: "pl7.app/graph/isVirtual",
|
|
133
|
+
Palette: "pl7.app/graph/palette",
|
|
134
|
+
Thresholds: "pl7.app/graph/thresholds",
|
|
135
|
+
TreatAbsentValuesAs: "pl7.app/graph/treatAbsentValuesAs",
|
|
141
136
|
},
|
|
142
|
-
HideDataFromUi:
|
|
143
|
-
HideDataFromGraphs:
|
|
144
|
-
IsDiscreteFilter:
|
|
145
|
-
IsLinkerColumn:
|
|
146
|
-
IsSubset:
|
|
147
|
-
Label:
|
|
148
|
-
Max:
|
|
149
|
-
Min:
|
|
150
|
-
MultipliesBy:
|
|
151
|
-
Parents:
|
|
137
|
+
HideDataFromUi: "pl7.app/hideDataFromUi",
|
|
138
|
+
HideDataFromGraphs: "pl7.app/hideDataFromGraphs",
|
|
139
|
+
IsDiscreteFilter: "pl7.app/isDiscreteFilter",
|
|
140
|
+
IsLinkerColumn: "pl7.app/isLinkerColumn",
|
|
141
|
+
IsSubset: "pl7.app/isSubset",
|
|
142
|
+
Label: "pl7.app/label",
|
|
143
|
+
Max: "pl7.app/max",
|
|
144
|
+
Min: "pl7.app/min",
|
|
145
|
+
MultipliesBy: "pl7.app/multipliesBy",
|
|
146
|
+
Parents: "pl7.app/parents",
|
|
152
147
|
Sequence: {
|
|
153
148
|
Annotation: {
|
|
154
|
-
Mapping:
|
|
149
|
+
Mapping: "pl7.app/sequence/annotation/mapping",
|
|
155
150
|
},
|
|
156
|
-
IsAnnotation:
|
|
151
|
+
IsAnnotation: "pl7.app/sequence/isAnnotation",
|
|
157
152
|
},
|
|
158
153
|
Table: {
|
|
159
|
-
FontFamily:
|
|
160
|
-
OrderPriority:
|
|
161
|
-
Visibility:
|
|
154
|
+
FontFamily: "pl7.app/table/fontFamily",
|
|
155
|
+
OrderPriority: "pl7.app/table/orderPriority",
|
|
156
|
+
Visibility: "pl7.app/table/visibility",
|
|
162
157
|
},
|
|
163
|
-
Trace:
|
|
158
|
+
Trace: "pl7.app/trace",
|
|
164
159
|
VDJ: {
|
|
165
|
-
IsAssemblingFeature:
|
|
160
|
+
IsAssemblingFeature: "pl7.app/vdj/isAssemblingFeature",
|
|
166
161
|
},
|
|
167
162
|
} as const;
|
|
168
163
|
|
|
169
|
-
export type Annotation = Metadata &
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
164
|
+
export type Annotation = Metadata &
|
|
165
|
+
Partial<{
|
|
166
|
+
[Annotation.Alphabet]: "nucleotide" | "aminoacid" | (string & {});
|
|
167
|
+
[Annotation.AxisNature]: "homogeneous" | "heterogeneous" | "scaleCompatible" | (string & {});
|
|
168
|
+
[Annotation.Description]: string;
|
|
169
|
+
[Annotation.DiscreteValues]: StringifiedJson<number[]> | StringifiedJson<string[]>;
|
|
170
|
+
[Annotation.Format]: string;
|
|
171
|
+
[Annotation.Graph.Axis.HighCardinality]: StringifiedJson<boolean>;
|
|
172
|
+
[Annotation.Graph.Axis.LowerLimit]: StringifiedJson<number>;
|
|
173
|
+
[Annotation.Graph.Axis.SymmetricRange]: StringifiedJson<boolean>;
|
|
174
|
+
[Annotation.Graph.Axis.UpperLimit]: StringifiedJson<number>;
|
|
175
|
+
[Annotation.Graph.IsDenseAxis]: StringifiedJson<boolean>;
|
|
176
|
+
[Annotation.Graph.IsVirtual]: StringifiedJson<boolean>;
|
|
177
|
+
[Annotation.Graph.Palette]: StringifiedJson<{ mapping: Record<string, number>; name: string }>;
|
|
178
|
+
[Annotation.Graph.Thresholds]: StringifiedJson<
|
|
179
|
+
{ columnId: { valueType: ValueType; name: string }; value: number }[]
|
|
180
|
+
>;
|
|
181
|
+
[Annotation.Graph.TreatAbsentValuesAs]: StringifiedJson<number>;
|
|
182
|
+
[Annotation.HideDataFromGraphs]: StringifiedJson<boolean>;
|
|
183
|
+
[Annotation.HideDataFromUi]: StringifiedJson<boolean>;
|
|
184
|
+
[Annotation.IsDiscreteFilter]: StringifiedJson<boolean>;
|
|
185
|
+
[Annotation.IsLinkerColumn]: StringifiedJson<boolean>;
|
|
186
|
+
[Annotation.IsSubset]: StringifiedJson<boolean>;
|
|
187
|
+
[Annotation.Label]: string;
|
|
188
|
+
[Annotation.Max]: StringifiedJson<number>;
|
|
189
|
+
[Annotation.Min]: StringifiedJson<number>;
|
|
190
|
+
[Annotation.MultipliesBy]: StringifiedJson<AxisSpec["name"][]>;
|
|
191
|
+
[Annotation.Parents]: StringifiedJson<AxisSpec["name"][]>;
|
|
192
|
+
[Annotation.Sequence.Annotation.Mapping]: StringifiedJson<Record<string, string>>;
|
|
193
|
+
[Annotation.Sequence.IsAnnotation]: StringifiedJson<boolean>;
|
|
194
|
+
[Annotation.Table.FontFamily]: string;
|
|
195
|
+
[Annotation.Table.OrderPriority]: StringifiedJson<number>;
|
|
196
|
+
[Annotation.Table.Visibility]: "hidden" | "optional" | (string & {});
|
|
197
|
+
[Annotation.Trace]: StringifiedJson<Record<string, unknown>>;
|
|
198
|
+
[Annotation.VDJ.IsAssemblingFeature]: StringifiedJson<boolean>;
|
|
199
|
+
}>;
|
|
202
200
|
|
|
203
201
|
// export const AxisSpec = z.object({
|
|
204
202
|
// type: z.nativeEnum(ValueType),
|
|
@@ -219,7 +217,7 @@ export type Annotation = Metadata & Partial<{
|
|
|
219
217
|
|
|
220
218
|
export type AnnotationJson = MetadataJson<Annotation>;
|
|
221
219
|
|
|
222
|
-
const ValueTypeSchema = z.enum([
|
|
220
|
+
const ValueTypeSchema = z.enum(["Int", "Long", "Float", "Double", "String"] as const);
|
|
223
221
|
export const AnnotationJson: AnnotationJson = {
|
|
224
222
|
[Annotation.DiscreteValues]: z.array(z.string()).or(z.array(z.number())),
|
|
225
223
|
[Annotation.Graph.Axis.HighCardinality]: z.boolean(),
|
|
@@ -265,7 +263,12 @@ export function readAnnotationJsonOrThrow<T extends keyof AnnotationJson>(
|
|
|
265
263
|
spec: { annotations?: Metadata | undefined } | undefined,
|
|
266
264
|
key: T,
|
|
267
265
|
): z.infer<AnnotationJson[T]> | undefined {
|
|
268
|
-
return readMetadataJsonOrThrow<Annotation, T>(
|
|
266
|
+
return readMetadataJsonOrThrow<Annotation, T>(
|
|
267
|
+
spec?.annotations,
|
|
268
|
+
AnnotationJson,
|
|
269
|
+
key,
|
|
270
|
+
"readAnnotationJsonOrThrow",
|
|
271
|
+
);
|
|
269
272
|
}
|
|
270
273
|
|
|
271
274
|
/// Helper function for reading json-encoded annotation values, returns undefined on JSON parsing error
|
|
@@ -325,7 +328,7 @@ export type AxisSpec = {
|
|
|
325
328
|
};
|
|
326
329
|
|
|
327
330
|
/** Parents are specs, not indexes; normalized axis can be used considering its parents independently from column */
|
|
328
|
-
export interface AxisSpecNormalized extends Omit<AxisSpec,
|
|
331
|
+
export interface AxisSpecNormalized extends Omit<AxisSpec, "parentAxes"> {
|
|
329
332
|
parentAxesSpec: AxisSpecNormalized[];
|
|
330
333
|
}
|
|
331
334
|
|
|
@@ -392,7 +395,10 @@ export function canonicalizeAxisWithParents(axis: AxisSpecNormalized) {
|
|
|
392
395
|
return canonicalizeJson(getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId));
|
|
393
396
|
}
|
|
394
397
|
|
|
395
|
-
function normalizingAxesComparator(
|
|
398
|
+
function normalizingAxesComparator(
|
|
399
|
+
axis1: AxisSpecNormalized,
|
|
400
|
+
axis2: AxisSpecNormalized,
|
|
401
|
+
): 1 | -1 | 0 {
|
|
396
402
|
if (axis1.name !== axis2.name) {
|
|
397
403
|
return axis1.name < axis2.name ? 1 : -1;
|
|
398
404
|
}
|
|
@@ -471,17 +477,24 @@ export function getNormalizedAxesList(axes: AxisSpec[]): AxisSpecNormalized[] {
|
|
|
471
477
|
|
|
472
478
|
axes.forEach((axis, idx) => {
|
|
473
479
|
const modifiedAxis = modifiedAxes[idx];
|
|
474
|
-
if (axis.parentAxes) {
|
|
480
|
+
if (axis.parentAxes) {
|
|
481
|
+
// if we have parents by indexes then take from the list
|
|
475
482
|
modifiedAxis.parentAxesSpec = axis.parentAxes.map((idx) => modifiedAxes[idx]);
|
|
476
|
-
} else {
|
|
477
|
-
|
|
478
|
-
|
|
483
|
+
} else {
|
|
484
|
+
// else try to parse from annotation name
|
|
485
|
+
const parents = parseParentsFromAnnotations(axis).map((name) =>
|
|
486
|
+
modifiedAxes.find((axis) => axis.name === name),
|
|
487
|
+
);
|
|
488
|
+
modifiedAxis.parentAxesSpec = parents.some((p) => p === undefined)
|
|
489
|
+
? []
|
|
490
|
+
: (parents as AxisSpecNormalized[]);
|
|
479
491
|
|
|
480
492
|
delete modifiedAxis.annotations?.[Annotation.Parents];
|
|
481
493
|
}
|
|
482
494
|
});
|
|
483
495
|
|
|
484
|
-
if (modifiedAxes.some(hasCycleOfParents)) {
|
|
496
|
+
if (modifiedAxes.some(hasCycleOfParents)) {
|
|
497
|
+
// Axes list is broken
|
|
485
498
|
modifiedAxes.forEach((axis) => {
|
|
486
499
|
axis.parentAxesSpec = [];
|
|
487
500
|
});
|
|
@@ -498,7 +511,9 @@ export function getNormalizedAxesList(axes: AxisSpec[]): AxisSpecNormalized[] {
|
|
|
498
511
|
export function getDenormalizedAxesList(axesSpec: AxisSpecNormalized[]): AxisSpec[] {
|
|
499
512
|
const idsList = axesSpec.map((axisSpec) => canonicalizeJson(getAxisId(axisSpec)));
|
|
500
513
|
return axesSpec.map((axisSpec) => {
|
|
501
|
-
const parentsIds = axisSpec.parentAxesSpec.map((axisSpec) =>
|
|
514
|
+
const parentsIds = axisSpec.parentAxesSpec.map((axisSpec) =>
|
|
515
|
+
canonicalizeJson(getAxisId(axisSpec)),
|
|
516
|
+
);
|
|
502
517
|
const parentIdxs = parentsIds.map((id) => idsList.indexOf(id));
|
|
503
518
|
const { parentAxesSpec: _, ...copiedRest } = axisSpec;
|
|
504
519
|
if (parentIdxs.length) {
|
|
@@ -513,12 +528,12 @@ export type AxesSpec = AxisSpec[];
|
|
|
513
528
|
|
|
514
529
|
/// Well-known column names
|
|
515
530
|
export const PColumnName = {
|
|
516
|
-
Label:
|
|
531
|
+
Label: "pl7.app/label",
|
|
517
532
|
Table: {
|
|
518
|
-
RowSelection:
|
|
533
|
+
RowSelection: "pl7.app/table/row-selection",
|
|
519
534
|
},
|
|
520
535
|
VDJ: {
|
|
521
|
-
Sequence:
|
|
536
|
+
Sequence: "pl7.app/vdj/sequence",
|
|
522
537
|
},
|
|
523
538
|
} as const;
|
|
524
539
|
|
|
@@ -526,9 +541,9 @@ export const PColumnName = {
|
|
|
526
541
|
export const PAxisName = {
|
|
527
542
|
VDJ: {
|
|
528
543
|
Assay: {
|
|
529
|
-
SequenceId:
|
|
544
|
+
SequenceId: "pl7.app/vdj/assay/sequenceId",
|
|
530
545
|
},
|
|
531
|
-
ScClonotypeKey:
|
|
546
|
+
ScClonotypeKey: "pl7.app/vdj/scClonotypeKey",
|
|
532
547
|
},
|
|
533
548
|
} as const;
|
|
534
549
|
|
|
@@ -550,7 +565,7 @@ export function isLabelColumn(column: PColumnSpec) {
|
|
|
550
565
|
export type PUniversalColumnSpec = PObjectSpec & {
|
|
551
566
|
/** Defines specific type of BObject, the most generic type of unit of
|
|
552
567
|
* information in Platforma Project. */
|
|
553
|
-
readonly kind:
|
|
568
|
+
readonly kind: "PColumn";
|
|
554
569
|
|
|
555
570
|
/** Type of column values */
|
|
556
571
|
readonly valueType: string;
|
|
@@ -593,7 +608,7 @@ export type PColumnSpec = PDataColumnSpec;
|
|
|
593
608
|
export type PColumnSpecId = {
|
|
594
609
|
/** Defines specific type of BObject, the most generic type of unit of
|
|
595
610
|
* information in Platforma Project. */
|
|
596
|
-
readonly kind:
|
|
611
|
+
readonly kind: "PColumn";
|
|
597
612
|
|
|
598
613
|
/** Type of column values */
|
|
599
614
|
readonly valueType: ValueType;
|
|
@@ -706,9 +721,9 @@ export function matchAxisId(query: AxisId, target: AxisId): boolean {
|
|
|
706
721
|
}
|
|
707
722
|
|
|
708
723
|
export function getTypeFromPColumnOrAxisSpec(spec: PColumnSpec | AxisSpec): ValueType {
|
|
709
|
-
return
|
|
724
|
+
return "valueType" in spec ? spec.valueType : spec.type;
|
|
710
725
|
}
|
|
711
726
|
|
|
712
727
|
export function isAxisId(id: unknown): id is AxisId {
|
|
713
|
-
return typeof id ===
|
|
728
|
+
return typeof id === "object" && id !== null && "name" in id && "type" in id;
|
|
714
729
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PTableColumnSpec } from
|
|
2
|
-
import type { PTableShape, PTableVector, TableRange } from
|
|
1
|
+
import type { PTableColumnSpec } from "./table_common";
|
|
2
|
+
import type { PTableShape, PTableVector, TableRange } from "./data_types";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Table view.
|