bsvae 0.2.1__tar.gz → 0.3.1__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.
- bsvae-0.3.1/PKG-INFO +204 -0
- bsvae-0.3.1/README.md +172 -0
- {bsvae-0.2.1 → bsvae-0.3.1}/pyproject.toml +19 -10
- bsvae-0.3.1/src/bsvae/__init__.py +13 -0
- bsvae-0.3.1/src/bsvae/cli/__init__.py +1 -0
- bsvae-0.3.1/src/bsvae/cli/networks.py +287 -0
- bsvae-0.3.1/src/bsvae/cli/simulate.py +256 -0
- bsvae-0.3.1/src/bsvae/cli/sweep_k.py +511 -0
- bsvae-0.3.1/src/bsvae/cli/train.py +241 -0
- bsvae-0.3.1/src/bsvae/hyperparam.ini +9 -0
- bsvae-0.3.1/src/bsvae/latent/__init__.py +89 -0
- {bsvae-0.2.1 → bsvae-0.3.1}/src/bsvae/latent/latent_analysis.py +31 -23
- {bsvae-0.2.1 → bsvae-0.3.1}/src/bsvae/main.py +132 -27
- bsvae-0.3.1/src/bsvae/models/__init__.py +5 -0
- bsvae-0.3.1/src/bsvae/models/decoder.py +58 -0
- bsvae-0.3.1/src/bsvae/models/encoder.py +85 -0
- bsvae-0.3.1/src/bsvae/models/gmm_prior.py +296 -0
- bsvae-0.3.1/src/bsvae/models/gmvae.py +133 -0
- bsvae-0.3.1/src/bsvae/models/losses.py +452 -0
- bsvae-0.3.1/src/bsvae/networks/__init__.py +2 -0
- {bsvae-0.2.1 → bsvae-0.3.1}/src/bsvae/networks/cli.py +203 -59
- bsvae-0.3.1/src/bsvae/networks/extract_networks.py +363 -0
- {bsvae-0.2.1 → bsvae-0.3.1}/src/bsvae/networks/module_extraction.py +326 -177
- {bsvae-0.2.1 → bsvae-0.3.1}/src/bsvae/networks/utils.py +7 -2
- bsvae-0.3.1/src/bsvae/simulation/__init__.py +24 -0
- bsvae-0.3.1/src/bsvae/simulation/generate.py +116 -0
- bsvae-0.3.1/src/bsvae/simulation/metrics.py +154 -0
- bsvae-0.3.1/src/bsvae/simulation/scenario.py +556 -0
- bsvae-0.3.1/src/bsvae/utils/__init__.py +1 -0
- bsvae-0.3.1/src/bsvae/utils/datasets.py +305 -0
- {bsvae-0.2.1 → bsvae-0.3.1}/src/bsvae/utils/evaluate.py +14 -7
- bsvae-0.3.1/src/bsvae/utils/hierarchy.py +172 -0
- bsvae-0.3.1/src/bsvae/utils/modelIO.py +190 -0
- bsvae-0.3.1/src/bsvae/utils/training.py +473 -0
- bsvae-0.2.1/PKG-INFO +0 -245
- bsvae-0.2.1/README.md +0 -212
- bsvae-0.2.1/src/bsvae/__init__.py +0 -12
- bsvae-0.2.1/src/bsvae/hyperparam.ini +0 -82
- bsvae-0.2.1/src/bsvae/latent/__init__.py +0 -6
- bsvae-0.2.1/src/bsvae/models/__init__.py +0 -4
- bsvae-0.2.1/src/bsvae/models/decoder.py +0 -92
- bsvae-0.2.1/src/bsvae/models/encoder.py +0 -71
- bsvae-0.2.1/src/bsvae/models/losses.py +0 -116
- bsvae-0.2.1/src/bsvae/models/structured.py +0 -79
- bsvae-0.2.1/src/bsvae/networks/__init__.py +0 -13
- bsvae-0.2.1/src/bsvae/networks/extract_networks.py +0 -1436
- bsvae-0.2.1/src/bsvae/ppi_cli.py +0 -51
- bsvae-0.2.1/src/bsvae/utils/__init__.py +0 -2
- bsvae-0.2.1/src/bsvae/utils/datasets.py +0 -187
- bsvae-0.2.1/src/bsvae/utils/mapping.py +0 -218
- bsvae-0.2.1/src/bsvae/utils/modelIO.py +0 -187
- bsvae-0.2.1/src/bsvae/utils/ppi.py +0 -158
- bsvae-0.2.1/src/bsvae/utils/training.py +0 -143
- {bsvae-0.2.1 → bsvae-0.3.1}/LICENSE +0 -0
- {bsvae-0.2.1 → bsvae-0.3.1}/src/bsvae/latent/latent_export.py +0 -0
- {bsvae-0.2.1 → bsvae-0.3.1}/src/bsvae/models/vae.py +0 -0
- {bsvae-0.2.1 → bsvae-0.3.1}/src/bsvae/utils/helpers.py +0 -0
- {bsvae-0.2.1 → bsvae-0.3.1}/src/bsvae/utils/initialization.py +0 -0
bsvae-0.3.1/PKG-INFO
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bsvae
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Gaussian Mixture VAE for multi-modal biological module discovery in omics data.
|
|
5
|
+
License: GPL-3.0-only
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: variational-autoencoder,gaussian-mixture-model,pytorch,bioinformatics,gene-expression,module-discovery,omics
|
|
8
|
+
Author: Kynon J Benjamin
|
|
9
|
+
Author-email: kj.benjamin90@gmail.com
|
|
10
|
+
Requires-Python: >=3.11,<3.14
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
19
|
+
Requires-Dist: faiss-cpu (>=1.7)
|
|
20
|
+
Requires-Dist: h5py (>=3.0)
|
|
21
|
+
Requires-Dist: numpy (<2.3)
|
|
22
|
+
Requires-Dist: pandas (>=2.3.2,<3.0.0)
|
|
23
|
+
Requires-Dist: scikit-learn (>=1.7.2,<2.0.0)
|
|
24
|
+
Requires-Dist: scipy (>=1.16.2,<2.0.0)
|
|
25
|
+
Requires-Dist: torch (>=2.8.0,<3.0.0)
|
|
26
|
+
Requires-Dist: tqdm (>=4.67.1,<5.0.0)
|
|
27
|
+
Project-URL: Bug Tracker, https://github.com/heart-gen/BSVAE/issues
|
|
28
|
+
Project-URL: homepage, https://bsvae.readthedocs.io/en/latest/
|
|
29
|
+
Project-URL: repository, https://github.com/heart-gen/BSVAE
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# BSVAE: Gaussian Mixture VAE for Module Discovery
|
|
33
|
+
|
|
34
|
+
[](https://pytorch.org/)
|
|
35
|
+
[](https://python.org/)
|
|
36
|
+
[](LICENSE)
|
|
37
|
+
[](https://bsvae.readthedocs.io/)
|
|
38
|
+
|
|
39
|
+
BSVAE is a PyTorch package centered on `GMMModuleVAE`, a Gaussian-mixture variational autoencoder for feature-level module discovery in omics data.
|
|
40
|
+
|
|
41
|
+
## What It Does
|
|
42
|
+
|
|
43
|
+
- Trains a two-phase GMM-VAE (`bsvae-train`)
|
|
44
|
+
- Extracts feature-feature networks from trained models (`bsvae-networks`)
|
|
45
|
+
- Extracts module assignments and optional eigengenes (`bsvae-networks`)
|
|
46
|
+
- Exports latents (`mu`, `logvar`, `gamma`) as `.npz`
|
|
47
|
+
- Runs latent analysis (UMAP/t-SNE, clustering, covariate correlation) (`bsvae-networks latent-analysis`)
|
|
48
|
+
- Simulates synthetic datasets and benchmarks module recovery (`bsvae-simulate`)
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
From PyPI:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install bsvae
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
From source:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git clone https://github.com/heart-gen/BSVAE.git
|
|
62
|
+
cd BSVAE
|
|
63
|
+
pip install -e .
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## CLI Entry Points
|
|
67
|
+
|
|
68
|
+
- `bsvae-train`
|
|
69
|
+
- `bsvae-networks`
|
|
70
|
+
- `bsvae-simulate`
|
|
71
|
+
|
|
72
|
+
## Quickstart
|
|
73
|
+
|
|
74
|
+
For a full walkthrough (minimal run, production run, post-training analysis, simulation benchmark, troubleshooting, and migration), see `docs/tutorial.md`.
|
|
75
|
+
|
|
76
|
+
### Tune K (Recommended)
|
|
77
|
+
|
|
78
|
+
`--n-modules` (K) sets the expected number of modules. Recommended approach is
|
|
79
|
+
`bsvae-sweep-k` with stability replicates:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
bsvae-sweep-k sweep1 \
|
|
83
|
+
--dataset data/expression.csv \
|
|
84
|
+
--k-grid 8,12,16,24,32 \
|
|
85
|
+
--sweep-epochs 60 \
|
|
86
|
+
--stability-reps 5 \
|
|
87
|
+
--val-frac 0.1
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The selected model is retrained on the full dataset at:
|
|
91
|
+
`results/sweep1/final_k<K>/`.
|
|
92
|
+
|
|
93
|
+
### 1. Train
|
|
94
|
+
|
|
95
|
+
Input matrix must be `features x samples` with feature IDs in row index and sample IDs in columns.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
bsvae-train exp1 \
|
|
99
|
+
--dataset data/expression.csv \
|
|
100
|
+
--epochs 100 \
|
|
101
|
+
--n-modules 20 \
|
|
102
|
+
--latent-dim 32
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 2. Extract networks
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
bsvae-networks extract-networks \
|
|
109
|
+
--model-path results/exp1 \
|
|
110
|
+
--dataset data/expression.csv \
|
|
111
|
+
--output-dir results/exp1/networks \
|
|
112
|
+
--methods mu_cosine gamma_knn
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 3. Extract modules
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
bsvae-networks extract-modules \
|
|
119
|
+
--model-path results/exp1 \
|
|
120
|
+
--dataset data/expression.csv \
|
|
121
|
+
--output-dir results/exp1/modules
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 4. Export latents
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
bsvae-networks export-latents \
|
|
128
|
+
--model-path results/exp1 \
|
|
129
|
+
--dataset data/expression.csv \
|
|
130
|
+
--output results/exp1/latents.npz
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 5. Simulate and benchmark
|
|
134
|
+
|
|
135
|
+
Single dataset:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
bsvae-simulate generate \
|
|
139
|
+
--output data/sim_expr.csv \
|
|
140
|
+
--save-ground-truth data/sim_truth.csv
|
|
141
|
+
|
|
142
|
+
bsvae-simulate benchmark \
|
|
143
|
+
--dataset data/sim_expr.csv \
|
|
144
|
+
--ground-truth data/sim_truth.csv \
|
|
145
|
+
--model-path results/exp1 \
|
|
146
|
+
--output results/exp1/sim_metrics.json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Scenario grid for publication-style benchmarking:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
bsvae-simulate init-config --output sim.yaml
|
|
153
|
+
|
|
154
|
+
bsvae-simulate generate-grid \
|
|
155
|
+
--config sim.yaml \
|
|
156
|
+
--outdir results/sim_pub_v1 \
|
|
157
|
+
--reps 30 \
|
|
158
|
+
--base-seed 13
|
|
159
|
+
|
|
160
|
+
bsvae-simulate validate-grid --grid-dir results/sim_pub_v1
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Each scenario replicate writes method-ready files under
|
|
164
|
+
`results/sim_pub_v1/scenarios/<scenario_id>/rep_<rep>/`, including:
|
|
165
|
+
|
|
166
|
+
- `expr/features_x_samples.tsv.gz` (BSVAE, GNVAE)
|
|
167
|
+
- `expr/samples_x_features.tsv.gz` (WGCNA)
|
|
168
|
+
- `truth/modules_hard.csv` (hard labels for ARI/NMI)
|
|
169
|
+
- `method_inputs.json` (canonical paths for each method)
|
|
170
|
+
|
|
171
|
+
## Training Outputs
|
|
172
|
+
|
|
173
|
+
`bsvae-train` writes to `results/<experiment>/`:
|
|
174
|
+
|
|
175
|
+
- `model.pt` (weights)
|
|
176
|
+
- `specs.json` (metadata and run args)
|
|
177
|
+
- `train_losses.csv` (epoch/component losses)
|
|
178
|
+
- `model-<epoch>.pt` checkpoints when `--checkpoint-every` is set
|
|
179
|
+
|
|
180
|
+
## Data Formats
|
|
181
|
+
|
|
182
|
+
The loader supports:
|
|
183
|
+
|
|
184
|
+
- `.csv` / `.csv.gz`
|
|
185
|
+
- `.tsv` / `.tsv.gz`
|
|
186
|
+
- `.h5` / `.hdf5`
|
|
187
|
+
- `.h5ad` (optional `anndata` dependency)
|
|
188
|
+
|
|
189
|
+
## Python API (Minimal)
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
from bsvae.utils.modelIO import load_model
|
|
193
|
+
from bsvae.networks.extract_networks import create_dataloader_from_expression, run_extraction
|
|
194
|
+
|
|
195
|
+
model = load_model("results/exp1", is_gpu=False)
|
|
196
|
+
loader, feature_ids, _ = create_dataloader_from_expression("data/expression.csv", batch_size=128)
|
|
197
|
+
results = run_extraction(model, loader, feature_ids=feature_ids, methods=["mu_cosine"], top_k=50)
|
|
198
|
+
print(results[0].method, results[0].adjacency.shape)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## License
|
|
202
|
+
|
|
203
|
+
This project is licensed under the [GNU General Public License v3.0](LICENSE).
|
|
204
|
+
|
bsvae-0.3.1/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# BSVAE: Gaussian Mixture VAE for Module Discovery
|
|
2
|
+
|
|
3
|
+
[](https://pytorch.org/)
|
|
4
|
+
[](https://python.org/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://bsvae.readthedocs.io/)
|
|
7
|
+
|
|
8
|
+
BSVAE is a PyTorch package centered on `GMMModuleVAE`, a Gaussian-mixture variational autoencoder for feature-level module discovery in omics data.
|
|
9
|
+
|
|
10
|
+
## What It Does
|
|
11
|
+
|
|
12
|
+
- Trains a two-phase GMM-VAE (`bsvae-train`)
|
|
13
|
+
- Extracts feature-feature networks from trained models (`bsvae-networks`)
|
|
14
|
+
- Extracts module assignments and optional eigengenes (`bsvae-networks`)
|
|
15
|
+
- Exports latents (`mu`, `logvar`, `gamma`) as `.npz`
|
|
16
|
+
- Runs latent analysis (UMAP/t-SNE, clustering, covariate correlation) (`bsvae-networks latent-analysis`)
|
|
17
|
+
- Simulates synthetic datasets and benchmarks module recovery (`bsvae-simulate`)
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
From PyPI:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install bsvae
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
From source:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git clone https://github.com/heart-gen/BSVAE.git
|
|
31
|
+
cd BSVAE
|
|
32
|
+
pip install -e .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## CLI Entry Points
|
|
36
|
+
|
|
37
|
+
- `bsvae-train`
|
|
38
|
+
- `bsvae-networks`
|
|
39
|
+
- `bsvae-simulate`
|
|
40
|
+
|
|
41
|
+
## Quickstart
|
|
42
|
+
|
|
43
|
+
For a full walkthrough (minimal run, production run, post-training analysis, simulation benchmark, troubleshooting, and migration), see `docs/tutorial.md`.
|
|
44
|
+
|
|
45
|
+
### Tune K (Recommended)
|
|
46
|
+
|
|
47
|
+
`--n-modules` (K) sets the expected number of modules. Recommended approach is
|
|
48
|
+
`bsvae-sweep-k` with stability replicates:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
bsvae-sweep-k sweep1 \
|
|
52
|
+
--dataset data/expression.csv \
|
|
53
|
+
--k-grid 8,12,16,24,32 \
|
|
54
|
+
--sweep-epochs 60 \
|
|
55
|
+
--stability-reps 5 \
|
|
56
|
+
--val-frac 0.1
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The selected model is retrained on the full dataset at:
|
|
60
|
+
`results/sweep1/final_k<K>/`.
|
|
61
|
+
|
|
62
|
+
### 1. Train
|
|
63
|
+
|
|
64
|
+
Input matrix must be `features x samples` with feature IDs in row index and sample IDs in columns.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
bsvae-train exp1 \
|
|
68
|
+
--dataset data/expression.csv \
|
|
69
|
+
--epochs 100 \
|
|
70
|
+
--n-modules 20 \
|
|
71
|
+
--latent-dim 32
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 2. Extract networks
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
bsvae-networks extract-networks \
|
|
78
|
+
--model-path results/exp1 \
|
|
79
|
+
--dataset data/expression.csv \
|
|
80
|
+
--output-dir results/exp1/networks \
|
|
81
|
+
--methods mu_cosine gamma_knn
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 3. Extract modules
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
bsvae-networks extract-modules \
|
|
88
|
+
--model-path results/exp1 \
|
|
89
|
+
--dataset data/expression.csv \
|
|
90
|
+
--output-dir results/exp1/modules
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 4. Export latents
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
bsvae-networks export-latents \
|
|
97
|
+
--model-path results/exp1 \
|
|
98
|
+
--dataset data/expression.csv \
|
|
99
|
+
--output results/exp1/latents.npz
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 5. Simulate and benchmark
|
|
103
|
+
|
|
104
|
+
Single dataset:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
bsvae-simulate generate \
|
|
108
|
+
--output data/sim_expr.csv \
|
|
109
|
+
--save-ground-truth data/sim_truth.csv
|
|
110
|
+
|
|
111
|
+
bsvae-simulate benchmark \
|
|
112
|
+
--dataset data/sim_expr.csv \
|
|
113
|
+
--ground-truth data/sim_truth.csv \
|
|
114
|
+
--model-path results/exp1 \
|
|
115
|
+
--output results/exp1/sim_metrics.json
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Scenario grid for publication-style benchmarking:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
bsvae-simulate init-config --output sim.yaml
|
|
122
|
+
|
|
123
|
+
bsvae-simulate generate-grid \
|
|
124
|
+
--config sim.yaml \
|
|
125
|
+
--outdir results/sim_pub_v1 \
|
|
126
|
+
--reps 30 \
|
|
127
|
+
--base-seed 13
|
|
128
|
+
|
|
129
|
+
bsvae-simulate validate-grid --grid-dir results/sim_pub_v1
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Each scenario replicate writes method-ready files under
|
|
133
|
+
`results/sim_pub_v1/scenarios/<scenario_id>/rep_<rep>/`, including:
|
|
134
|
+
|
|
135
|
+
- `expr/features_x_samples.tsv.gz` (BSVAE, GNVAE)
|
|
136
|
+
- `expr/samples_x_features.tsv.gz` (WGCNA)
|
|
137
|
+
- `truth/modules_hard.csv` (hard labels for ARI/NMI)
|
|
138
|
+
- `method_inputs.json` (canonical paths for each method)
|
|
139
|
+
|
|
140
|
+
## Training Outputs
|
|
141
|
+
|
|
142
|
+
`bsvae-train` writes to `results/<experiment>/`:
|
|
143
|
+
|
|
144
|
+
- `model.pt` (weights)
|
|
145
|
+
- `specs.json` (metadata and run args)
|
|
146
|
+
- `train_losses.csv` (epoch/component losses)
|
|
147
|
+
- `model-<epoch>.pt` checkpoints when `--checkpoint-every` is set
|
|
148
|
+
|
|
149
|
+
## Data Formats
|
|
150
|
+
|
|
151
|
+
The loader supports:
|
|
152
|
+
|
|
153
|
+
- `.csv` / `.csv.gz`
|
|
154
|
+
- `.tsv` / `.tsv.gz`
|
|
155
|
+
- `.h5` / `.hdf5`
|
|
156
|
+
- `.h5ad` (optional `anndata` dependency)
|
|
157
|
+
|
|
158
|
+
## Python API (Minimal)
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
from bsvae.utils.modelIO import load_model
|
|
162
|
+
from bsvae.networks.extract_networks import create_dataloader_from_expression, run_extraction
|
|
163
|
+
|
|
164
|
+
model = load_model("results/exp1", is_gpu=False)
|
|
165
|
+
loader, feature_ids, _ = create_dataloader_from_expression("data/expression.csv", batch_size=128)
|
|
166
|
+
results = run_extraction(model, loader, feature_ids=feature_ids, methods=["mu_cosine"], top_k=50)
|
|
167
|
+
print(results[0].method, results[0].adjacency.shape)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
This project is licensed under the [GNU General Public License v3.0](LICENSE).
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "bsvae"
|
|
3
|
-
version = "0.
|
|
4
|
-
description = "
|
|
3
|
+
version = "0.3.1" # dynamically resolved by poetry-dynamic-versioning
|
|
4
|
+
description = "Gaussian Mixture VAE for multi-modal biological module discovery in omics data."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = ["Kynon J Benjamin <kj.benjamin90@gmail.com>"]
|
|
7
7
|
license = "GPL-3.0-only"
|
|
8
8
|
packages = [{ include = "bsvae", from = "src" }]
|
|
9
9
|
keywords = [
|
|
10
10
|
"variational-autoencoder",
|
|
11
|
-
"
|
|
11
|
+
"gaussian-mixture-model",
|
|
12
12
|
"pytorch",
|
|
13
13
|
"bioinformatics",
|
|
14
14
|
"gene-expression",
|
|
15
|
-
"
|
|
15
|
+
"module-discovery",
|
|
16
|
+
"omics",
|
|
16
17
|
]
|
|
17
18
|
classifiers = [
|
|
18
19
|
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
|
@@ -30,12 +31,15 @@ python = ">=3.11,<3.14"
|
|
|
30
31
|
torch = ">=2.8.0,<3.0.0"
|
|
31
32
|
numpy = "<2.3"
|
|
32
33
|
pandas = ">=2.3.2,<3.0.0"
|
|
33
|
-
pyarrow = ">=19.0.0,<20.0.0"
|
|
34
34
|
scikit-learn = ">=1.7.2,<2.0.0"
|
|
35
35
|
tqdm = ">=4.67.1,<5.0.0"
|
|
36
|
-
mygene = ">=3.2.2,<4.0.0"
|
|
37
|
-
networkx = ">=3.5,<4.0"
|
|
38
36
|
scipy = ">=1.16.2,<2.0.0"
|
|
37
|
+
h5py = ">=3.0"
|
|
38
|
+
faiss-cpu = ">=1.7"
|
|
39
|
+
|
|
40
|
+
[tool.poetry.dependencies.anndata]
|
|
41
|
+
version = ">=0.10"
|
|
42
|
+
optional = true
|
|
39
43
|
|
|
40
44
|
[tool.poetry.urls]
|
|
41
45
|
homepage = "https://bsvae.readthedocs.io/en/latest/"
|
|
@@ -43,9 +47,10 @@ repository = "https://github.com/heart-gen/BSVAE"
|
|
|
43
47
|
"Bug Tracker" = "https://github.com/heart-gen/BSVAE/issues"
|
|
44
48
|
|
|
45
49
|
[tool.poetry.scripts]
|
|
46
|
-
bsvae-train = "bsvae.
|
|
47
|
-
bsvae-
|
|
48
|
-
bsvae-
|
|
50
|
+
bsvae-train = "bsvae.cli.train:cli"
|
|
51
|
+
bsvae-networks = "bsvae.cli.networks:cli"
|
|
52
|
+
bsvae-simulate = "bsvae.cli.simulate:cli"
|
|
53
|
+
bsvae-sweep-k = "bsvae.cli.sweep_k:cli"
|
|
49
54
|
|
|
50
55
|
[tool.poetry.group.dev.dependencies]
|
|
51
56
|
pytest = ">=8.4.2,<9.0.0"
|
|
@@ -53,6 +58,10 @@ pytest-cov = ">=7.0.0,<8.0.0"
|
|
|
53
58
|
|
|
54
59
|
[tool.pytest.ini_options]
|
|
55
60
|
pythonpath = ["src"]
|
|
61
|
+
markers = [
|
|
62
|
+
"slow: marks tests as slow-running integration tests (deselect with '-m not slow')",
|
|
63
|
+
]
|
|
64
|
+
addopts = ["-m", "not slow"]
|
|
56
65
|
|
|
57
66
|
[tool.poetry-dynamic-versioning]
|
|
58
67
|
enable = false
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""BSVAE — Gaussian Mixture VAE for multi-modal biological module discovery."""
|
|
2
|
+
|
|
3
|
+
from importlib import import_module
|
|
4
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
5
|
+
|
|
6
|
+
from . import latent, networks, simulation
|
|
7
|
+
|
|
8
|
+
try:
|
|
9
|
+
__version__ = version(__name__)
|
|
10
|
+
except PackageNotFoundError:
|
|
11
|
+
__version__ = "0.0.0"
|
|
12
|
+
|
|
13
|
+
__all__ = ["networks", "latent", "simulation", "__version__"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""CLI entry points for bsvae."""
|