ciesm-prism 1.0.1359 → 1.0.1363
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/data/tutorials/index.json +10 -0
- package/data/tutorials/medsea-temperature.json +123 -0
- package/package.json +2 -4
- package/plugins/metacube/MGS.2.GUI.js +147 -44
- package/plugins/metacube/MGS.2.js +3 -0
- package/plugins/metacube/index.js +33 -12
- package/plugins/metacube/mc-outline.js +239 -0
- package/plugins/metacube/plugin.js +2 -0
- package/prism-app.html +22 -28
- package/src/app/Panels.js +6 -1
- package/src/app/Prism.js +34 -1
- package/src/history/ProjectHistory.js +49 -7
- package/src/tutorial/Tutorial.js +275 -0
- package/src/tutorial/TutorialPlayer.js +1077 -0
- package/src/tutorial/TutorialWindow.js +225 -0
- package/src/ui/components/ControlFactory.js +14 -0
- package/src/ui/components/MenuBar.js +5 -2
- package/src/ui/panels/HistoryPanel.js +14 -2
- package/src/ui/panels/OutlinerPanel.js +48 -6
- package/src/ui/panels/SpinoffPanel.js +4 -1
- package/src/ui/styles/main.css +124 -0
- package/src/version.json +3 -3
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "prism-tutorial/v1",
|
|
3
|
+
"title": "MEDSEA Temperature: opacity, colours, clipping",
|
|
4
|
+
"start": { "example": "medsea-temperature" },
|
|
5
|
+
"intro": "The Mediterranean Sea temperature of the CMEMS reanalysis as 3-D volumes. Where to select a volume, change its opacity and its colour ramp, and cut it with the geographic clipping.",
|
|
6
|
+
"end": "Each volume has its controls in Visualization Controls once its row is selected in the Outliner. Edit > Undo takes these steps back one by one.",
|
|
7
|
+
"steps": [
|
|
8
|
+
{
|
|
9
|
+
"id": "s1",
|
|
10
|
+
"kind": "eye",
|
|
11
|
+
"label": "Hide MEDSEA Daily Temperature (2024-2025)",
|
|
12
|
+
"rows": [
|
|
13
|
+
{
|
|
14
|
+
"id": "01a24b50-5c38-73be-a7c7-337b6c89d77c",
|
|
15
|
+
"name": "MEDSEA Daily Temperature (2024-2025)",
|
|
16
|
+
"bundle": "medseaDaily"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"before": { "01a24b50-5c38-73be-a7c7-337b6c89d77c": true },
|
|
20
|
+
"after": { "01a24b50-5c38-73be-a7c7-337b6c89d77c": false },
|
|
21
|
+
"view": {
|
|
22
|
+
"camera": { "position": [0, 1.02, 1.12], "target": [0, -0.06, 0.06], "up": [0, 1, 0] },
|
|
23
|
+
"viewport": { "lonMin": -6.25, "lonMax": 36.25, "latMin": 30.25, "latMax": 46.25 },
|
|
24
|
+
"currentView": "persp",
|
|
25
|
+
"currentProjection": "planar",
|
|
26
|
+
"isOrthographic": false,
|
|
27
|
+
"elevationExaggerationSurface": 40,
|
|
28
|
+
"elevationExaggerationDepth": 40,
|
|
29
|
+
"clipping": { "west": -180, "east": 180, "south": -90, "north": 90 }
|
|
30
|
+
},
|
|
31
|
+
"caption": "Hide MEDSEA Daily Temperature (2024-2025)"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "s2",
|
|
35
|
+
"kind": "control",
|
|
36
|
+
"control": "opacity",
|
|
37
|
+
"label": "Opacity: 80% → 40% (MEDSEA Monthly Temperature)",
|
|
38
|
+
"rows": [{ "id": "01a24b50-59ed-7597-89d0-2b4c6c0aff22", "name": "MEDSEA Monthly Temperature", "bundle": "medsea" }],
|
|
39
|
+
"before": 0.8,
|
|
40
|
+
"after": 0.4,
|
|
41
|
+
"view": {
|
|
42
|
+
"camera": { "position": [0, 1.02, 1.12], "target": [0, -0.06, 0.06], "up": [0, 1, 0] },
|
|
43
|
+
"viewport": { "lonMin": -6.25, "lonMax": 36.25, "latMin": 30.25, "latMax": 46.25 },
|
|
44
|
+
"currentView": "persp",
|
|
45
|
+
"currentProjection": "planar",
|
|
46
|
+
"isOrthographic": false,
|
|
47
|
+
"elevationExaggerationSurface": 40,
|
|
48
|
+
"elevationExaggerationDepth": 40,
|
|
49
|
+
"clipping": { "west": -180, "east": 180, "south": -90, "north": 90 }
|
|
50
|
+
},
|
|
51
|
+
"caption": "Set MEDSEA Monthly Temperature's Opacity to 40 %"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "s3",
|
|
55
|
+
"kind": "gradient",
|
|
56
|
+
"label": "Color Ramp thermal (MEDSEA Monthly Temperature)",
|
|
57
|
+
"rows": [{ "id": "01a24b50-59ed-7597-89d0-2b4c6c0aff22", "name": "MEDSEA Monthly Temperature", "bundle": "medsea" }],
|
|
58
|
+
"before": {
|
|
59
|
+
"css": "linear-gradient(90deg, rgb(0,0,179) 0%, rgb(128,102,255) 14%, rgb(102,204,230) 29%, rgb(179,255,230) 43%, rgb(255,242,153) 57%, rgb(255,153,77) 71%, rgb(255,26,0) 100%)",
|
|
60
|
+
"colorRamp": { "name": "Rainbow PRISM" }
|
|
61
|
+
},
|
|
62
|
+
"after": {
|
|
63
|
+
"css": "linear-gradient(90deg, rgb(4,35,51) 0%, rgb(31,52,134) 14%, rgb(101,66,151) 29%, rgb(150,87,138) 43%, rgb(203,103,116) 57%, rgb(244,133,75) 71%, rgb(232,250,91) 100%)",
|
|
64
|
+
"colorRamp": { "name": "thermal" }
|
|
65
|
+
},
|
|
66
|
+
"view": {
|
|
67
|
+
"camera": { "position": [0, 1.02, 1.12], "target": [0, -0.06, 0.06], "up": [0, 1, 0] },
|
|
68
|
+
"viewport": { "lonMin": -6.25, "lonMax": 36.25, "latMin": 30.25, "latMax": 46.25 },
|
|
69
|
+
"currentView": "persp",
|
|
70
|
+
"currentProjection": "planar",
|
|
71
|
+
"isOrthographic": false,
|
|
72
|
+
"elevationExaggerationSurface": 40,
|
|
73
|
+
"elevationExaggerationDepth": 40,
|
|
74
|
+
"clipping": { "west": -180, "east": 180, "south": -90, "north": 90 }
|
|
75
|
+
},
|
|
76
|
+
"caption": "Set MEDSEA Monthly Temperature's Color Ramp to thermal"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"id": "s4",
|
|
80
|
+
"kind": "clip",
|
|
81
|
+
"field": "west",
|
|
82
|
+
"userField": "userWest",
|
|
83
|
+
"bucket": "shared",
|
|
84
|
+
"rows": [],
|
|
85
|
+
"label": "Clipping West (°): -180.00° → 15.00°",
|
|
86
|
+
"before": -180,
|
|
87
|
+
"after": 15,
|
|
88
|
+
"view": {
|
|
89
|
+
"camera": { "position": [0, 1.02, 1.12], "target": [0, -0.06, 0.06], "up": [0, 1, 0] },
|
|
90
|
+
"viewport": { "lonMin": -6.25, "lonMax": 36.25, "latMin": 30.25, "latMax": 46.25 },
|
|
91
|
+
"currentView": "persp",
|
|
92
|
+
"currentProjection": "planar",
|
|
93
|
+
"isOrthographic": false,
|
|
94
|
+
"elevationExaggerationSurface": 40,
|
|
95
|
+
"elevationExaggerationDepth": 40,
|
|
96
|
+
"clipping": { "west": 15, "east": 180, "south": -90, "north": 90 }
|
|
97
|
+
},
|
|
98
|
+
"caption": "Set the clipping's West edge to 15.00°"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": "s5",
|
|
102
|
+
"kind": "clip",
|
|
103
|
+
"field": "north",
|
|
104
|
+
"userField": "userNorth",
|
|
105
|
+
"bucket": "shared",
|
|
106
|
+
"rows": [],
|
|
107
|
+
"label": "Clipping North (°): 90.00° → 40.00°",
|
|
108
|
+
"before": 90,
|
|
109
|
+
"after": 40,
|
|
110
|
+
"view": {
|
|
111
|
+
"camera": { "position": [0, 1.02, 1.12], "target": [0, -0.06, 0.06], "up": [0, 1, 0] },
|
|
112
|
+
"viewport": { "lonMin": -6.25, "lonMax": 36.25, "latMin": 30.25, "latMax": 46.25 },
|
|
113
|
+
"currentView": "persp",
|
|
114
|
+
"currentProjection": "planar",
|
|
115
|
+
"isOrthographic": false,
|
|
116
|
+
"elevationExaggerationSurface": 40,
|
|
117
|
+
"elevationExaggerationDepth": 40,
|
|
118
|
+
"clipping": { "west": 15, "east": 180, "south": -90, "north": 40 }
|
|
119
|
+
},
|
|
120
|
+
"caption": "Set the clipping's North edge to 40.00°"
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ciesm-prism",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1363",
|
|
4
4
|
"description": "PRISM: ocean and Earth data in one interactive 3-D view, in the web browser. Run it with npx ciesm-prism, or copy it to any web server.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ocean",
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
"url": "git+https://github.com/KavehR/PRISM.git"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
|
-
"author":
|
|
23
|
-
"name": "Kaveh Rassoulzadegan, Mediterranean Science Commission (CIESM Monaco - Paris)"
|
|
24
|
-
},
|
|
22
|
+
"author": "Kaveh Rassoulzadegan, Mediterranean Science Commission, CIESM Monaco - Paris",
|
|
25
23
|
"type": "module",
|
|
26
24
|
"bin": {
|
|
27
25
|
"ciesm-prism": "bin/prism.mjs"
|
|
@@ -21,6 +21,7 @@ import { followSamples } from './mc-geo-markers.js';
|
|
|
21
21
|
import { reportHover } from './mc-raw-hover.js';
|
|
22
22
|
import { mcInteraction } from './mc-interaction.js';
|
|
23
23
|
import { openOrganismPanel } from './mc-organism-panel.js';
|
|
24
|
+
import * as outline from './mc-outline.js';
|
|
24
25
|
import { RenderPanel, RenderPanelManager, makeDockable } from './mc-render-panel.js';
|
|
25
26
|
import { projectManager } from '../../src/project/ProjectManager.js';
|
|
26
27
|
import { Dataset, DataSpec } from '../../src/project/Dataset.js';
|
|
@@ -1081,26 +1082,134 @@ export function createFileGUI() {
|
|
|
1081
1082
|
};
|
|
1082
1083
|
}
|
|
1083
1084
|
|
|
1085
|
+
// ── MetaCube's own Outliner nodes (MetaCube > Create, mc-outline.js) ─────────
|
|
1086
|
+
|
|
1087
|
+
// The nodes shown open after a change: the path to the node made or moved
|
|
1088
|
+
let _outlineOpen = new Set();
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* A name asked in MetaCube's dialog, the given one offered and selected
|
|
1092
|
+
* @param {string} title
|
|
1093
|
+
* @param {string} offered
|
|
1094
|
+
* @param {(name: string) => void} done - With the name, on OK or Enter
|
|
1095
|
+
*/
|
|
1096
|
+
function _askName(title, offered, done) {
|
|
1097
|
+
const input = document.createElement('input');
|
|
1098
|
+
input.type = 'text';
|
|
1099
|
+
input.value = offered;
|
|
1100
|
+
input.style.width = '100%';
|
|
1101
|
+
const label = document.createElement('label');
|
|
1102
|
+
label.textContent = 'Name';
|
|
1103
|
+
label.style.display = 'block';
|
|
1104
|
+
label.style.marginBottom = '6px';
|
|
1105
|
+
const body = document.createElement('div');
|
|
1106
|
+
body.append(label, input);
|
|
1107
|
+
_mcModal(title, body, {
|
|
1108
|
+
OK: (close) => {
|
|
1109
|
+
const name = input.value.trim();
|
|
1110
|
+
if (!name) return input.focus();
|
|
1111
|
+
close();
|
|
1112
|
+
done(name);
|
|
1113
|
+
},
|
|
1114
|
+
Cancel: (close) => close(),
|
|
1115
|
+
});
|
|
1116
|
+
input.focus();
|
|
1117
|
+
input.select();
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
/** Where the Outliner's selected row puts a new node: inside a MetaCube node or an organism, else at the top */
|
|
1121
|
+
function _outlinerTarget() {
|
|
1122
|
+
const d = window.APP?.outlinerPanel?.fancytree?.getActiveNode?.()?.data;
|
|
1123
|
+
return _outlinePlace(d) || { top: true };
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* A row of the Outliner as a place of the outline (mc-outline.js), or null where nothing goes: a pathway or
|
|
1128
|
+
* reaction read from a sample's data, another dataset's row
|
|
1129
|
+
*/
|
|
1130
|
+
function _outlinePlace(d) {
|
|
1131
|
+
if (!d || !MC.data._metadagDatasetId || d.datasetId !== MC.data._metadagDatasetId) return null;
|
|
1132
|
+
if (d.mcNode) return { node: d.metadagKey };
|
|
1133
|
+
if (d.metadagType === 'sample') return { sample: d.metadagKey };
|
|
1134
|
+
if (!d.metadagKey) return { top: true }; // the project's own row
|
|
1135
|
+
return null;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* The project's row shows the outline again (made when the project has none), the node changed selected in it
|
|
1140
|
+
* and the path to it open
|
|
1141
|
+
* @param {string|null} id - The node made, moved or renamed; null: one removed
|
|
1142
|
+
*/
|
|
1143
|
+
function _outlineChanged(id) {
|
|
1144
|
+
const project = MC.data.currentProject;
|
|
1145
|
+
_outlineOpen = new Set(id ? outline.pathTo(project, id) : []);
|
|
1146
|
+
const row = MC.data._metadagDatasetId && projectManager.getDataset(MC.data._metadagDatasetId);
|
|
1147
|
+
if (row) row.metadagMetadata = { hierarchy: _metaDAGHierarchy(project) };
|
|
1148
|
+
else _registerMetaDAGDataset(project.title);
|
|
1149
|
+
const panel = window.APP?.outlinerPanel;
|
|
1150
|
+
panel?.refresh();
|
|
1151
|
+
// Selected once a new row's own selection is through (plugin.js selects a row MetaCube adds, in a microtask)
|
|
1152
|
+
if (id) {
|
|
1153
|
+
setTimeout(() => {
|
|
1154
|
+
panel?.fancytree?.getNodeByKey(`${MC.data._metadagDatasetId}_md_${id}`)?.setActive(true, { noEvents: true });
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
/** MetaCube > Create > a blank node of a kind, its name asked: inside the selected node when its kind may stand there */
|
|
1160
|
+
function _createBlank(kind) {
|
|
1161
|
+
const project = MC.data.currentProject;
|
|
1162
|
+
const target = _outlinerTarget();
|
|
1163
|
+
_askName(`New ${outline.KINDS[kind].label}`, outline.nextName(project, kind), (name) => {
|
|
1164
|
+
const node = outline.makeNode(kind, name);
|
|
1165
|
+
outline.addNode(project, node, target);
|
|
1166
|
+
_outlineChanged(node.id);
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* Where an Outliner row of a MetaCube node may drop on another row (registration outliner.dropModes)
|
|
1172
|
+
* @returns {string[]|false}
|
|
1173
|
+
*/
|
|
1174
|
+
export function outlineDropModes(id, targetData) {
|
|
1175
|
+
const place = _outlinePlace(targetData);
|
|
1176
|
+
const modes = place ? outline.dropModes(MC.data.currentProject, id, place) : [];
|
|
1177
|
+
return modes.length ? modes : false;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
/** A MetaCube node dropped on a row (registration outliner.drop) */
|
|
1181
|
+
export function outlineDrop(id, targetData, mode) {
|
|
1182
|
+
const place = _outlinePlace(targetData);
|
|
1183
|
+
if (place && outline.moveNode(MC.data.currentProject, id, place, mode)) _outlineChanged(id);
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
/** A MetaCube node's right-click items: rename it, delete it with what it holds (registration outliner.menu) */
|
|
1187
|
+
export function outlineMenu(id) {
|
|
1188
|
+
const project = MC.data.currentProject;
|
|
1189
|
+
const at = outline.locate(project, id);
|
|
1190
|
+
if (!at) return [];
|
|
1191
|
+
return [
|
|
1192
|
+
{
|
|
1193
|
+
label: 'Rename…',
|
|
1194
|
+
action: () =>
|
|
1195
|
+
_askName(`Rename ${outline.KINDS[at.node.type]?.label || 'node'}`, at.node.name, (name) => {
|
|
1196
|
+
if (outline.renameNode(project, id, name)) _outlineChanged(id);
|
|
1197
|
+
}),
|
|
1198
|
+
},
|
|
1199
|
+
{
|
|
1200
|
+
label: 'Delete',
|
|
1201
|
+
icon: '×',
|
|
1202
|
+
action: () => {
|
|
1203
|
+
if (outline.removeNode(project, id)) _outlineChanged(null);
|
|
1204
|
+
},
|
|
1205
|
+
},
|
|
1206
|
+
];
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1084
1209
|
// Create menu action handlers (menu UI created in createMenuBar)
|
|
1085
1210
|
const _createActions = {
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
_nameIn.type = 'text'; _nameIn.required = true;
|
|
1089
|
-
const _form = document.createElement('form');
|
|
1090
|
-
const _lbl = document.createElement('label');
|
|
1091
|
-
_lbl.textContent = 'Name: ';
|
|
1092
|
-
_form.append(_lbl, _nameIn);
|
|
1093
|
-
|
|
1094
|
-
_mcModal('New Metagenome', _form, {
|
|
1095
|
-
OK: (close) => {
|
|
1096
|
-
const name = _nameIn.value.trim();
|
|
1097
|
-
if (!name) { alert('Please enter a name'); return; }
|
|
1098
|
-
new Metagenome(name);
|
|
1099
|
-
close();
|
|
1100
|
-
},
|
|
1101
|
-
Cancel: (close) => close()
|
|
1102
|
-
});
|
|
1103
|
-
},
|
|
1211
|
+
// Blank nodes in the Outliner, nested in the biological order (mc-outline.js); an organism: its window
|
|
1212
|
+
metagenome: () => _createBlank('metagenome'),
|
|
1104
1213
|
organism: () => {
|
|
1105
1214
|
// A project without reactions: its MetaDAG window waits for an organism bringing some
|
|
1106
1215
|
if (!projectHasReactions()) {
|
|
@@ -1109,30 +1218,11 @@ const _createActions = {
|
|
|
1109
1218
|
}
|
|
1110
1219
|
openOrganismPanel(window.APP, { add: addOrganism });
|
|
1111
1220
|
},
|
|
1112
|
-
metabolism: () =>
|
|
1113
|
-
pathway: () =>
|
|
1114
|
-
reaction: () =>
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
const _form2 = document.createElement('form');
|
|
1118
|
-
const _lbl2 = document.createElement('label');
|
|
1119
|
-
_lbl2.textContent = 'reaction ID: ';
|
|
1120
|
-
_form2.append(_lbl2, _idIn);
|
|
1121
|
-
|
|
1122
|
-
_mcModal('New Reaction', _form2, {
|
|
1123
|
-
OK: (close) => {
|
|
1124
|
-
const id = _idIn.value.trim();
|
|
1125
|
-
if (!id) { alert('Please enter a name'); return; }
|
|
1126
|
-
const re = new bioModels.Reaction(id);
|
|
1127
|
-
MC.data.currentProject.addReaction(re);
|
|
1128
|
-
updateRender.createReactionsGeometry(re);
|
|
1129
|
-
close();
|
|
1130
|
-
},
|
|
1131
|
-
Cancel: (close) => close()
|
|
1132
|
-
});
|
|
1133
|
-
},
|
|
1134
|
-
enzyme: () => { /* … */ },
|
|
1135
|
-
enzymeSubType: () => { /* … */ }
|
|
1221
|
+
metabolism: () => _createBlank('metabolism'),
|
|
1222
|
+
pathway: () => _createBlank('pathway'),
|
|
1223
|
+
reaction: () => _createBlank('reaction'),
|
|
1224
|
+
enzyme: () => _createBlank('enzyme'),
|
|
1225
|
+
enzymeSubType: () => _createBlank('enzyme-sub'),
|
|
1136
1226
|
};
|
|
1137
1227
|
let guard = false;
|
|
1138
1228
|
// 6) when A changes
|
|
@@ -1565,7 +1655,9 @@ function _buildMetaDAGSubtree(children) {
|
|
|
1565
1655
|
|
|
1566
1656
|
/**
|
|
1567
1657
|
* MetaCube's project as the Outliner's tree: each sample, then its own children (a MetaDAG
|
|
1568
|
-
* import's pathways → reactions), else its pathways and their reactions from its rows
|
|
1658
|
+
* import's pathways → reactions), else its pathways and their reactions from its rows; MetaCube's
|
|
1659
|
+
* own nodes (MetaCube > Create, mc-outline.js) first under the organism they stand under, the
|
|
1660
|
+
* others after the samples
|
|
1569
1661
|
*/
|
|
1570
1662
|
function _metaDAGHierarchy(project) {
|
|
1571
1663
|
const hierarchy = [];
|
|
@@ -1583,7 +1675,14 @@ function _metaDAGHierarchy(project) {
|
|
|
1583
1675
|
});
|
|
1584
1676
|
}
|
|
1585
1677
|
}
|
|
1586
|
-
return hierarchy;
|
|
1678
|
+
if (!project) return hierarchy;
|
|
1679
|
+
const { under, top } = outline.outlineItems(project, new Set(hierarchy.map((s) => s.id)), _outlineOpen);
|
|
1680
|
+
for (const sample of hierarchy) {
|
|
1681
|
+
const own = under.get(sample.id);
|
|
1682
|
+
if (own) sample.children = [...own, ...sample.children];
|
|
1683
|
+
if (_outlineOpen.has(sample.id)) sample.expanded = true;
|
|
1684
|
+
}
|
|
1685
|
+
return [...hierarchy, ...top];
|
|
1587
1686
|
}
|
|
1588
1687
|
|
|
1589
1688
|
/**
|
|
@@ -4332,7 +4431,11 @@ const MENU_ACTIONS = {
|
|
|
4332
4431
|
'mc:file:export': () => fileGUIParameters.exportCompressed(),
|
|
4333
4432
|
'mc:create:metagenome': () => _createActions.metagenome(),
|
|
4334
4433
|
'mc:create:organism': () => _createActions.organism(),
|
|
4434
|
+
'mc:create:metabolism': () => _createActions.metabolism(),
|
|
4435
|
+
'mc:create:pathway': () => _createActions.pathway(),
|
|
4335
4436
|
'mc:create:reaction': () => _createActions.reaction(),
|
|
4437
|
+
'mc:create:enzyme': () => _createActions.enzyme(),
|
|
4438
|
+
'mc:create:enzyme-sub': () => _createActions.enzymeSubType(),
|
|
4336
4439
|
'mc:window:outliner': () => window.APP?.outlinerPanel?.toggle(),
|
|
4337
4440
|
'mc:window:controls': () => window.APP?.controlPanel?.toggle(),
|
|
4338
4441
|
'mc:window:rawdata': () => window.APP?.rawDataPanel?.toggle(),
|
|
@@ -110,6 +110,8 @@ export class MCProject {
|
|
|
110
110
|
this.folder = true;
|
|
111
111
|
this.expanded = true;
|
|
112
112
|
this.children = [];
|
|
113
|
+
// MetaCube's own Outliner nodes (MetaCube > Create), apart from the samples: mc-outline.js
|
|
114
|
+
this.outline = [];
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
reset() {
|
|
@@ -117,6 +119,7 @@ export class MCProject {
|
|
|
117
119
|
this.folder = true;
|
|
118
120
|
this.expanded = true;
|
|
119
121
|
this.children = [];
|
|
122
|
+
this.outline = [];
|
|
120
123
|
//console.log("New project");
|
|
121
124
|
}
|
|
122
125
|
|
|
@@ -135,8 +135,10 @@ typeRegistry.register({
|
|
|
135
135
|
outliner: {
|
|
136
136
|
icon: { char: '\u{1F30C}', color: '#ce93d8' },
|
|
137
137
|
tree: (ds) => (ds.metadagMetadata?.hierarchy ? { children: metaDAGChildren(ds), expanded: true } : null),
|
|
138
|
-
// MetaDAG node clicked — emit selection event (Shift adds, Alt removes, else it replaces)
|
|
138
|
+
// MetaDAG node clicked — emit selection event (Shift adds, Alt removes, else it replaces); MetaCube's own
|
|
139
|
+
// nodes are in no view: selected in the Outliner only (where MetaCube > Create puts the next one)
|
|
139
140
|
activate(d, node, event) {
|
|
141
|
+
if (d.mcNode) return;
|
|
140
142
|
const e = event?.originalEvent;
|
|
141
143
|
eventBus.emit('metadag:node:selected', {
|
|
142
144
|
datasetId: d.datasetId,
|
|
@@ -148,6 +150,7 @@ typeRegistry.register({
|
|
|
148
150
|
},
|
|
149
151
|
// MetaDAG node hovered — the MetaDAG view highlights it
|
|
150
152
|
hover(d, node, entering) {
|
|
153
|
+
if (d.mcNode) return;
|
|
151
154
|
eventBus.emit('metadag:node:hover', {
|
|
152
155
|
datasetId: d.datasetId,
|
|
153
156
|
nodeKey: d.metadagKey,
|
|
@@ -155,6 +158,12 @@ typeRegistry.register({
|
|
|
155
158
|
entering,
|
|
156
159
|
});
|
|
157
160
|
},
|
|
161
|
+
// MetaCube's own nodes move by drag and drop in the biological order, rename and delete by right click
|
|
162
|
+
// (mc-outline.js, through MetaCube once opened: its project holds them)
|
|
163
|
+
drag: (d) => !!d.mcNode,
|
|
164
|
+
dropModes: (d, target) => metaCube?.outlineDropModes(d.metadagKey, target.data) || false,
|
|
165
|
+
drop: (d, target, mode) => metaCube?.outlineDrop(d.metadagKey, target.data, mode),
|
|
166
|
+
menu: (d) => (d.mcNode && metaCube ? metaCube.outlineMenu(d.metadagKey) : []),
|
|
158
167
|
},
|
|
159
168
|
controls: () => [
|
|
160
169
|
{
|
|
@@ -406,7 +415,10 @@ function keggChildren(dataset) {
|
|
|
406
415
|
return catNodes;
|
|
407
416
|
}
|
|
408
417
|
|
|
409
|
-
/**
|
|
418
|
+
/**
|
|
419
|
+
* MetaDAG project hierarchy: sample → pathway → reaction (metadagMetadata.hierarchy), and MetaCube's own
|
|
420
|
+
* nodes (MetaCube > Create, `user`: mc-outline.js), which drag and drop in the biological order.
|
|
421
|
+
*/
|
|
410
422
|
function metaDAGChildren(dataset) {
|
|
411
423
|
const hierarchy = dataset.metadagMetadata.hierarchy;
|
|
412
424
|
const TYPE_FLAGS = {
|
|
@@ -416,24 +428,32 @@ function metaDAGChildren(dataset) {
|
|
|
416
428
|
};
|
|
417
429
|
const TYPE_ICONS = {
|
|
418
430
|
sample: { char: '\u{1F9EA}', color: '#a5d6a7' },
|
|
431
|
+
metagenome: { char: '\u{1F310}', color: '#80deea' },
|
|
432
|
+
metabolism: { char: '♻', color: '#c5e1a5' },
|
|
419
433
|
pathway: { char: '\u{1F6E4}', color: '#90caf9' },
|
|
420
434
|
reaction: { char: '⚗', color: '#ffcc80' },
|
|
435
|
+
enzyme: { char: '⚙', color: '#f48fb1' },
|
|
436
|
+
'enzyme-sub': { char: '⚙', color: '#ce93d8' },
|
|
421
437
|
};
|
|
422
438
|
const ITEM_ICON = { char: '•', color: '#b0bec5' };
|
|
423
439
|
|
|
424
440
|
const buildNodes = (items, dsId) => {
|
|
425
441
|
return items.map((item) => {
|
|
426
|
-
|
|
442
|
+
// MetaCube's own nodes carry no view's flag: no eye, no view to select in
|
|
443
|
+
const flag = item.user ? 'mcNode' : TYPE_FLAGS[item.type] || 'isMetaDAGItem';
|
|
427
444
|
const hasChildren = item.children && item.children.length > 0;
|
|
428
445
|
const childCount = hasChildren ? ` (${item.children.length})` : '';
|
|
429
446
|
return {
|
|
430
447
|
title: `${item.name}${childCount}`,
|
|
431
448
|
key: `${dsId}_md_${item.id}`,
|
|
432
|
-
expanded:
|
|
433
|
-
folder: hasChildren,
|
|
449
|
+
expanded: !!item.expanded,
|
|
450
|
+
folder: hasChildren || (!!item.user && item.type !== 'enzyme-sub'),
|
|
434
451
|
data: {
|
|
435
452
|
datasetId: dsId,
|
|
436
453
|
[flag]: true,
|
|
454
|
+
// Rows without an eye of their own (MetaCube's nodes, reactions) carry no buttons: the
|
|
455
|
+
// dataset row's trash and eye, which the Outliner gives an unmarked row, act on the whole project
|
|
456
|
+
noButtons: flag !== 'isMetaDAGSample' && flag !== 'isMetaDAGPathway',
|
|
437
457
|
metadagKey: item.id,
|
|
438
458
|
metadagType: item.type,
|
|
439
459
|
visible: item.visible !== false,
|
|
@@ -705,15 +725,16 @@ export const menuItems = {
|
|
|
705
725
|
{ id: 'mc-import', label: 'Import (MetaDAG) zip...', action: 'mc:file:import' },
|
|
706
726
|
{ id: 'mc-export', label: 'Export (MetaDAG) zip...', action: 'mc:file:export' },
|
|
707
727
|
],
|
|
708
|
-
// Organism: its window (mc-organism-panel.js)
|
|
728
|
+
// Organism: its window (mc-organism-panel.js); the others: a blank node of their kind in the Outliner, inside the
|
|
729
|
+
// selected one when the biological order allows it (MGS.2.GUI.js _createBlank, mc-outline.js)
|
|
709
730
|
create: [
|
|
710
|
-
{ id: 'mc-metagenome', label: 'Metagenome', action: 'mc:create:metagenome'
|
|
731
|
+
{ id: 'mc-metagenome', label: 'Metagenome', action: 'mc:create:metagenome' },
|
|
711
732
|
{ id: 'mc-organism', label: 'Organism', action: 'mc:create:organism' },
|
|
712
|
-
{ id: 'mc-metabolism', label: 'Metabolism', action: 'mc:create:metabolism'
|
|
713
|
-
{ id: 'mc-pathway', label: 'Pathway', action: 'mc:create:pathway'
|
|
714
|
-
{ id: 'mc-reaction', label: 'Reaction', action: 'mc:create:reaction'
|
|
715
|
-
{ id: 'mc-enzyme', label: 'Enzyme', action: 'mc:create:enzyme'
|
|
716
|
-
{ id: 'mc-enzyme-sub', label: 'Custom Enzyme SubType', action: 'mc:create:enzyme-sub'
|
|
733
|
+
{ id: 'mc-metabolism', label: 'Metabolism', action: 'mc:create:metabolism' },
|
|
734
|
+
{ id: 'mc-pathway', label: 'Pathway', action: 'mc:create:pathway' },
|
|
735
|
+
{ id: 'mc-reaction', label: 'Reaction', action: 'mc:create:reaction' },
|
|
736
|
+
{ id: 'mc-enzyme', label: 'Enzyme', action: 'mc:create:enzyme' },
|
|
737
|
+
{ id: 'mc-enzyme-sub', label: 'Custom Enzyme SubType', action: 'mc:create:enzyme-sub' },
|
|
717
738
|
],
|
|
718
739
|
examples: EXAMPLES.map((ex, i) => ({ id: `mc-example-${i}`, action: 'mc:example:load', ...ex })),
|
|
719
740
|
megaGraph: [
|