@weng-lab/genomebrowser-ui 0.4.0-beta.2 → 0.4.1
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/TrackSelect/Folders/biosamples/data/{human_with_wgbs.json.d.ts → humans_fixed.json.d.ts} +511 -511
- package/dist/TrackSelect/Folders/biosamples/shared/types.d.ts +1 -1
- package/dist/TrackSelect/Folders/index.d.ts +2 -0
- package/dist/TrackSelect/Folders/psychscreen/data/human.json.d.ts +815 -0
- package/dist/TrackSelect/Folders/psychscreen/human.d.ts +1 -0
- package/dist/TrackSelect/Folders/psychscreen/shared/PsychscreenGroupingCell.d.ts +2 -0
- package/dist/TrackSelect/Folders/psychscreen/shared/columns.d.ts +7 -0
- package/dist/TrackSelect/Folders/psychscreen/shared/createFolder.d.ts +9 -0
- package/dist/TrackSelect/Folders/psychscreen/shared/toTrack.d.ts +5 -0
- package/dist/TrackSelect/Folders/psychscreen/shared/types.d.ts +12 -0
- package/dist/TrackSelect/trackContext.d.ts +2 -1
- package/dist/TrackSelect/types.d.ts +1 -1
- package/dist/genomebrowser-ui.es.js +1408 -1263
- package/dist/genomebrowser-ui.es.js.map +1 -1
- package/package.json +4 -3
- package/src/TrackSelect/DataGrid/DataGridWrapper.tsx +9 -5
- package/src/TrackSelect/Folders/biosamples/data/fix-human-collections.mjs +119 -0
- package/src/TrackSelect/Folders/biosamples/data/humans_fixed.json +59909 -0
- package/src/TrackSelect/Folders/biosamples/human.ts +1 -1
- package/src/TrackSelect/Folders/biosamples/shared/columns.tsx +2 -2
- package/src/TrackSelect/Folders/biosamples/shared/types.ts +1 -1
- package/src/TrackSelect/Folders/index.ts +4 -0
- package/src/TrackSelect/Folders/psychscreen/data/human.json +812 -0
- package/src/TrackSelect/Folders/psychscreen/human.ts +10 -0
- package/src/TrackSelect/Folders/psychscreen/shared/PsychscreenGroupingCell.tsx +78 -0
- package/src/TrackSelect/Folders/psychscreen/shared/columns.tsx +52 -0
- package/src/TrackSelect/Folders/psychscreen/shared/createFolder.ts +45 -0
- package/src/TrackSelect/Folders/psychscreen/shared/toTrack.ts +48 -0
- package/src/TrackSelect/Folders/psychscreen/shared/types.ts +14 -0
- package/src/TrackSelect/TreeView/CustomTreeItem.tsx +10 -2
- package/src/TrackSelect/TreeView/TreeViewWrapper.tsx +4 -1
- package/src/TrackSelect/trackContext.ts +2 -0
- package/src/TrackSelect/types.ts +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weng-lab/genomebrowser-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"publishConfig": {
|
|
@@ -23,13 +23,14 @@
|
|
|
23
23
|
"@mui/x-data-grid-premium": "^8.19.0",
|
|
24
24
|
"react": "^19.0.0",
|
|
25
25
|
"react-dom": "^19.0.0",
|
|
26
|
-
"@weng-lab/genomebrowser": "1.8.5
|
|
26
|
+
"@weng-lab/genomebrowser": "1.8.5"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@eslint/js": "^9.34.0",
|
|
30
30
|
"@types/node": "^24.3.1",
|
|
31
31
|
"@types/react": "^19.1.12",
|
|
32
32
|
"@types/react-dom": "^19.1.9",
|
|
33
|
+
"@typescript/native-preview": "7.0.0-dev.20260421.2",
|
|
33
34
|
"@vitejs/plugin-react": "^4.7.0",
|
|
34
35
|
"eslint": "^9.34.0",
|
|
35
36
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
45
46
|
"dev": "vite",
|
|
46
|
-
"build": "
|
|
47
|
+
"build": "tsgo -b && vite build",
|
|
47
48
|
"lint": "eslint .",
|
|
48
49
|
"test": "vitest run",
|
|
49
50
|
"preview": "vite preview",
|
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
GridAutosizeOptions,
|
|
6
6
|
GridColDef,
|
|
7
7
|
GridColumnVisibilityModel,
|
|
8
|
+
GridRenderCellParams,
|
|
9
|
+
GridRowSelectionModel,
|
|
8
10
|
useGridApiRef,
|
|
9
11
|
} from "@mui/x-data-grid-premium";
|
|
10
12
|
import { useEffect, useMemo, useState } from "react";
|
|
@@ -88,7 +90,7 @@ export function DataGridWrapper(props: DataGridProps) {
|
|
|
88
90
|
apiRef={apiRef}
|
|
89
91
|
rows={rows}
|
|
90
92
|
columns={columns}
|
|
91
|
-
getRowId={(row) => row.id}
|
|
93
|
+
getRowId={(row: { id: string }) => row.id}
|
|
92
94
|
autosizeOptions={autosizeOptions}
|
|
93
95
|
rowGroupingModel={groupingModel}
|
|
94
96
|
groupingColDef={{
|
|
@@ -97,13 +99,15 @@ export function DataGridWrapper(props: DataGridProps) {
|
|
|
97
99
|
minWidth: 300,
|
|
98
100
|
maxWidth: 500,
|
|
99
101
|
flex: 2,
|
|
100
|
-
renderCell: (params) =>
|
|
102
|
+
renderCell: (params: GridRenderCellParams) => (
|
|
103
|
+
<GroupingCell {...params} />
|
|
104
|
+
),
|
|
101
105
|
}}
|
|
102
106
|
columnVisibilityModel={columnVisibilityModel}
|
|
103
107
|
onColumnVisibilityModelChange={setColumnVisibilityModel}
|
|
104
|
-
onRowSelectionModelChange={(selection) => {
|
|
105
|
-
const ids =
|
|
106
|
-
onSelectionChange(new Set(ids));
|
|
108
|
+
onRowSelectionModelChange={(selection: GridRowSelectionModel) => {
|
|
109
|
+
const ids = selection.ids ?? new Set<string>();
|
|
110
|
+
onSelectionChange(new Set([...ids].map(String)));
|
|
107
111
|
}}
|
|
108
112
|
rowSelectionPropagation={{ descendants: true, parents: false }}
|
|
109
113
|
disableRowGrouping={false}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const inputPath = join(__dirname, "human_with_wgbs.json");
|
|
7
|
+
const outputPath = join(__dirname, "humans_fixed.json");
|
|
8
|
+
|
|
9
|
+
const expectedCounts = {
|
|
10
|
+
Core: 170,
|
|
11
|
+
Partial: 1155,
|
|
12
|
+
Ancillary: 562,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const counts = {
|
|
16
|
+
Core: 0,
|
|
17
|
+
Partial: 0,
|
|
18
|
+
Ancillary: 0,
|
|
19
|
+
NA: 0,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const specialCases = {
|
|
23
|
+
GM12866_ENCDO000ABQ: "NA",
|
|
24
|
+
neural_crest_cell_ENCDO222AAA: "Partial",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const specialCaseFound = Object.fromEntries(
|
|
28
|
+
Object.keys(specialCases).map((name) => [name, false]),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
function classifyTrack(track) {
|
|
32
|
+
const specialCollection = specialCases[track.name];
|
|
33
|
+
if (specialCollection) {
|
|
34
|
+
specialCaseFound[track.name] = true;
|
|
35
|
+
return specialCollection;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const assays = new Set(
|
|
39
|
+
track.assays.map((assay) => assay.assay.toLowerCase()),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (!assays.has("dnase")) {
|
|
43
|
+
return "Ancillary";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (
|
|
47
|
+
assays.has("h3k4me3") &&
|
|
48
|
+
assays.has("h3k27ac") &&
|
|
49
|
+
assays.has("ctcf")
|
|
50
|
+
) {
|
|
51
|
+
return "Core";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return "Partial";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function isAggregate(track) {
|
|
58
|
+
return track.name === "aggregate-biosample-data" || track.ontology === "aggregate";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function validateCounts() {
|
|
62
|
+
const mismatches = Object.entries(expectedCounts).filter(
|
|
63
|
+
([collection, expected]) => counts[collection] !== expected,
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
if (mismatches.length === 0) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.error("Classification count validation failed.");
|
|
71
|
+
console.error("Expected:", expectedCounts);
|
|
72
|
+
console.error("Actual:", counts);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const input = JSON.parse(await readFile(inputPath, "utf8"));
|
|
77
|
+
const changes = [];
|
|
78
|
+
|
|
79
|
+
const fixedTracks = input.tracks.map((track) => {
|
|
80
|
+
const collection = classifyTrack(track);
|
|
81
|
+
|
|
82
|
+
if (!isAggregate(track)) {
|
|
83
|
+
counts[collection] += 1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (track.collection !== collection) {
|
|
87
|
+
changes.push({
|
|
88
|
+
name: track.name,
|
|
89
|
+
displayName: track.displayName,
|
|
90
|
+
from: track.collection,
|
|
91
|
+
to: collection,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
...track,
|
|
97
|
+
collection,
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
validateCounts();
|
|
102
|
+
|
|
103
|
+
await writeFile(
|
|
104
|
+
outputPath,
|
|
105
|
+
`${JSON.stringify({ ...input, tracks: fixedTracks }, null, 2)}\n`,
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
console.log("Wrote", outputPath);
|
|
109
|
+
console.log("Counts excluding aggregate:", counts);
|
|
110
|
+
console.log("Changed tracks:", changes.length);
|
|
111
|
+
console.log("Special cases found:", specialCaseFound);
|
|
112
|
+
|
|
113
|
+
const changeCounts = changes.reduce((acc, change) => {
|
|
114
|
+
const key = `${change.from} -> ${change.to}`;
|
|
115
|
+
acc[key] = (acc[key] ?? 0) + 1;
|
|
116
|
+
return acc;
|
|
117
|
+
}, {});
|
|
118
|
+
|
|
119
|
+
console.log("Change counts:", changeCounts);
|