netan 1.0.0__tar.gz
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.
- netan-1.0.0/LICENSE +21 -0
- netan-1.0.0/PKG-INFO +182 -0
- netan-1.0.0/README.md +167 -0
- netan-1.0.0/netan/__init__.py +3 -0
- netan-1.0.0/netan/netan.py +1368 -0
- netan-1.0.0/netan.egg-info/PKG-INFO +182 -0
- netan-1.0.0/netan.egg-info/SOURCES.txt +10 -0
- netan-1.0.0/netan.egg-info/dependency_links.txt +1 -0
- netan-1.0.0/netan.egg-info/requires.txt +3 -0
- netan-1.0.0/netan.egg-info/top_level.txt +1 -0
- netan-1.0.0/pyproject.toml +20 -0
- netan-1.0.0/setup.cfg +4 -0
netan-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Boris Minasenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
netan-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netan
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Network builder for multi-omics matrices (Rodin-compatible).
|
|
5
|
+
Author: Boris Minasenko
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/BM-Boris/netan-lib
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: rodin>=1.9.10
|
|
12
|
+
Requires-Dist: joblib>=1.2
|
|
13
|
+
Requires-Dist: tqdm>=4.65
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# Netan — Multilayer Network Builder for Rodin‑like Objects
|
|
17
|
+
|
|
18
|
+
**Netan** builds multilayer networks from omics matrices and gives you clean APIs to analyze, visualize, and export them. It supports Spearman, CLR (MI‑z), ExtraTrees‑RF, and Graphical Lasso; both *samples* and *features* node modes; stacked or multilayer graphs (with `consensus` edges); cross‑omics links; an interactive Plotly viewer; and Cytoscape‑ready CSV export.
|
|
19
|
+
|
|
20
|
+
Web App: [netan.io](https://netan.io)
|
|
21
|
+
|
|
22
|
+
> **Works with any *Rodin‑like* object** exposing:
|
|
23
|
+
> - `r.X`: `pandas.DataFrame` (features × samples)
|
|
24
|
+
> - `r.samples`: `pandas.DataFrame` (first column = sample IDs; order = `r.X.columns`)
|
|
25
|
+
> - `r.features`: `pandas.DataFrame` (index = feature IDs)
|
|
26
|
+
|
|
27
|
+
> - check https://github.com/BM-Boris/rodin
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install netan
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
> Requires Python ≥ 3.10. Dependencies (installed automatically): `rodin>=1.9.10`, `numpy`, `pandas`, `networkx`, `scikit-learn`, `joblib`, `tqdm`, `plotly`.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Quick Start (with Rodin)
|
|
42
|
+
|
|
43
|
+
Below is a **ready‑to‑run** .
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
import rodin
|
|
47
|
+
import netan
|
|
48
|
+
|
|
49
|
+
# 1) Create one or multiple Rodin objects from omics data + metadata
|
|
50
|
+
r1 = rodin.create( 'metabolomics.txt', 'meta.csv'
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
r2 = rodin.create( 'transcriptomics.csv', 'meta.csv'
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# 2) Apply your preprocessing (Rodin handles normalization/log/scale etc.)
|
|
57
|
+
r1.transform()
|
|
58
|
+
r2.transform()
|
|
59
|
+
|
|
60
|
+
# 3) Build a multilayer network across shared samples
|
|
61
|
+
nt = netan.create([r1, r2])
|
|
62
|
+
nt.build(
|
|
63
|
+
method='spearman', # network inference method
|
|
64
|
+
edge_threshold=0.75, # threshold on method-specific weights
|
|
65
|
+
layer_mode='multilayer', # 'stack' or 'multilayer'
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# 4) Interactive Plotly graph (FigureWidget)
|
|
69
|
+
fig = nt.plot(
|
|
70
|
+
title='Netan: Samples × Multilayer (Spearman, threshold=0.75)',
|
|
71
|
+
node_size=12,
|
|
72
|
+
width=950,
|
|
73
|
+
height=650
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
# 5) Export an edge table compatible with Cytoscape
|
|
77
|
+
nt.to_csv()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## What Netan Does
|
|
84
|
+
|
|
85
|
+
- **Aligns samples** across inputs.
|
|
86
|
+
- **Infers networks** per method:
|
|
87
|
+
- `spearman`: absolute Spearman correlation, threshold ∈ [0,1].
|
|
88
|
+
- `clr`: Context Likelihood of Relatedness (MI‑based symmetric Z). Typical thresholds ~2–5.
|
|
89
|
+
- `rf`: ExtraTrees‑based symmetric importance; threshold on [0,1].
|
|
90
|
+
- `glasso`: Graphical Lasso; threshold on |partial correlation| ∈ [0,1].
|
|
91
|
+
- **Combines layers**:
|
|
92
|
+
- `layer_mode='stack'`: single layer `"Entire"`.
|
|
93
|
+
- `layer_mode='multilayer'`: per‑input graphs; edges carry a `layers` set (includes `"Entire"`; adds `"consensus"` if present in all inputs).
|
|
94
|
+
- In *features*+multilayer mode: adds cross‑omics edges labeled `cross_<method>`.
|
|
95
|
+
- **Layouts & communities**: assigns 2D coordinates (`x`,`y`) and lightweight component labels for easy plotting.
|
|
96
|
+
- **Interactive Plotly**: legend‑driven node group toggles dynamically rebuild edge polylines; continuous color shows a colorbar.
|
|
97
|
+
- **CSV export**: `source,target,weight,layer,layers` (Cytoscape‑friendly; set `List delimiter = "|"`).
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### `create(rodins, names=None) -> Netan`
|
|
102
|
+
Builds a `Netan` container from one or multiple Rodin‑like objects by aligning them to shared samples. Prints concise pre/post stats.
|
|
103
|
+
|
|
104
|
+
- **Parameters**
|
|
105
|
+
- `rodins`: a single object or a list of objects exposing `.X` and `.samples` (optionally `.features`, `.uns`).
|
|
106
|
+
- `names`: optional list of human‑readable layer names (defaults to `r.uns['file_name']` or `layer{i}`).
|
|
107
|
+
|
|
108
|
+
- **Returns**: `Netan` (with `.G` unset until you call `.build`).
|
|
109
|
+
|
|
110
|
+
### `Netan.build(method='rf', node_mode='samples', layer_mode='multilayer', edge_threshold=0.025, weights=True, layout='force-directed', combine='mean', n_jobs=-1, **kwargs) -> self`
|
|
111
|
+
Constructs the network in `self.G` and stores a 2D layout on nodes.
|
|
112
|
+
|
|
113
|
+
- **Common parameters**
|
|
114
|
+
- `method`: `'spearman' | 'clr' | 'rf' | 'glasso'`.
|
|
115
|
+
- `node_mode`: `'samples' | 'features'` — whether nodes represent samples or features.
|
|
116
|
+
- `layer_mode`: `'stack' | 'multilayer'` — combine inputs into one layer or keep them separate with fusion.
|
|
117
|
+
- `edge_threshold`: float — threshold applied to the method‑specific weight matrix.
|
|
118
|
+
- `weights`: bool — store edge weights as `G[u][v]['weight']`.
|
|
119
|
+
- `layout`: `'force-directed'|'spring'|'circular'|'kamada_kawai'|'random'` — determines `x`,`y`.
|
|
120
|
+
- `combine`: `'mean'|'median'|'max'` — fusion rule in `samples+multilayer` mode.
|
|
121
|
+
- `n_jobs`: int — parallelism for CLR/RF.
|
|
122
|
+
|
|
123
|
+
- **Method‑specific `**kwargs`**
|
|
124
|
+
- `clr`: `n_neighbors=int`.
|
|
125
|
+
- `rf`: `n_estimators=int`, `max_depth=int|None` (0/''/None ⇒ `None`).
|
|
126
|
+
- `glasso`: `alpha=float`, `max_iter=int`, `tol=float` (default 1e‑4).
|
|
127
|
+
|
|
128
|
+
- **Returns**: `self`. After the call, `self.G` is a `networkx.Graph` with edge attributes `weight`, `layer`, `layers`; nodes have `x`,`y`,`display_id`,`community` (and in features mode: `object`,`file`,`type`,`compound` when metadata is available).
|
|
129
|
+
|
|
130
|
+
### `Netan.plot(color=None, shape=None, layer=None, hide_isolated=False, weight_min=None, weight_max=None, node_size=10, width=None, height=None, title='Network Plot', continuous_colorscale='Viridis') -> plotly.graph_objs.FigureWidget`
|
|
131
|
+
Creates an interactive Plotly network figure.
|
|
132
|
+
|
|
133
|
+
- **Color/shape**
|
|
134
|
+
- *Categorical* color/shape splits nodes into legend groups; hiding a group removes its incident edges on the fly.
|
|
135
|
+
- *Continuous* color shows a colorbar (legend toggling disabled).
|
|
136
|
+
|
|
137
|
+
- **Layer/weight filters**
|
|
138
|
+
- `layer`: keep an edge if that layer label is present in its `layers` set.
|
|
139
|
+
- `weight_min/max`: numeric bounds for pruning edges by weight.
|
|
140
|
+
|
|
141
|
+
- **Display**: returns a `FigureWidget` suitable for notebooks/dashboards.
|
|
142
|
+
|
|
143
|
+
### `Netan.to_csv(path=None, sep=',', index=False, float_format=None) -> pandas.DataFrame`
|
|
144
|
+
Exports a flat edge list. Columns: `source, target, weight, layer, layers`.
|
|
145
|
+
|
|
146
|
+
- In *features* node mode: adds `source_compound, target_compound` if known.
|
|
147
|
+
- **Cytoscape tip**: set **Advanced → List delimiter = `|`** so `layers` parses as list.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Threshold Tips
|
|
152
|
+
|
|
153
|
+
- **Spearman**: `0.7–0.9` (use higher for sparser graphs).
|
|
154
|
+
- **CLR**: `2–5` (start at `3`).
|
|
155
|
+
- **RF (ExtraTrees)**: `0.02–0.10`.
|
|
156
|
+
- **Glasso**: `0.1–0.3` for `edge_threshold`; increase `alpha` (`0.1–0.2`) if convergence is hard.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Performance & Limits
|
|
161
|
+
|
|
162
|
+
- Soft **density guard** around ~10,000 edges (`MAX_EDGES`); warnings suggest raising thresholds or reducing nodes.
|
|
163
|
+
- Complexity:
|
|
164
|
+
- `spearman/CLR/RF`: ~O(p²) in the number of nodes per layer.
|
|
165
|
+
- `glasso`: ~O(p³)`; consider increasing `alpha` or reducing dimensionality.
|
|
166
|
+
- Use `n_jobs` to parallelize CLR/RF.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Troubleshooting
|
|
171
|
+
|
|
172
|
+
- **Graph too dense** → raise `edge_threshold`, use a stricter method (`glasso`), or reduce variables.
|
|
173
|
+
- **`GraphicalLasso failed`** → increase `alpha` (e.g., `0.1–0.2`), relax `tol`, ensure proper scaling.
|
|
174
|
+
- **Empty plot** → check `layer` and `weight_min/max` filters and that inputs share sample IDs.
|
|
175
|
+
- **Too many categories for `shape`** → map values to fewer categories (limited symbol set).
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
MIT (see `LICENSE`).
|
|
182
|
+
|
netan-1.0.0/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Netan — Multilayer Network Builder for Rodin‑like Objects
|
|
2
|
+
|
|
3
|
+
**Netan** builds multilayer networks from omics matrices and gives you clean APIs to analyze, visualize, and export them. It supports Spearman, CLR (MI‑z), ExtraTrees‑RF, and Graphical Lasso; both *samples* and *features* node modes; stacked or multilayer graphs (with `consensus` edges); cross‑omics links; an interactive Plotly viewer; and Cytoscape‑ready CSV export.
|
|
4
|
+
|
|
5
|
+
Web App: [netan.io](https://netan.io)
|
|
6
|
+
|
|
7
|
+
> **Works with any *Rodin‑like* object** exposing:
|
|
8
|
+
> - `r.X`: `pandas.DataFrame` (features × samples)
|
|
9
|
+
> - `r.samples`: `pandas.DataFrame` (first column = sample IDs; order = `r.X.columns`)
|
|
10
|
+
> - `r.features`: `pandas.DataFrame` (index = feature IDs)
|
|
11
|
+
|
|
12
|
+
> - check https://github.com/BM-Boris/rodin
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install netan
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
> Requires Python ≥ 3.10. Dependencies (installed automatically): `rodin>=1.9.10`, `numpy`, `pandas`, `networkx`, `scikit-learn`, `joblib`, `tqdm`, `plotly`.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Quick Start (with Rodin)
|
|
27
|
+
|
|
28
|
+
Below is a **ready‑to‑run** .
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import rodin
|
|
32
|
+
import netan
|
|
33
|
+
|
|
34
|
+
# 1) Create one or multiple Rodin objects from omics data + metadata
|
|
35
|
+
r1 = rodin.create( 'metabolomics.txt', 'meta.csv'
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
r2 = rodin.create( 'transcriptomics.csv', 'meta.csv'
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# 2) Apply your preprocessing (Rodin handles normalization/log/scale etc.)
|
|
42
|
+
r1.transform()
|
|
43
|
+
r2.transform()
|
|
44
|
+
|
|
45
|
+
# 3) Build a multilayer network across shared samples
|
|
46
|
+
nt = netan.create([r1, r2])
|
|
47
|
+
nt.build(
|
|
48
|
+
method='spearman', # network inference method
|
|
49
|
+
edge_threshold=0.75, # threshold on method-specific weights
|
|
50
|
+
layer_mode='multilayer', # 'stack' or 'multilayer'
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# 4) Interactive Plotly graph (FigureWidget)
|
|
54
|
+
fig = nt.plot(
|
|
55
|
+
title='Netan: Samples × Multilayer (Spearman, threshold=0.75)',
|
|
56
|
+
node_size=12,
|
|
57
|
+
width=950,
|
|
58
|
+
height=650
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# 5) Export an edge table compatible with Cytoscape
|
|
62
|
+
nt.to_csv()
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## What Netan Does
|
|
69
|
+
|
|
70
|
+
- **Aligns samples** across inputs.
|
|
71
|
+
- **Infers networks** per method:
|
|
72
|
+
- `spearman`: absolute Spearman correlation, threshold ∈ [0,1].
|
|
73
|
+
- `clr`: Context Likelihood of Relatedness (MI‑based symmetric Z). Typical thresholds ~2–5.
|
|
74
|
+
- `rf`: ExtraTrees‑based symmetric importance; threshold on [0,1].
|
|
75
|
+
- `glasso`: Graphical Lasso; threshold on |partial correlation| ∈ [0,1].
|
|
76
|
+
- **Combines layers**:
|
|
77
|
+
- `layer_mode='stack'`: single layer `"Entire"`.
|
|
78
|
+
- `layer_mode='multilayer'`: per‑input graphs; edges carry a `layers` set (includes `"Entire"`; adds `"consensus"` if present in all inputs).
|
|
79
|
+
- In *features*+multilayer mode: adds cross‑omics edges labeled `cross_<method>`.
|
|
80
|
+
- **Layouts & communities**: assigns 2D coordinates (`x`,`y`) and lightweight component labels for easy plotting.
|
|
81
|
+
- **Interactive Plotly**: legend‑driven node group toggles dynamically rebuild edge polylines; continuous color shows a colorbar.
|
|
82
|
+
- **CSV export**: `source,target,weight,layer,layers` (Cytoscape‑friendly; set `List delimiter = "|"`).
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### `create(rodins, names=None) -> Netan`
|
|
87
|
+
Builds a `Netan` container from one or multiple Rodin‑like objects by aligning them to shared samples. Prints concise pre/post stats.
|
|
88
|
+
|
|
89
|
+
- **Parameters**
|
|
90
|
+
- `rodins`: a single object or a list of objects exposing `.X` and `.samples` (optionally `.features`, `.uns`).
|
|
91
|
+
- `names`: optional list of human‑readable layer names (defaults to `r.uns['file_name']` or `layer{i}`).
|
|
92
|
+
|
|
93
|
+
- **Returns**: `Netan` (with `.G` unset until you call `.build`).
|
|
94
|
+
|
|
95
|
+
### `Netan.build(method='rf', node_mode='samples', layer_mode='multilayer', edge_threshold=0.025, weights=True, layout='force-directed', combine='mean', n_jobs=-1, **kwargs) -> self`
|
|
96
|
+
Constructs the network in `self.G` and stores a 2D layout on nodes.
|
|
97
|
+
|
|
98
|
+
- **Common parameters**
|
|
99
|
+
- `method`: `'spearman' | 'clr' | 'rf' | 'glasso'`.
|
|
100
|
+
- `node_mode`: `'samples' | 'features'` — whether nodes represent samples or features.
|
|
101
|
+
- `layer_mode`: `'stack' | 'multilayer'` — combine inputs into one layer or keep them separate with fusion.
|
|
102
|
+
- `edge_threshold`: float — threshold applied to the method‑specific weight matrix.
|
|
103
|
+
- `weights`: bool — store edge weights as `G[u][v]['weight']`.
|
|
104
|
+
- `layout`: `'force-directed'|'spring'|'circular'|'kamada_kawai'|'random'` — determines `x`,`y`.
|
|
105
|
+
- `combine`: `'mean'|'median'|'max'` — fusion rule in `samples+multilayer` mode.
|
|
106
|
+
- `n_jobs`: int — parallelism for CLR/RF.
|
|
107
|
+
|
|
108
|
+
- **Method‑specific `**kwargs`**
|
|
109
|
+
- `clr`: `n_neighbors=int`.
|
|
110
|
+
- `rf`: `n_estimators=int`, `max_depth=int|None` (0/''/None ⇒ `None`).
|
|
111
|
+
- `glasso`: `alpha=float`, `max_iter=int`, `tol=float` (default 1e‑4).
|
|
112
|
+
|
|
113
|
+
- **Returns**: `self`. After the call, `self.G` is a `networkx.Graph` with edge attributes `weight`, `layer`, `layers`; nodes have `x`,`y`,`display_id`,`community` (and in features mode: `object`,`file`,`type`,`compound` when metadata is available).
|
|
114
|
+
|
|
115
|
+
### `Netan.plot(color=None, shape=None, layer=None, hide_isolated=False, weight_min=None, weight_max=None, node_size=10, width=None, height=None, title='Network Plot', continuous_colorscale='Viridis') -> plotly.graph_objs.FigureWidget`
|
|
116
|
+
Creates an interactive Plotly network figure.
|
|
117
|
+
|
|
118
|
+
- **Color/shape**
|
|
119
|
+
- *Categorical* color/shape splits nodes into legend groups; hiding a group removes its incident edges on the fly.
|
|
120
|
+
- *Continuous* color shows a colorbar (legend toggling disabled).
|
|
121
|
+
|
|
122
|
+
- **Layer/weight filters**
|
|
123
|
+
- `layer`: keep an edge if that layer label is present in its `layers` set.
|
|
124
|
+
- `weight_min/max`: numeric bounds for pruning edges by weight.
|
|
125
|
+
|
|
126
|
+
- **Display**: returns a `FigureWidget` suitable for notebooks/dashboards.
|
|
127
|
+
|
|
128
|
+
### `Netan.to_csv(path=None, sep=',', index=False, float_format=None) -> pandas.DataFrame`
|
|
129
|
+
Exports a flat edge list. Columns: `source, target, weight, layer, layers`.
|
|
130
|
+
|
|
131
|
+
- In *features* node mode: adds `source_compound, target_compound` if known.
|
|
132
|
+
- **Cytoscape tip**: set **Advanced → List delimiter = `|`** so `layers` parses as list.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Threshold Tips
|
|
137
|
+
|
|
138
|
+
- **Spearman**: `0.7–0.9` (use higher for sparser graphs).
|
|
139
|
+
- **CLR**: `2–5` (start at `3`).
|
|
140
|
+
- **RF (ExtraTrees)**: `0.02–0.10`.
|
|
141
|
+
- **Glasso**: `0.1–0.3` for `edge_threshold`; increase `alpha` (`0.1–0.2`) if convergence is hard.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Performance & Limits
|
|
146
|
+
|
|
147
|
+
- Soft **density guard** around ~10,000 edges (`MAX_EDGES`); warnings suggest raising thresholds or reducing nodes.
|
|
148
|
+
- Complexity:
|
|
149
|
+
- `spearman/CLR/RF`: ~O(p²) in the number of nodes per layer.
|
|
150
|
+
- `glasso`: ~O(p³)`; consider increasing `alpha` or reducing dimensionality.
|
|
151
|
+
- Use `n_jobs` to parallelize CLR/RF.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Troubleshooting
|
|
156
|
+
|
|
157
|
+
- **Graph too dense** → raise `edge_threshold`, use a stricter method (`glasso`), or reduce variables.
|
|
158
|
+
- **`GraphicalLasso failed`** → increase `alpha` (e.g., `0.1–0.2`), relax `tol`, ensure proper scaling.
|
|
159
|
+
- **Empty plot** → check `layer` and `weight_min/max` filters and that inputs share sample IDs.
|
|
160
|
+
- **Too many categories for `shape`** → map values to fewer categories (limited symbol set).
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
MIT (see `LICENSE`).
|
|
167
|
+
|