@weng-lab/genomebrowser-ui 0.2.0 → 0.2.2

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.
Files changed (57) hide show
  1. package/.env.local +1 -1
  2. package/dist/TrackSelect/Dialogs/ClearDialog.d.ts +9 -0
  3. package/dist/TrackSelect/Dialogs/LimitDialog.d.ts +7 -0
  4. package/dist/TrackSelect/Dialogs/ResetDialog.d.ts +7 -0
  5. package/dist/TrackSelect/Folders/biosamples/data/human.json.d.ts +57141 -57141
  6. package/dist/TrackSelect/Folders/biosamples/data/mouse.json.d.ts +10394 -10394
  7. package/dist/TrackSelect/Folders/genes/data/human.json.d.ts +7 -7
  8. package/dist/TrackSelect/Folders/genes/data/mouse.json.d.ts +7 -7
  9. package/dist/genomebrowser-ui.es.js +736 -652
  10. package/dist/genomebrowser-ui.es.js.map +1 -1
  11. package/eslint.config.js +30 -30
  12. package/index.html +14 -14
  13. package/package.json +2 -1
  14. package/src/TrackSelect/DataGrid/DataGridWrapper.tsx +137 -137
  15. package/src/TrackSelect/DataGrid/DefaultGroupingCell.tsx +64 -64
  16. package/src/TrackSelect/Dialogs/ClearDialog.tsx +63 -0
  17. package/src/TrackSelect/Dialogs/LimitDialog.tsx +33 -0
  18. package/src/TrackSelect/Dialogs/ResetDialog.tsx +43 -0
  19. package/src/TrackSelect/FolderList/Breadcrumb.tsx +38 -38
  20. package/src/TrackSelect/FolderList/FolderCard.tsx +51 -51
  21. package/src/TrackSelect/FolderList/FolderList.tsx +47 -47
  22. package/src/TrackSelect/Folders/NEW.md +929 -929
  23. package/src/TrackSelect/Folders/biosamples/data/formatBiosamples.go +254 -254
  24. package/src/TrackSelect/Folders/biosamples/data/human.json +57141 -57141
  25. package/src/TrackSelect/Folders/biosamples/data/mouse.json +10394 -10394
  26. package/src/TrackSelect/Folders/biosamples/human.ts +17 -17
  27. package/src/TrackSelect/Folders/biosamples/mouse.ts +17 -17
  28. package/src/TrackSelect/Folders/biosamples/shared/AssayToggle.tsx +78 -78
  29. package/src/TrackSelect/Folders/biosamples/shared/BiosampleGroupingCell.tsx +146 -146
  30. package/src/TrackSelect/Folders/biosamples/shared/BiosampleTreeItem.tsx +15 -15
  31. package/src/TrackSelect/Folders/biosamples/shared/columns.tsx +165 -165
  32. package/src/TrackSelect/Folders/biosamples/shared/constants.tsx +116 -116
  33. package/src/TrackSelect/Folders/biosamples/shared/createFolder.ts +116 -116
  34. package/src/TrackSelect/Folders/biosamples/shared/treeBuilder.ts +224 -224
  35. package/src/TrackSelect/Folders/biosamples/shared/types.ts +48 -48
  36. package/src/TrackSelect/Folders/genes/data/human.json +7 -7
  37. package/src/TrackSelect/Folders/genes/data/mouse.json +7 -7
  38. package/src/TrackSelect/Folders/genes/human.ts +16 -16
  39. package/src/TrackSelect/Folders/genes/mouse.ts +16 -16
  40. package/src/TrackSelect/Folders/genes/shared/columns.tsx +42 -42
  41. package/src/TrackSelect/Folders/genes/shared/createFolder.ts +68 -68
  42. package/src/TrackSelect/Folders/genes/shared/treeBuilder.ts +45 -45
  43. package/src/TrackSelect/Folders/genes/shared/types.ts +29 -29
  44. package/src/TrackSelect/Folders/index.ts +30 -30
  45. package/src/TrackSelect/Folders/types.ts +106 -106
  46. package/src/TrackSelect/TrackSelect.tsx +82 -74
  47. package/src/TrackSelect/TreeView/CustomTreeItem.tsx +214 -214
  48. package/src/TrackSelect/TreeView/TreeViewWrapper.tsx +145 -145
  49. package/src/TrackSelect/store.ts +117 -117
  50. package/src/TrackSelect/types.ts +121 -121
  51. package/src/lib.ts +13 -13
  52. package/src/vite-env.d.ts +1 -1
  53. package/test/main.tsx +369 -369
  54. package/tsconfig.app.json +25 -25
  55. package/tsconfig.json +7 -7
  56. package/tsconfig.node.json +25 -25
  57. package/vite.config.ts +66 -66
