@vitessce/sets-utils 2.0.3 → 3.0.0
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/{index.mjs → index.js} +9301 -7998
- package/dist-tsc/CellSetsZarrLoader.d.ts +2 -0
- package/dist-tsc/CellSetsZarrLoader.d.ts.map +1 -0
- package/dist-tsc/CellSetsZarrLoader.js +91 -0
- package/dist-tsc/CellSetsZarrLoader.test.d.ts +2 -0
- package/dist-tsc/CellSetsZarrLoader.test.d.ts.map +1 -0
- package/dist-tsc/CellSetsZarrLoader.test.js +154 -0
- package/dist-tsc/cell-set-utils.d.ts +204 -0
- package/dist-tsc/cell-set-utils.d.ts.map +1 -0
- package/dist-tsc/cell-set-utils.js +630 -0
- package/dist-tsc/cell-set-utils.test.d.ts +2 -0
- package/dist-tsc/cell-set-utils.test.d.ts.map +1 -0
- package/dist-tsc/cell-set-utils.test.fixtures.d.ts +47 -0
- package/dist-tsc/cell-set-utils.test.fixtures.d.ts.map +1 -0
- package/dist-tsc/cell-set-utils.test.fixtures.js +68 -0
- package/dist-tsc/cell-set-utils.test.js +185 -0
- package/dist-tsc/constants.d.ts +17 -0
- package/dist-tsc/constants.d.ts.map +1 -0
- package/dist-tsc/constants.js +17 -0
- package/dist-tsc/index.d.ts +7 -0
- package/dist-tsc/index.d.ts.map +1 -0
- package/dist-tsc/index.js +6 -5
- package/dist-tsc/io.d.ts +47 -0
- package/dist-tsc/io.d.ts.map +1 -0
- package/dist-tsc/io.js +159 -0
- package/dist-tsc/io.test.d.ts +2 -0
- package/dist-tsc/io.test.d.ts.map +1 -0
- package/dist-tsc/io.test.js +124 -0
- package/dist-tsc/set-path-utils.d.ts +28 -0
- package/dist-tsc/set-path-utils.d.ts.map +1 -0
- package/dist-tsc/set-path-utils.js +133 -0
- package/dist-tsc/set-path-utils.test.d.ts +2 -0
- package/dist-tsc/set-path-utils.test.d.ts.map +1 -0
- package/dist-tsc/set-path-utils.test.js +210 -0
- package/dist-tsc/utils.d.ts +45 -0
- package/dist-tsc/utils.d.ts.map +1 -0
- package/dist-tsc/utils.js +139 -0
- package/dist-tsc/utils.test.d.ts +2 -0
- package/dist-tsc/utils.test.d.ts.map +1 -0
- package/dist-tsc/utils.test.js +39 -0
- package/package.json +16 -8
- package/src/CellSetsZarrLoader.js +2 -2
- package/src/CellSetsZarrLoader.test.js +1 -1
- package/src/cell-set-utils.js +33 -16
- package/src/cell-set-utils.test.js +105 -4
- package/src/constants.js +4 -15
- package/src/index.js +11 -5
- package/src/io.js +25 -35
- package/src/io.test.js +1 -4
- package/src/set-path-utils.js +155 -0
- package/src/set-path-utils.test.js +257 -0
- package/src/utils.js +20 -9
- package/src/utils.test.js +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellSetsZarrLoader.d.ts","sourceRoot":"","sources":["../src/CellSetsZarrLoader.js"],"names":[],"mappings":"AASA,oEAqGC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { InternMap } from 'internmap';
|
|
2
|
+
import { treeInitialize, nodeAppendChild, } from './cell-set-utils.js';
|
|
3
|
+
import { SETS_DATATYPE_OBS, } from './constants.js';
|
|
4
|
+
export function dataToCellSetsTree(data, options) {
|
|
5
|
+
// obsIndex is an array of all cell IDs, for the purposes of set complement operations only.
|
|
6
|
+
// cellNames is per-cellSets arrays of cell IDs.
|
|
7
|
+
const [cellNames, cellSets, cellSetScores] = data;
|
|
8
|
+
const cellSetsTree = treeInitialize(SETS_DATATYPE_OBS);
|
|
9
|
+
cellSets.forEach((cellSetIds, j) => {
|
|
10
|
+
const { name } = options[j];
|
|
11
|
+
let levelZeroNode = {
|
|
12
|
+
name,
|
|
13
|
+
children: [],
|
|
14
|
+
};
|
|
15
|
+
if (cellSetIds.length > 0 && Array.isArray(cellSetIds[0])) {
|
|
16
|
+
// Multi-level case.
|
|
17
|
+
// TODO: throw a warning if the levels are not in order coarser->finer.
|
|
18
|
+
const levelSets = new InternMap([], JSON.stringify);
|
|
19
|
+
cellNames[j].forEach((id, i) => {
|
|
20
|
+
const classes = cellSetIds.map(col => col[i]);
|
|
21
|
+
if (levelSets.has(classes)) {
|
|
22
|
+
levelSets.get(classes).push([id, null]);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
levelSets.set(classes, [[id, null]]);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const levels = Array.from(levelSets.keys());
|
|
29
|
+
const getNextLevelNames = (levelSuffixes) => {
|
|
30
|
+
const nextLevelNames = Array.from(new Set(levelSuffixes.map(l => l[0])));
|
|
31
|
+
return nextLevelNames.sort((a, b) => a.localeCompare(b));
|
|
32
|
+
};
|
|
33
|
+
// Recursive function to create nodes.
|
|
34
|
+
const getNode = (parentLevelPrefixes, currLevelName, childLevelSuffixes) => {
|
|
35
|
+
const isLeaf = childLevelSuffixes.length === 0;
|
|
36
|
+
const resultNode = {
|
|
37
|
+
name: currLevelName,
|
|
38
|
+
};
|
|
39
|
+
if (isLeaf) {
|
|
40
|
+
// Base case: this is a leaf node.
|
|
41
|
+
resultNode.set = levelSets.get([...parentLevelPrefixes, currLevelName]);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// Are the remaining suffices redundant?
|
|
45
|
+
// Consider ["Parent", "Child", "Child"]
|
|
46
|
+
// where parentLevelPrefixes is ["Parent"] and currLevelName is "Child".
|
|
47
|
+
const shouldBeLeaf = (childLevelSuffixes.length === 1
|
|
48
|
+
&& currLevelName === childLevelSuffixes[0][childLevelSuffixes[0].length - 1]);
|
|
49
|
+
if (shouldBeLeaf) {
|
|
50
|
+
resultNode.set = levelSets.get([...parentLevelPrefixes, currLevelName, ...childLevelSuffixes[0]]);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// Recursion, run getNode() on each of the unique names at the next level.
|
|
54
|
+
const nextLevelNames = getNextLevelNames(childLevelSuffixes);
|
|
55
|
+
resultNode.children = nextLevelNames
|
|
56
|
+
.map(nextLevelName => getNode([...parentLevelPrefixes, currLevelName], nextLevelName, childLevelSuffixes
|
|
57
|
+
.filter(l => l[0] === nextLevelName)
|
|
58
|
+
.map(l => l.slice(1))
|
|
59
|
+
.filter(v => v.length > 0)));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return resultNode;
|
|
63
|
+
};
|
|
64
|
+
// Start the recursion.
|
|
65
|
+
const levelOneNodes = getNextLevelNames(levels)
|
|
66
|
+
.map(levelOneName => getNode([], levelOneName, levels.filter(l => l[0] === levelOneName).map(l => l.slice(1))));
|
|
67
|
+
levelZeroNode.children = levelOneNodes;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// Single-level case.
|
|
71
|
+
// Check for the optional corresponding confidence score column name.
|
|
72
|
+
const uniqueCellSetIds = Array.from(new Set(cellSetIds)).sort();
|
|
73
|
+
const clusters = {};
|
|
74
|
+
// eslint-disable-next-line no-return-assign
|
|
75
|
+
uniqueCellSetIds.forEach(id => (clusters[id] = { name: id, set: [] }));
|
|
76
|
+
if (cellSetScores[j]) {
|
|
77
|
+
cellSetIds
|
|
78
|
+
.forEach((id, i) => clusters[id].set.push([cellNames[j][i], cellSetScores[j][i]]));
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
cellSetIds
|
|
82
|
+
.forEach((id, i) => clusters[id].set.push([cellNames[j][i], null]));
|
|
83
|
+
}
|
|
84
|
+
Object.values(clusters).forEach(
|
|
85
|
+
// eslint-disable-next-line no-return-assign
|
|
86
|
+
cluster => (levelZeroNode = nodeAppendChild(levelZeroNode, cluster)));
|
|
87
|
+
}
|
|
88
|
+
cellSetsTree.tree.push(levelZeroNode);
|
|
89
|
+
});
|
|
90
|
+
return cellSetsTree;
|
|
91
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellSetsZarrLoader.test.d.ts","sourceRoot":"","sources":["../src/CellSetsZarrLoader.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { dataToCellSetsTree } from './CellSetsZarrLoader.js';
|
|
2
|
+
describe('loaders/CellSetsZarrLoader', () => {
|
|
3
|
+
it('dataToCellSetsTree constructs a hierarchy from an array of columns', async () => {
|
|
4
|
+
const data = [
|
|
5
|
+
[
|
|
6
|
+
['cell_1', 'cell_2', 'cell_3', 'cell_4'],
|
|
7
|
+
],
|
|
8
|
+
[
|
|
9
|
+
[
|
|
10
|
+
['Immune', 'Immune', 'Immune', 'Neuron'],
|
|
11
|
+
['B cell', 'B cell', 'B cell', 'Excitatory neuron'],
|
|
12
|
+
['CD19+', 'CD19-', 'CD19-', 'Retinal bipolar neuron'],
|
|
13
|
+
],
|
|
14
|
+
],
|
|
15
|
+
[undefined],
|
|
16
|
+
];
|
|
17
|
+
const options = [
|
|
18
|
+
{ name: 'Subclass Levels', path: ['obs/L1', 'obs/L2', 'obs/L3'] },
|
|
19
|
+
];
|
|
20
|
+
const tree = dataToCellSetsTree(data, options);
|
|
21
|
+
expect(tree).toEqual({
|
|
22
|
+
version: '0.1.3',
|
|
23
|
+
datatype: 'obs',
|
|
24
|
+
tree: [
|
|
25
|
+
{
|
|
26
|
+
name: 'Subclass Levels',
|
|
27
|
+
children: [
|
|
28
|
+
{
|
|
29
|
+
name: 'Immune',
|
|
30
|
+
children: [
|
|
31
|
+
{
|
|
32
|
+
name: 'B cell',
|
|
33
|
+
children: [
|
|
34
|
+
{
|
|
35
|
+
name: 'CD19-',
|
|
36
|
+
set: [
|
|
37
|
+
['cell_2', null],
|
|
38
|
+
['cell_3', null],
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'CD19+',
|
|
43
|
+
set: [
|
|
44
|
+
['cell_1', null],
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'Neuron',
|
|
53
|
+
children: [
|
|
54
|
+
{
|
|
55
|
+
name: 'Excitatory neuron',
|
|
56
|
+
children: [
|
|
57
|
+
{
|
|
58
|
+
name: 'Retinal bipolar neuron',
|
|
59
|
+
set: [
|
|
60
|
+
['cell_4', null],
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
it('dataToCellSetsTree creates a flat tree from a single column', async () => {
|
|
73
|
+
const data = [
|
|
74
|
+
[
|
|
75
|
+
['cell_1', 'cell_2', 'cell_3', 'cell_4'],
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
['Immune', 'Immune', 'Immune', 'Neuron'],
|
|
79
|
+
],
|
|
80
|
+
[undefined],
|
|
81
|
+
];
|
|
82
|
+
const options = [
|
|
83
|
+
{ name: 'Subclass Level 1', path: 'obs/L1' },
|
|
84
|
+
];
|
|
85
|
+
const tree = dataToCellSetsTree(data, options);
|
|
86
|
+
expect(tree).toEqual({
|
|
87
|
+
version: '0.1.3',
|
|
88
|
+
datatype: 'obs',
|
|
89
|
+
tree: [
|
|
90
|
+
{
|
|
91
|
+
name: 'Subclass Level 1',
|
|
92
|
+
children: [
|
|
93
|
+
{
|
|
94
|
+
name: 'Immune',
|
|
95
|
+
set: [
|
|
96
|
+
['cell_1', null],
|
|
97
|
+
['cell_2', null],
|
|
98
|
+
['cell_3', null],
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'Neuron',
|
|
103
|
+
set: [
|
|
104
|
+
['cell_4', null],
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
it('dataToCellSetsTree creates a flat tree from a single column with scores', async () => {
|
|
113
|
+
const data = [
|
|
114
|
+
[
|
|
115
|
+
['cell_1', 'cell_2', 'cell_3', 'cell_4'],
|
|
116
|
+
],
|
|
117
|
+
[
|
|
118
|
+
['Immune', 'Immune', 'Immune', 'Neuron'],
|
|
119
|
+
],
|
|
120
|
+
[
|
|
121
|
+
[0.25, 0.5, 0.6, 0.1],
|
|
122
|
+
],
|
|
123
|
+
];
|
|
124
|
+
const options = [
|
|
125
|
+
{ name: 'Subclass Level 1', path: 'obs/L1' },
|
|
126
|
+
];
|
|
127
|
+
const tree = dataToCellSetsTree(data, options);
|
|
128
|
+
expect(tree).toEqual({
|
|
129
|
+
version: '0.1.3',
|
|
130
|
+
datatype: 'obs',
|
|
131
|
+
tree: [
|
|
132
|
+
{
|
|
133
|
+
name: 'Subclass Level 1',
|
|
134
|
+
children: [
|
|
135
|
+
{
|
|
136
|
+
name: 'Immune',
|
|
137
|
+
set: [
|
|
138
|
+
['cell_1', 0.25],
|
|
139
|
+
['cell_2', 0.5],
|
|
140
|
+
['cell_3', 0.6],
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'Neuron',
|
|
145
|
+
set: [
|
|
146
|
+
['cell_4', 0.1],
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
});
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the set associated with a particular node.
|
|
3
|
+
* Recursive.
|
|
4
|
+
* @param {object} currNode A node object.
|
|
5
|
+
* @returns {array} The array representing the set associated with the node.
|
|
6
|
+
*/
|
|
7
|
+
export function nodeToSet(currNode: object): array;
|
|
8
|
+
/**
|
|
9
|
+
* Get the height of a node (the number of levels to reach a leaf).
|
|
10
|
+
* @param {object} currNode A node object.
|
|
11
|
+
* @param {number} level The level that the height will be computed relative to. By default, 0.
|
|
12
|
+
* @returns {number} The height. If the node has a .children property,
|
|
13
|
+
* then the minimum value returned is 1.
|
|
14
|
+
*/
|
|
15
|
+
export function nodeToHeight(currNode: object, level?: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Get the size associated with a particular node.
|
|
18
|
+
* Recursive.
|
|
19
|
+
* @param {object} currNode A node object.
|
|
20
|
+
* @returns {number} The length of all the node's children
|
|
21
|
+
*/
|
|
22
|
+
export function getNodeLength(currNode: object): number;
|
|
23
|
+
/**
|
|
24
|
+
* Find a node with a matching name path, relative to the whole tree.
|
|
25
|
+
* @param {object} currTree A tree object.
|
|
26
|
+
* @param {string[]} targetNamePath The name path for the node of interest.
|
|
27
|
+
* @returns {object|null} A matching node object, or null if none is found.
|
|
28
|
+
*/
|
|
29
|
+
export function treeFindNodeByNamePath(currTree: object, targetNamePath: string[]): object | null;
|
|
30
|
+
/**
|
|
31
|
+
* Transform a node object using a transform function.
|
|
32
|
+
* @param {object} node A node object.
|
|
33
|
+
* @param {function} predicate Returns true if a node matches a condition of interest.
|
|
34
|
+
* @param {function} transform Takes the node matching the predicate as input, returns
|
|
35
|
+
* a transformed version of the node.
|
|
36
|
+
* @param {array} transformedPaths This array parameter is mutated. The path of
|
|
37
|
+
* each transformed node is appended to this array.
|
|
38
|
+
* @param {string[]} The current path of the node being updated, used internally
|
|
39
|
+
* during recursion.
|
|
40
|
+
* @returns {object} The updated node.
|
|
41
|
+
*/
|
|
42
|
+
export function nodeTransform(node: object, predicate: Function, transform: Function, transformedPaths: array, currPath: any): object;
|
|
43
|
+
/**
|
|
44
|
+
* Transform many node objects using a transform function.
|
|
45
|
+
* @param {object} node A node object.
|
|
46
|
+
* @param {function} predicate Returns true if a node matches a condition of interest.
|
|
47
|
+
* @param {function} transform Takes the node matching the predicate as input, returns
|
|
48
|
+
* a transformed version of the node.
|
|
49
|
+
* @param {array} transformedPaths This array parameter is mutated. The path of
|
|
50
|
+
* each transformed node is appended to this array.
|
|
51
|
+
* @param {string[]} The current path of the node being updated, used internally
|
|
52
|
+
* during recursion.
|
|
53
|
+
* @returns {object} The updated node.
|
|
54
|
+
*/
|
|
55
|
+
export function nodeTransformAll(node: object, predicate: Function, transform: Function, transformedPaths: array, currPath: any): object;
|
|
56
|
+
/**
|
|
57
|
+
* Append a child to a parent node.
|
|
58
|
+
* @param {object} currNode A node object.
|
|
59
|
+
* @param {object} newChild The child node object.
|
|
60
|
+
* @returns {object} The updated node.
|
|
61
|
+
*/
|
|
62
|
+
export function nodeAppendChild(currNode: object, newChild: object): object;
|
|
63
|
+
/**
|
|
64
|
+
* Prepend a child to a parent node.
|
|
65
|
+
* @param {object} currNode A node object.
|
|
66
|
+
* @param {object} newChild The child node object.
|
|
67
|
+
* @returns {object} The updated node.
|
|
68
|
+
*/
|
|
69
|
+
export function nodePrependChild(currNode: object, newChild: object): object;
|
|
70
|
+
/**
|
|
71
|
+
* Insert a child to a parent node.
|
|
72
|
+
* @param {object} currNode A node object.
|
|
73
|
+
* @param {*} newChild The child node object.
|
|
74
|
+
* @param {*} insertIndex The index at which to insert the child.
|
|
75
|
+
* @returns {object} The updated node.
|
|
76
|
+
*/
|
|
77
|
+
export function nodeInsertChild(currNode: object, newChild: any, insertIndex: any): object;
|
|
78
|
+
/**
|
|
79
|
+
* Get an array representing the union of the sets of checked nodes.
|
|
80
|
+
* @param {object} currTree A tree object.
|
|
81
|
+
* @returns {array} An array representing the union of the sets of checked nodes.
|
|
82
|
+
*/
|
|
83
|
+
export function treeToUnion(currTree: object, checkedPaths: any): array;
|
|
84
|
+
/**
|
|
85
|
+
* Get an array representing the intersection of the sets of checked nodes.
|
|
86
|
+
* @param {object} currTree A tree object.
|
|
87
|
+
* @returns {array} An array representing the intersection of the sets of checked nodes.
|
|
88
|
+
*/
|
|
89
|
+
export function treeToIntersection(currTree: object, checkedPaths: any): array;
|
|
90
|
+
/**
|
|
91
|
+
* Get an array representing the complement of the union of the sets of checked nodes.
|
|
92
|
+
* @param {object} currTree
|
|
93
|
+
* @returns {array} An array representing the complement of the
|
|
94
|
+
* union of the sets of checked nodes.
|
|
95
|
+
*/
|
|
96
|
+
export function treeToComplement(currTree: object, checkedPaths: any, items: any): array;
|
|
97
|
+
/**
|
|
98
|
+
* Get an flattened array of descendants at a particular relative
|
|
99
|
+
* level of interest.
|
|
100
|
+
* @param {object} node A node object.
|
|
101
|
+
* @param {number} level The relative level of interest.
|
|
102
|
+
* 0 for this node's children, 1 for grandchildren, etc.
|
|
103
|
+
* @param {boolean} stopEarly Should a node be returned early if no children exist?
|
|
104
|
+
* @returns {object[]} An array of descendants at the specified level,
|
|
105
|
+
* where the level is relative to the node.
|
|
106
|
+
*/
|
|
107
|
+
export function nodeToLevelDescendantNamePaths(node: object, level: number, prevPath: any, stopEarly?: boolean): object[];
|
|
108
|
+
/**
|
|
109
|
+
* Export the tree by clearing tree state and all node states.
|
|
110
|
+
* @param {object} currTree A tree object.
|
|
111
|
+
* @returns {object} Tree object with tree and node state removed.
|
|
112
|
+
*/
|
|
113
|
+
export function treeExport(currTree: object, datatype: any): object;
|
|
114
|
+
/**
|
|
115
|
+
* Export the tree by clearing tree state and all node states,
|
|
116
|
+
* and filter so that only the level zero node of interest is included.
|
|
117
|
+
* @param {object} currTree A tree object.
|
|
118
|
+
* @param {string} nodePath The path of the node of interest.
|
|
119
|
+
* @param {string} dataType Datatype (i.e cell sets)
|
|
120
|
+
* @param {Array} cellSetColors Array of objects of cell set colors and paths
|
|
121
|
+
* @param {string} theme "light" or "dark" for the vitessce theme
|
|
122
|
+
* @returns {object} { treeToExport, nodeName }
|
|
123
|
+
* Tree with one level zero node, and with state removed.
|
|
124
|
+
*/
|
|
125
|
+
export function treeExportLevelZeroNode(currTree: object, nodePath: string, datatype: any, cellSetColors: any[], theme: string): object;
|
|
126
|
+
/**
|
|
127
|
+
* Prepare the set of a node of interest for export.
|
|
128
|
+
* @param {object} currTree A tree object.
|
|
129
|
+
* @param {string} nodeKey The key of the node of interest.
|
|
130
|
+
* @returns {object} { setToExport, nodeName } The set as an array.
|
|
131
|
+
*/
|
|
132
|
+
export function treeExportSet(currTree: object, nodePath: any): object;
|
|
133
|
+
/**
|
|
134
|
+
* Get an empty tree, with a default tree state.
|
|
135
|
+
* @param {string} datatype The type of sets that this tree contains.
|
|
136
|
+
* @returns {object} Empty tree.
|
|
137
|
+
*/
|
|
138
|
+
export function treeInitialize(datatype: string): object;
|
|
139
|
+
/**
|
|
140
|
+
* For convenience, get an object with information required
|
|
141
|
+
* to render a node as a component.
|
|
142
|
+
* @param {object} node A node to be rendered.
|
|
143
|
+
* @returns {object} An object containing properties required
|
|
144
|
+
* by the TreeNode render functions.
|
|
145
|
+
*/
|
|
146
|
+
export function nodeToRenderProps(node: object, path: any, cellSetColor: any): object;
|
|
147
|
+
/**
|
|
148
|
+
* Given a tree with state, get the cellIds and cellColors,
|
|
149
|
+
* based on the nodes currently marked as "visible".
|
|
150
|
+
* @param {object} currTree A tree object.
|
|
151
|
+
* @param {array} selectedNamePaths Array of arrays of strings,
|
|
152
|
+
* representing set "paths".
|
|
153
|
+
* @param {object[]} cellSetColor Array of objects with the
|
|
154
|
+
* properties `path` and `color`.
|
|
155
|
+
* @param {string} theme "light" or "dark" for the vitessce theme
|
|
156
|
+
* @returns {array} Tuple of [cellIds, cellColors]
|
|
157
|
+
* where cellIds is an array of strings,
|
|
158
|
+
* and cellColors is an object mapping cellIds to color [r,g,b] arrays.
|
|
159
|
+
*/
|
|
160
|
+
export function treeToCellColorsBySetNames(currTree: object, selectedNamePaths: array, cellSetColor: object[], theme: string): array;
|
|
161
|
+
/**
|
|
162
|
+
* Given a tree with state, get an array of
|
|
163
|
+
* objects with cellIds and cellColors,
|
|
164
|
+
* based on the nodes currently marked as "visible".
|
|
165
|
+
* @param {object} currTree A tree object.
|
|
166
|
+
* @param {array} selectedNamePaths Array of arrays of strings,
|
|
167
|
+
* representing set "paths".
|
|
168
|
+
* @param {object[]} setColor Array of objects with the
|
|
169
|
+
* properties `path` and `color`
|
|
170
|
+
* @param {string} theme "light" or "dark" for the vitessce theme.
|
|
171
|
+
* @returns {object[]} Array of objects with properties
|
|
172
|
+
* `obsId`, `name`, and `color`.
|
|
173
|
+
*/
|
|
174
|
+
export function treeToObjectsBySetNames(currTree: object, selectedNamePaths: array, setColor: object[], theme: string): object[];
|
|
175
|
+
export function treeToCellPolygonsBySetNames(currTree: any, obsIndex: any, obsEmbedding: any, selectedNamePaths: any, cellSetColor: any, theme: any): any[];
|
|
176
|
+
/**
|
|
177
|
+
* Given a tree with state, get the sizes of the
|
|
178
|
+
* sets currently marked as "visible".
|
|
179
|
+
* @param {object} currTree A tree object.
|
|
180
|
+
* @param {array} allNamePaths Array of all paths.
|
|
181
|
+
* @param {array} selectedNamePaths Array of arrays of strings,
|
|
182
|
+
* representing selected paths.
|
|
183
|
+
* @param {object[]} setColor Array of objects with the
|
|
184
|
+
* properties `path` and `color`.
|
|
185
|
+
* @param {string} theme "light" or "dark" for the vitessce theme
|
|
186
|
+
* @returns {object[]} Array of objects
|
|
187
|
+
* with the properties `name`, `size`, `key`,
|
|
188
|
+
* and `color`.
|
|
189
|
+
*/
|
|
190
|
+
export function treeToSetSizesBySetNames(currTree: object, allNamePaths: array, selectedNamePaths: array, setColor: object[], theme: string): object[];
|
|
191
|
+
/**
|
|
192
|
+
* Find and remove a node from the descendants of the current node.
|
|
193
|
+
* @param {object} node A node to search on.
|
|
194
|
+
* @param {array} prevPath Path of the current node to be searched.
|
|
195
|
+
* @param {array} filterPath The path sought.
|
|
196
|
+
* @returns {object} A new node without a node at filterPath.
|
|
197
|
+
*/
|
|
198
|
+
export function filterNode(node: object, prevPath: array, filterPath: array): object;
|
|
199
|
+
export function treeToExpectedCheckedLevel(currTree: any, checkedPaths: any): null;
|
|
200
|
+
export function treesConflict(cellSets: any, testCellSets: any): boolean;
|
|
201
|
+
export function initializeCellSetColor(cellSets: any, cellSetColor: any): any[];
|
|
202
|
+
export function getCellSetPolygons(params: any): any[];
|
|
203
|
+
export function treeToMembershipMap(currTree: any): Map<any, any>;
|
|
204
|
+
//# sourceMappingURL=cell-set-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cell-set-utils.d.ts","sourceRoot":"","sources":["../src/cell-set-utils.js"],"names":[],"mappings":"AAoBA;;;;;GAKG;AACH,oCAHW,MAAM,SAWhB;AAED;;;;;;GAMG;AACH,uCALW,MAAM,UACN,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;GAKG;AACH,wCAHW,MAAM,GACJ,MAAM,CAUlB;AA2BD;;;;;GAKG;AACH,iDAJW,MAAM,kBACN,MAAM,EAAE,GACN,MAAM,GAAC,IAAI,CAUvB;AAED;;;;;;;;;;;GAWG;AACH,oCAVW,MAAM,qFAQJ,MAAM,CAwBlB;AAED;;;;;;;;;;;GAWG;AACH,uCAVW,MAAM,qFAQJ,MAAM,CAyBlB;AAED;;;;;GAKG;AACH,0CAJW,MAAM,YACN,MAAM,GACJ,MAAM,CAOlB;AAED;;;;;GAKG;AACH,2CAJW,MAAM,YACN,MAAM,GACJ,MAAM,CAOlB;AAED;;;;;;GAMG;AACH,0CALW,MAAM,oCAGJ,MAAM,CASlB;AAED;;;;GAIG;AACH,sCAHW,MAAM,4BAQhB;AAED;;;;GAIG;AACH,6CAHW,MAAM,4BAQhB;AAED;;;;;GAKG;AACH,2CAJW,MAAM,wCAOhB;AAED;;;;;;;;;GASG;AACH,qDAPW,MAAM,SACN,MAAM,6BAEN,OAAO,GACL,MAAM,EAAE,CAgBpB;AAED;;;;GAIG;AACH,qCAHW,MAAM,kBACJ,MAAM,CAQlB;AAED;;;;;;;;;;GAUG;AACH,kDARW,MAAM,YACN,MAAM,8CAGN,MAAM,GACJ,MAAM,CAqBlB;AAED;;;;;GAKG;AACH,wCAJW,MAAM,kBAEJ,MAAM,CAKlB;AAED;;;;GAIG;AACH,yCAHW,MAAM,GACJ,MAAM,CAQlB;AAED;;;;;;GAMG;AACH,wCAJW,MAAM,iCACJ,MAAM,CAelB;AAoBD;;;;;;;;;;;;GAYG;AACH,qDAVW,MAAM,0CAGN,MAAM,EAAE,SAER,MAAM,SAyBhB;AAED;;;;;;;;;;;;GAYG;AACH,kDATW,MAAM,sCAGN,MAAM,EAAE,SAER,MAAM,GACJ,MAAM,EAAE,CAsBpB;AAED,4JA2CC;AAED;;;;;;;;;;;;;GAaG;AACH,mDAXW,MAAM,2DAIN,MAAM,EAAE,SAER,MAAM,GACJ,MAAM,EAAE,CAuCpB;AAED;;;;;;GAMG;AACH,iCALW,MAAM,uCAGJ,MAAM,CAelB;AAED,mFAgBC;AAED,yEA2BC;AAED,gFA6BC;AAED,uDAeC;AAED,kEA0BC"}
|