@intact-ebi/cytoscape-lumina 1.1.0 → 1.2.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/README.md +13 -2
- package/dist/lumina-layout.d.ts +2 -0
- package/dist/lumina-layout.js +6 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Written in TypeScript. Registered under the layout name `lumina` (the legacy nam
|
|
|
14
14
|
- Leaves that don't belong to a chain are placed on a circle around their parent
|
|
15
15
|
- **Two interchangeable solvers** for the virtual-node graph: `force` and `stress`
|
|
16
16
|
- **Multiple connected components** are each laid out independently, rotated to their minimum bounding box, and packed into rows that match the canvas aspect ratio
|
|
17
|
-
- **
|
|
17
|
+
- **Optional compound parents** (`.substructure-group`) can be generated for each detected substructure using `createSubstructureGroups`. When enabled, this modifies the `parent` data of nodes belonging to these groups and may affect existing compound-node relationships.
|
|
18
18
|
- **Step-by-step mode** to inspect and replay every stage of the pipeline
|
|
19
19
|
|
|
20
20
|
## How it works
|
|
@@ -45,6 +45,7 @@ registerLumina(cytoscape);
|
|
|
45
45
|
|
|
46
46
|
const cy = cytoscape({ container: document.getElementById('cy'), elements: [/* ... */] });
|
|
47
47
|
|
|
48
|
+
```ts
|
|
48
49
|
cy.layout({
|
|
49
50
|
name: 'lumina',
|
|
50
51
|
layoutAlgorithm: 'stress', // 'stress' (default) or 'force'
|
|
@@ -57,10 +58,17 @@ cy.layout({
|
|
|
57
58
|
force: { repulsion: 300, springK: 0.15, useAngularForce: true },
|
|
58
59
|
|
|
59
60
|
// used only when layoutAlgorithm is 'stress'
|
|
60
|
-
stress: { weightExponent: 2 }
|
|
61
|
+
stress: { weightExponent: 2 },
|
|
62
|
+
|
|
63
|
+
// create compound parent nodes for detected substructures
|
|
64
|
+
// Set to false to avoid creating substructure group parents
|
|
65
|
+
createSubstructureGroups: true
|
|
61
66
|
}).run();
|
|
62
67
|
```
|
|
63
68
|
|
|
69
|
+
Set `createSubstructureGroups: false` to disable the creation of compound parent nodes.
|
|
70
|
+
|
|
71
|
+
|
|
64
72
|
Registration is idempotent, so it is safe to call more than once (e.g. with hot reload).
|
|
65
73
|
|
|
66
74
|
## Options
|
|
@@ -135,6 +143,7 @@ Stress shortest paths use weighted Dijkstra. Computed edge lengths (`idealLength
|
|
|
135
143
|
| `randomizeInitialPositions` | `false` | Randomize node positions inside the bounding box before the layout starts. |
|
|
136
144
|
| `spreadVNodes` | `true` | After solving, scatter real nodes slightly around their virtual node centre. |
|
|
137
145
|
| `substructureLayout` | `false` | When `false` (default), each substructure is arranged internally (circle, rings, grid, ...). When `true`, that step is skipped. |
|
|
146
|
+
| `createSubstructureGroups` | `true` | Whether to create compound parent nodes (`.substructure-group`) for detected substructures. When enabled, the layout modifies the `parent` data of grouped nodes, which may overwrite or alter existing compound-node relationships. Set to `false` to disable compound parent creation. |
|
|
138
147
|
| `stepByStep` | `false` | Record a snapshot after each stage (see below). |
|
|
139
148
|
|
|
140
149
|
## Step-by-step debugging
|
|
@@ -164,3 +173,5 @@ Each step restores real-node positions and overlays the virtual nodes (transluce
|
|
|
164
173
|
- Nodes with 8 or more neighbours are skipped during cycle search, for performance.
|
|
165
174
|
- Self-loops and duplicate edges are ignored by the layout.
|
|
166
175
|
- Generated compound parents have the class `substructure-group` and ids of the form `<componentIndex>_<groupId>`; they are removed and regenerated on each run.
|
|
176
|
+
* **Node `parent` data may be modified:** When `createSubstructureGroups` is `true` (the default), LUMINA creates compound parent nodes for detected substructures and assigns child nodes to those parents by modifying their `parent` data. If your Cytoscape.js graph already uses compound nodes or existing `parent` relationships, these relationships may be changed. Set `createSubstructureGroups: false` if you do not want LUMINA to create substructure group parents or modify node `parent` data for this purpose. Check your graph's existing compound-node structure before enabling this option.
|
|
177
|
+
* Generated compound parents have the class `substructure-group` and IDs of the form `<componentIndex>_<groupId>`. When enabled, they are removed and regenerated on each run.
|
package/dist/lumina-layout.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export interface LuminaOptions {
|
|
|
47
47
|
stepByStep?: boolean;
|
|
48
48
|
force?: LuminaForceOptions;
|
|
49
49
|
stress?: LuminaStressOptions;
|
|
50
|
+
createSubstructureGroups?: boolean;
|
|
50
51
|
}
|
|
51
52
|
/** Options passed to `cy.layout()` for the LUMINA layout. */
|
|
52
53
|
export interface LuminaLayoutOptions extends LuminaOptions, cytoscape.BaseLayoutOptions {
|
|
@@ -133,6 +134,7 @@ declare class VEdge {
|
|
|
133
134
|
* iterations: 600, // shared
|
|
134
135
|
* force: { repulsion: 300, springK: 0.15 }, // force only
|
|
135
136
|
* stress: { weightExponent: 2 } // stress only
|
|
137
|
+
* createSubstructureGroups: true
|
|
136
138
|
* }).run();
|
|
137
139
|
*/
|
|
138
140
|
export default function register(cytoscapeInstance: any): void;
|
package/dist/lumina-layout.js
CHANGED
|
@@ -29,11 +29,12 @@ export const DEFAULT_PARAMS = {
|
|
|
29
29
|
coolingExponent: 2,
|
|
30
30
|
useAngularForce: false,
|
|
31
31
|
angularStrength: 0.2,
|
|
32
|
-
angularMaxForce: 2.0
|
|
32
|
+
angularMaxForce: 2.0,
|
|
33
33
|
},
|
|
34
34
|
stress: {
|
|
35
|
-
weightExponent: 2
|
|
36
|
-
}
|
|
35
|
+
weightExponent: 2,
|
|
36
|
+
},
|
|
37
|
+
createSubstructureGroups: false,
|
|
37
38
|
};
|
|
38
39
|
function applyDefaults(defaults, overrides) {
|
|
39
40
|
const resolved = { ...defaults };
|
|
@@ -173,6 +174,7 @@ function computeStressDistances(nodes, edges, idealLength) {
|
|
|
173
174
|
* iterations: 600, // shared
|
|
174
175
|
* force: { repulsion: 300, springK: 0.15 }, // force only
|
|
175
176
|
* stress: { weightExponent: 2 } // stress only
|
|
177
|
+
* createSubstructureGroups: true
|
|
176
178
|
* }).run();
|
|
177
179
|
*/
|
|
178
180
|
export default function register(cytoscapeInstance) {
|
|
@@ -1713,7 +1715,7 @@ LuminaLayout.prototype.run = function () {
|
|
|
1713
1715
|
});
|
|
1714
1716
|
});
|
|
1715
1717
|
this.packNetworks(networkInfos);
|
|
1716
|
-
if (
|
|
1718
|
+
if (this.params.createSubstructureGroups) {
|
|
1717
1719
|
networkInfos.forEach((networkInfo, index) => {
|
|
1718
1720
|
const nodes = networkInfo.nodes;
|
|
1719
1721
|
// All parent IDs in the current network
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intact-ebi/cytoscape-lumina",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "LUMINA: a structure-aware Cytoscape.js layout that detects cycles, chains, stars and parallel groups and lays them out with force-directed or stress-majorization solvers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -71,4 +71,4 @@
|
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"fastpriorityqueue": "^0.8.0"
|
|
73
73
|
}
|
|
74
|
-
}
|
|
74
|
+
}
|