@@ -1,165 +1,165 @@
1
- import { GridColDef } from "@mui/x-data-grid-premium";
2
- import { Stack, capitalize } from "@mui/material";
3
- import { AssayIcon, ontologyTypes, assayTypes } from "./constants";
4
- import { BiosampleRowInfo } from "./types";
5
-
6
- const displayNameCol: GridColDef<BiosampleRowInfo> = {
7
- field: "displayName",
8
- headerName: "Name",
9
- valueFormatter: (value) => value && capitalize(value),
10
- maxWidth: 300,
11
- };
12
-
13
- const sortedByAssayOntologyCol: GridColDef<BiosampleRowInfo> = {
14
- field: "ontology",
15
- headerName: "Ontology",
16
- type: "singleSelect",
17
- valueOptions: ontologyTypes,
18
- renderCell: (params) => {
19
- if (params.rowNode.type === "group") {
20
- if (params.value === undefined) {
21
- return null;
22
- }
23
- const val = params.value;
24
- return (
25
- <div>
26
- <b>{val}</b>
27
- </div>
28
- );
29
- }
30
- },
31
- };
32
-
33
- const sortedByAssayAssayCol: GridColDef<BiosampleRowInfo> = {
34
- field: "assay",
35
- headerName: "Assay",
36
- valueOptions: assayTypes,
37
- renderCell: (params) => {
38
- if (params.rowNode.type === "group") {
39
- if (params.value === undefined) {
40
- return null;
41
- }
42
- const val = params.value;
43
- return (
44
- <Stack direction="row" spacing={2} alignItems="center">
45
- {AssayIcon(val)}
46
- <div>
47
- <b>{val}</b>
48
- </div>
49
- </Stack>
50
- );
51
- }
52
- },
53
- };
54
-
55
- const defaultOntologyCol: GridColDef<BiosampleRowInfo> = {
56
- field: "ontology",
57
- headerName: "Ontology",
58
- type: "singleSelect",
59
- valueOptions: ontologyTypes,
60
- renderCell: (params) => {
61
- if (params.rowNode.type === "group") {
62
- if (params.value === undefined) {
63
- return null;
64
- }
65
- const val = params.value;
66
- return (
67
- <div>
68
- <b>{val}</b>
69
- </div>
70
- );
71
- }
72
- },
73
- };
74
-
75
- const defaultAssayCol: GridColDef<BiosampleRowInfo> = {
76
- field: "assay",
77
- headerName: "Assay",
78
- valueOptions: assayTypes,
79
- renderCell: (params) => {
80
- if (params.value === undefined) {
81
- return null;
82
- }
83
- const val = params.value;
84
- return (
85
- <Stack direction="row" spacing={2} alignItems="center" sx={{ ml: 6 }}>
86
- {AssayIcon(val)}
87
- <div>{val}</div>
88
- </Stack>
89
- );
90
- },
91
- };
92
-
93
- const sampleTypeCol: GridColDef<BiosampleRowInfo> = {
94
- field: "sampleType",
95
- headerName: "Sample Type",
96
- type: "singleSelect",
97
- valueOptions: [
98
- "aggregate",
99
- "tissue",
100
- "primary cell",
101
- "cell line",
102
- "in vitro differentiated cells",
103
- "organoid",
104
- ],
105
- valueFormatter: (value) => value && capitalize(value),
106
- };
107
-
108
- const lifeStageCol: GridColDef<BiosampleRowInfo> = {
109
- field: "lifeStage",
110
- headerName: "Life Stage",
111
- type: "singleSelect",
112
- valueOptions: ["adult", "embryonic", "N/A"],
113
- valueFormatter: (value) => value && capitalize(value),
114
- };
115
-
116
- const experimentCol: GridColDef<BiosampleRowInfo> = {
117
- field: "experimentAccession",
118
- headerName: "Experiment Accession",
119
- };
120
-
121
- const fileCol: GridColDef<BiosampleRowInfo> = {
122
- field: "fileAccession",
123
- headerName: "File Accession",
124
- };
125
-
126
- const idCol: GridColDef<BiosampleRowInfo> = {
127
- field: "id",
128
- headerName: "ID",
129
- };
130
-
131
- /** Columns for sorted-by-assay view (assay as top-level grouping) */
132
- export const sortedByAssayColumns: GridColDef<BiosampleRowInfo>[] = [
133
- displayNameCol,
134
- sortedByAssayOntologyCol,
135
- sampleTypeCol,
136
- lifeStageCol,
137
- sortedByAssayAssayCol,
138
- experimentCol,
139
- fileCol,
140
- idCol,
141
- ];
142
-
143
- /** Default columns (ontology as top-level grouping) */
144
- export const defaultColumns: GridColDef<BiosampleRowInfo>[] = [
145
- defaultAssayCol,
146
- sampleTypeCol,
147
- lifeStageCol,
148
- defaultOntologyCol,
149
- displayNameCol,
150
- experimentCol,
151
- fileCol,
152
- idCol,
153
- ];
154
-
155
- /** Grouping model for sorted-by-assay view */
156
- export const sortedByAssayGroupingModel = ["assay", "ontology"];
157
-
158
- /** Default grouping model (ontology-based) */
159
- export const defaultGroupingModel = ["ontology", "displayName"];
160
-
161
- /** Leaf field for sorted-by-assay view */
162
- export const sortedByAssayLeafField = "displayName";
163
-
164
- /** Default leaf field */
165
- export const defaultLeafField = "assay";
1
+ import { GridColDef } from "@mui/x-data-grid-premium";
2
+ import { Stack, capitalize } from "@mui/material";
3
+ import { AssayIcon, ontologyTypes, assayTypes } from "./constants";
4
+ import { BiosampleRowInfo } from "./types";
5
+
6
+ const displayNameCol: GridColDef<BiosampleRowInfo> = {
7
+ field: "displayName",
8
+ headerName: "Name",
9
+ valueFormatter: (value) => value && capitalize(value),
10
+ maxWidth: 300,
11
+ };
12
+
13
+ const sortedByAssayOntologyCol: GridColDef<BiosampleRowInfo> = {
14
+ field: "ontology",
15
+ headerName: "Ontology",
16
+ type: "singleSelect",
17
+ valueOptions: ontologyTypes,
18
+ renderCell: (params) => {
19
+ if (params.rowNode.type === "group") {
20
+ if (params.value === undefined) {
21
+ return null;
22
+ }
23
+ const val = params.value;
24
+ return (
25
+ <div>
26
+ <b>{val}</b>
27
+ </div>
28
+ );
29
+ }
30
+ },
31
+ };
32
+
33
+ const sortedByAssayAssayCol: GridColDef<BiosampleRowInfo> = {
34
+ field: "assay",
35
+ headerName: "Assay",
36
+ valueOptions: assayTypes,
37
+ renderCell: (params) => {
38
+ if (params.rowNode.type === "group") {
39
+ if (params.value === undefined) {
40
+ return null;
41
+ }
42
+ const val = params.value;
43
+ return (
44
+ <Stack direction="row" spacing={2} alignItems="center">
45
+ {AssayIcon(val)}
46
+ <div>
47
+ <b>{val}</b>
48
+ </div>
49
+ </Stack>
50
+ );
51
+ }
52
+ },
53
+ };
54
+
55
+ const defaultOntologyCol: GridColDef<BiosampleRowInfo> = {
56
+ field: "ontology",
57
+ headerName: "Ontology",
58
+ type: "singleSelect",
59
+ valueOptions: ontologyTypes,
60
+ renderCell: (params) => {
61
+ if (params.rowNode.type === "group") {
62
+ if (params.value === undefined) {
63
+ return null;
64
+ }
65
+ const val = params.value;
66
+ return (
67
+ <div>
68
+ <b>{val}</b>
69
+ </div>
70
+ );
71
+ }
72
+ },
73
+ };
74
+
75
+ const defaultAssayCol: GridColDef<BiosampleRowInfo> = {
76
+ field: "assay",
77
+ headerName: "Assay",
78
+ valueOptions: assayTypes,
79
+ renderCell: (params) => {
80
+ if (params.value === undefined) {
81
+ return null;
82
+ }
83
+ const val = params.value;
84
+ return (
85
+ <Stack direction="row" spacing={2} alignItems="center" sx={{ ml: 6 }}>
86
+ {AssayIcon(val)}
87
+ <div>{val}</div>
88
+ </Stack>
89
+ );
90
+ },
91
+ };
92
+
93
+ const sampleTypeCol: GridColDef<BiosampleRowInfo> = {
94
+ field: "sampleType",
95
+ headerName: "Sample Type",
96
+ type: "singleSelect",
97
+ valueOptions: [
98
+ "Aggregate",
99
+ "Tissue",
100
+ "Primary cell",
101
+ "Cell line",
102
+ "In vitro differentiated cells",
103
+ "Organoid",
104
+ ],
105
+ valueFormatter: (value) => value && capitalize(value),
106
+ };
107
+
108
+ const lifeStageCol: GridColDef<BiosampleRowInfo> = {
109
+ field: "lifeStage",
110
+ headerName: "Life Stage",
111
+ type: "singleSelect",
112
+ valueOptions: ["Adult", "Embryonic", "N/A"],
113
+ valueFormatter: (value) => value && capitalize(value),
114
+ };
115
+
116
+ const experimentCol: GridColDef<BiosampleRowInfo> = {
117
+ field: "experimentAccession",
118
+ headerName: "Experiment Accession",
119
+ };
120
+
121
+ const fileCol: GridColDef<BiosampleRowInfo> = {
122
+ field: "fileAccession",
123
+ headerName: "File Accession",
124
+ };
125
+
126
+ const idCol: GridColDef<BiosampleRowInfo> = {
127
+ field: "id",
128
+ headerName: "ID",
129
+ };
130
+
131
+ /** Columns for sorted-by-assay view (assay as top-level grouping) */
132
+ export const sortedByAssayColumns: GridColDef<BiosampleRowInfo>[] = [
133
+ displayNameCol,
134
+ sortedByAssayOntologyCol,
135
+ sampleTypeCol,
136
+ lifeStageCol,
137
+ sortedByAssayAssayCol,
138
+ experimentCol,
139
+ fileCol,
140
+ idCol,
141
+ ];
142
+
143
+ /** Default columns (ontology as top-level grouping) */
144
+ export const defaultColumns: GridColDef<BiosampleRowInfo>[] = [
145
+ defaultAssayCol,
146
+ sampleTypeCol,
147
+ lifeStageCol,
148
+ defaultOntologyCol,
149
+ displayNameCol,
150
+ experimentCol,
151
+ fileCol,
152
+ idCol,
153
+ ];
154
+
155
+ /** Grouping model for sorted-by-assay view */
156
+ export const sortedByAssayGroupingModel = ["assay", "ontology"];
157
+
158
+ /** Default grouping model (ontology-based) */
159
+ export const defaultGroupingModel = ["ontology", "displayName"];
160
+
161
+ /** Leaf field for sorted-by-assay view */
162
+ export const sortedByAssayLeafField = "displayName";
163
+
164
+ /** Default leaf field */
165
+ export const defaultLeafField = "assay";
@@ -1,116 +1,116 @@
1
- import { Box } from "@mui/material";
2
- import type { Assembly } from "../../types";
3
-
4
- export type { Assembly };
5
-
6
- export const assayTypes = [
7
- "cCRE",
8
- "DNase",
9
- "H3K4me3",
10
- "H3K27ac",
11
- "ATAC",
12
- "CTCF",
13
- "RNA-seq",
14
- "ChromHMM",
15
- ];
16
-
17
- export const ontologyTypes = [
18
- "Aggregate",
19
- "Adipose",
20
- "Adrenal gland",
21
- "Blood",
22
- "Blood vessel",
23
- "Bone",
24
- "Bone marrow",
25
- "Brain",
26
- "Breast",
27
- "Connective tissue",
28
- "Embryo",
29
- "Epithelium",
30
- "Esophagus",
31
- "Eye",
32
- "Fallopian Tube",
33
- "Gallbladder",
34
- "Heart",
35
- "Kidney",
36
- "Large Intestine",
37
- "Limb",
38
- "Liver",
39
- "Lung",
40
- "Lymphoid Tissue",
41
- "Muscle",
42
- "Mouth",
43
- "Nerve",
44
- "Nose",
45
- "Pancreas",
46
- "Parathyroid Gland",
47
- "Ovary",
48
- "Penis",
49
- "Placenta",
50
- "Prostate",
51
- "Skin",
52
- "Small Intestine",
53
- "Spinal Cord",
54
- "Spleen",
55
- "Stomach",
56
- "Testis",
57
- "Thymus",
58
- "Thyroid",
59
- "Urinary Bladder",
60
- "Uterus",
61
- "Vagina",
62
- ];
63
-
64
- /** Color mapping for assay types */
65
- export const assayColorMap: { [key: string]: string } = {
66
- DNase: "#06da93",
67
- ATAC: "#02c7b9",
68
- H3K4me3: "#ff2020",
69
- ChromHMM: "#0097a7",
70
- H3K27ac: "#fdc401",
71
- CTCF: "#01a6f1",
72
- cCRE: "#000000",
73
- "RNA-seq": "#00aa00",
74
- };
75
-
76
- /**
77
- * Creates the assay icon for DataGrid and RichTreeView
78
- * @param type - assay type
79
- * @returns an icon of the assay's respective color
80
- */
81
- export function AssayIcon(type: string) {
82
- const color = assayColorMap[type];
83
- return (
84
- <Box
85
- sx={{
86
- width: 12,
87
- height: 12,
88
- borderRadius: "20%",
89
- bgcolor: color,
90
- }}
91
- />
92
- );
93
- }
94
-
95
- /**
96
- * Mapping from JSON assay keys to display names.
97
- * This is the single source of truth for assay name formatting.
98
- */
99
- const assayJsonToDisplay: Record<string, string> = {
100
- dnase: "DNase",
101
- atac: "ATAC",
102
- h3k4me3: "H3K4me3",
103
- h3k27ac: "H3K27ac",
104
- ctcf: "CTCF",
105
- chromhmm: "ChromHMM",
106
- ccre: "cCRE",
107
- rnaseq: "RNA-seq",
108
- };
109
-
110
- /**
111
- * Convert JSON assay key to display name.
112
- * Used only during data loading to normalize assay names.
113
- */
114
- export function formatAssayType(jsonKey: string): string {
115
- return assayJsonToDisplay[jsonKey.toLowerCase()] ?? jsonKey;
116
- }
1
+ import { Box } from "@mui/material";
2
+ import type { Assembly } from "../../types";
3
+
4
+ export type { Assembly };
5
+
6
+ export const assayTypes = [
7
+ "cCRE",
8
+ "DNase",
9
+ "H3K4me3",
10
+ "H3K27ac",
11
+ "ATAC",
12
+ "CTCF",
13
+ "RNA-seq",
14
+ "ChromHMM",
15
+ ];
16
+
17
+ export const ontologyTypes = [
18
+ "Aggregate",
19
+ "Adipose",
20
+ "Adrenal gland",
21
+ "Blood",
22
+ "Blood vessel",
23
+ "Bone",
24
+ "Bone marrow",
25
+ "Brain",
26
+ "Breast",
27
+ "Connective tissue",
28
+ "Embryo",
29
+ "Epithelium",
30
+ "Esophagus",
31
+ "Eye",
32
+ "Fallopian Tube",
33
+ "Gallbladder",
34
+ "Heart",
35
+ "Kidney",
36
+ "Large Intestine",
37
+ "Limb",
38
+ "Liver",
39
+ "Lung",
40
+ "Lymphoid Tissue",
41
+ "Muscle",
42
+ "Mouth",
43
+ "Nerve",
44
+ "Nose",
45
+ "Pancreas",
46
+ "Parathyroid Gland",
47
+ "Ovary",
48
+ "Penis",
49
+ "Placenta",
50
+ "Prostate",
51
+ "Skin",
52
+ "Small Intestine",
53
+ "Spinal Cord",
54
+ "Spleen",
55
+ "Stomach",
56
+ "Testis",
57
+ "Thymus",
58
+ "Thyroid",
59
+ "Urinary Bladder",
60
+ "Uterus",
61
+ "Vagina",
62
+ ];
63
+
64
+ /** Color mapping for assay types */
65
+ export const assayColorMap: { [key: string]: string } = {
66
+ DNase: "#06da93",
67
+ ATAC: "#02c7b9",
68
+ H3K4me3: "#ff2020",
69
+ ChromHMM: "#0097a7",
70
+ H3K27ac: "#fdc401",
71
+ CTCF: "#01a6f1",
72
+ cCRE: "#000000",
73
+ "RNA-seq": "#00aa00",
74
+ };
75
+
76
+ /**
77
+ * Creates the assay icon for DataGrid and RichTreeView
78
+ * @param type - assay type
79
+ * @returns an icon of the assay's respective color
80
+ */
81
+ export function AssayIcon(type: string) {
82
+ const color = assayColorMap[type];
83
+ return (
84
+ <Box
85
+ sx={{
86
+ width: 12,
87
+ height: 12,
88
+ borderRadius: "20%",
89
+ bgcolor: color,
90
+ }}
91
+ />
92
+ );
93
+ }
94
+
95
+ /**
96
+ * Mapping from JSON assay keys to display names.
97
+ * This is the single source of truth for assay name formatting.
98
+ */
99
+ const assayJsonToDisplay: Record<string, string> = {
100
+ dnase: "DNase",
101
+ atac: "ATAC",
102
+ h3k4me3: "H3K4me3",
103
+ h3k27ac: "H3K27ac",
104
+ ctcf: "CTCF",
105
+ chromhmm: "ChromHMM",
106
+ ccre: "cCRE",
107
+ rnaseq: "RNA-seq",
108
+ };
109
+
110
+ /**
111
+ * Convert JSON assay key to display name.
112
+ * Used only during data loading to normalize assay names.
113
+ */
114
+ export function formatAssayType(jsonKey: string): string {
115
+ return assayJsonToDisplay[jsonKey.toLowerCase()] ?? jsonKey;
116
+ }