FedGWAS 0.3.1__py3-none-any.whl

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.
@@ -0,0 +1,276 @@
1
+ Metadata-Version: 2.4
2
+ Name: FedGWAS
3
+ Version: 0.3.1
4
+ Summary: Federated genome-wide association study pipeline built with Flower and PLINK
5
+ Project-URL: Homepage, https://github.com/sitaomin1994/FedGWAS_pipeline
6
+ Project-URL: Repository, https://github.com/sitaomin1994/FedGWAS_pipeline
7
+ Project-URL: Issues, https://github.com/sitaomin1994/FedGWAS_pipeline/issues
8
+ Project-URL: Documentation, https://github.com/sitaomin1994/FedGWAS_pipeline#readme
9
+ Author: idsla
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: bioinformatics,federated-learning,flower,gwas,plink
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: flwr[simulation]<1.20,>=1.19.0
22
+ Requires-Dist: mkdocs>=1.6.1
23
+ Requires-Dist: numpy>=1.21.0
24
+ Requires-Dist: pandas-plink>=2.3.1
25
+ Requires-Dist: pandas>=2.2.2
26
+ Requires-Dist: phe>=1.5.0
27
+ Requires-Dist: pycryptodomex>=3.19.0
28
+ Requires-Dist: pyplink>=1.3.7
29
+ Requires-Dist: pysnptools>=0.5.13
30
+ Requires-Dist: scipy>=1.9.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: flake8-docstrings>=1.7.0; extra == 'dev'
33
+ Requires-Dist: flake8>=7.1.0; extra == 'dev'
34
+ Requires-Dist: isort>=5.13.2; extra == 'dev'
35
+ Requires-Dist: mypy>=1.10.1; extra == 'dev'
36
+ Requires-Dist: pre-commit>=3.7.1; extra == 'dev'
37
+ Requires-Dist: pylint>=3.2.5; extra == 'dev'
38
+ Requires-Dist: pytest>=8.2.2; extra == 'dev'
39
+ Requires-Dist: tox>=4.16.0; extra == 'dev'
40
+ Description-Content-Type: text/markdown
41
+
42
+ # Federated GWAS Pipeline
43
+
44
+ This repository implements a federated pipeline for Genome-Wide Association Studies (GWAS) using Flower, PLINK, and custom privacy-preserving protocols. The pipeline supports multi-stage, multi-client GWAS with reproducible outputs and structured logging.
45
+
46
+ For release verification steps, see [RELEASE.md](RELEASE.md). For implementation details and change history, see [CURRENT_VERSION.md](CURRENT_VERSION.md).
47
+
48
+ ---
49
+
50
+ ## Environment Setup
51
+
52
+ ### Option 1: UV (recommended)
53
+
54
+ Install [uv](https://docs.astral.sh/uv/):
55
+
56
+ ```bash
57
+ curl -LsSf https://astral.sh/uv/install.sh | sh
58
+ ```
59
+
60
+ Sync dependencies (Python 3.11+):
61
+
62
+ ```bash
63
+ uv sync --python 3.11
64
+ ```
65
+
66
+ Optional dev dependencies:
67
+
68
+ ```bash
69
+ uv sync --dev
70
+ ```
71
+
72
+ ### Option 2: Conda
73
+
74
+ ```bash
75
+ conda create -n fedgwas python=3.11 -y
76
+ conda activate fedgwas
77
+ pip install -e .
78
+ pip install -U "flwr[simulation]"
79
+ ```
80
+
81
+ ---
82
+
83
+ ## PLINK
84
+
85
+ - Requires [PLINK 1.9+](https://www.cog-genomics.org/plink/1.9/).
86
+ - Download the binary for your OS and ensure `plink` is on your `PATH`, or set the path in each client `config.yaml` (`plink.path` if configured).
87
+ - Toy reference files are under `plink/`; production runs use experiment data under `experiments/`.
88
+
89
+ ---
90
+
91
+ ## Quick Start (Recommended: tiny_even)
92
+
93
+ The default Flower config in `pyproject.toml` points to `experiments/correctness/tiny_even/configs` (2 clients, tiny synthetic data).
94
+
95
+ ### Repository layout (experiments)
96
+
97
+ ```
98
+ experiments/correctness/tiny_even/
99
+ ├── config.yaml
100
+ ├── configs/
101
+ │ ├── server/config.yaml
102
+ │ ├── center_1/config.yaml
103
+ │ └── center_2/config.yaml
104
+ ├── data/tiny/
105
+ │ ├── center_1/ # PLINK .bed/.bim/.fam per client
106
+ │ ├── center_2/
107
+ │ └── centralized_baseline/ # after generate_baseline
108
+ └── results_2/ # gitignored; current shipped config output
109
+ ```
110
+
111
+ Config templates: [configs/config_template.yaml](configs/config_template.yaml).
112
+
113
+ ### 1. Generate synthetic data (if not present)
114
+
115
+ ```bash
116
+ python pipeline/simulation/simulated_data/generate_synthetic_data.py \
117
+ --scale tiny \
118
+ --partition-strategy even \
119
+ --seed 42 \
120
+ --output-dir experiments/correctness/tiny_even/data
121
+ ```
122
+
123
+ ### 2. Generate centralized baseline
124
+
125
+ ```bash
126
+ python experiments/tools/generate_baseline.py \
127
+ experiments/correctness/tiny_even/config.yaml
128
+ ```
129
+
130
+ ### 3. Run federated pipeline (simulation)
131
+
132
+ ```bash
133
+ flwr run . local-simulation --stream
134
+ ```
135
+
136
+ Override rounds or config path:
137
+
138
+ ```bash
139
+ flwr run . local-simulation --stream --run-config \
140
+ 'simulation=true num-server-rounds=100 config_path="experiments/correctness/tiny_even/configs"'
141
+ ```
142
+
143
+ Results are written under each client's `logs/` and `intermediate/` directories (paths set in per-center `config.yaml`). The shipped tiny configs currently write under `experiments/correctness/tiny_even/results_2/`; use the paths in the active center and server config files as the source of truth.
144
+
145
+ ### 4. Retention (optional, automatic)
146
+
147
+ Experiment `config.yaml` may set `retention.tier` (`minimal` | `standard` | `research`). When `auto_apply_on_complete: true`, the server prunes non-essential artifacts after the run. Manual:
148
+
149
+ ```bash
150
+ python experiments/tools/apply_run_retention.py \
151
+ experiments/correctness/tiny_even/results \
152
+ --config-path experiments/correctness/tiny_even/configs \
153
+ --dry-run
154
+ ```
155
+
156
+ See [RELEASE.md](RELEASE.md) for tier definitions.
157
+
158
+ ### 5. Evaluate against baseline
159
+
160
+ ```bash
161
+ python experiments/tools/evaluation/evaluate_all.py \
162
+ experiments/correctness/tiny_even/results_2 \
163
+ --baseline experiments/correctness/tiny_even/data/tiny/centralized_baseline \
164
+ --king
165
+ ```
166
+
167
+ See [experiments/correctness/tiny_even/README.md](experiments/correctness/tiny_even/README.md) for expected metrics and success criteria. If you changed the output paths in the active configs, pass that results directory instead.
168
+
169
+ ---
170
+
171
+ ## Documentation Site
172
+
173
+ The Docusaurus site is isolated under `website/` and reads Markdown from the repository-level `docs/` directory.
174
+
175
+ ```bash
176
+ cd website
177
+ npm install
178
+ npm run start
179
+ npm run build
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Three-Node Cluster Deployment
185
+
186
+ For Matpool or any 3-node layout (1 SuperLink + 2 SuperNodes), use the bundled scripts and guide:
187
+
188
+ - **Guide:** [cluster_deployment/docs/CLUSTER_USER_GUIDE.md](cluster_deployment/docs/CLUSTER_USER_GUIDE.md)
189
+ - **Scripts:** [cluster_deployment/README.md](cluster_deployment/README.md)
190
+
191
+ ```bash
192
+ bash cluster_deployment/scripts/setup-cluster-node.sh # each node
193
+ bash cluster_deployment/scripts/cluster-verify-data.sh --scale tiny --client-id 1 # each client
194
+ cluster_deployment/scripts/cluster-run-app.sh \
195
+ --server-ip <SERVER_IP> --scale tiny --rounds 20
196
+ ```
197
+
198
+ Performance scales (small/medium): `experiments/performance/scales.yaml` and per-scale READMEs under `small_even/`, `medium_even/`.
199
+
200
+ ---
201
+
202
+ ## Local Deployment Mode
203
+
204
+ Requires SuperLink + two SuperNodes + `flwr run`:
205
+
206
+ ```bash
207
+ flower-superlink --insecure
208
+ ```
209
+
210
+ ```bash
211
+ flower-supernode --insecure --superlink 127.0.0.1:9092 --clientappio-api-address 127.0.0.1:9094 \
212
+ --node-config 'partition-id=0 num-partitions=2 config-file="experiments/correctness/tiny_even/configs/center_1/config.yaml"'
213
+ ```
214
+
215
+ ```bash
216
+ flower-supernode --insecure --superlink 127.0.0.1:9092 --clientappio-api-address 127.0.0.1:9095 \
217
+ --node-config 'partition-id=1 num-partitions=2 config-file="experiments/correctness/tiny_even/configs/center_2/config.yaml"'
218
+ ```
219
+
220
+ ```bash
221
+ flwr run . local-deployment --stream
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Advanced: Real-World Experiments
227
+
228
+ Larger studies (e.g. 1000 Genomes subset) live under `experiments/real_world/1000genomes/`. These require downloading/preparing data, longer runtime, and overriding `config_path`:
229
+
230
+ ```bash
231
+ flwr run . local-simulation --stream --run-config \
232
+ 'config_path="experiments/real_world/1000genomes/configs"'
233
+ ```
234
+
235
+ Manuscript figures and prior run outputs under `experiments/real_world/1000genomes/manuscript/` are research artifacts and are not required for the default release path.
236
+
237
+ ---
238
+
239
+ ## Output and Logs
240
+
241
+ - Per-client `intermediate_dir` and `log_dir` are defined in each center `config.yaml`.
242
+ - Directories are cleared at the start of each client run to avoid stale artifacts.
243
+ - Stage progress and errors go to per-client log files under each configured `output.log_dir`.
244
+ - Inspect PLINK outputs (`.assoc.logistic`, `.imiss`, `.frq`, KING kinship files) directly under each client's `logs/`.
245
+
246
+ ---
247
+
248
+ ## Federated Protocol (Summary)
249
+
250
+ 1. **Key exchange** — ECC public keys via server relay
251
+ 2. **Sync** — Encrypted seed broadcast (server cannot decrypt)
252
+ 3. **Local / global QC** — Encrypted QC shares; exclusion list computed client-side
253
+ 4. **Iterative KING** — Chunked kinship with cross-client anonymized IDs
254
+ 5. **Local LR + filtering** — Tokenized insignificant SNPs
255
+ 6. **Iterative LR** — Chunked association on filtered data
256
+
257
+ Full stage contracts and privacy model: [CURRENT_VERSION.md](CURRENT_VERSION.md).
258
+
259
+ ---
260
+
261
+ ## Troubleshooting
262
+
263
+ - **PLINK not found** — Install PLINK 1.9+ and verify `plink` is on `PATH` or configured in `config.yaml`.
264
+ - **Wrong config** — Check `config_path` in `pyproject.toml` or pass `--run-config`.
265
+ - **Empty results** — Ensure data and baseline exist under `experiments/correctness/tiny_even/data/`.
266
+ - **Reproducibility** — Use fixed seeds in data generation and consistent `config_path` across runs.
267
+
268
+ ---
269
+
270
+ ## Contributing
271
+
272
+ Open issues or pull requests for bug fixes, improvements, or new features.
273
+
274
+ ## Acknowledgments
275
+
276
+ Built with [Flower](https://flower.dev/), [PLINK](https://www.cog-genomics.org/plink/1.9/), and open-source Python tools.
@@ -0,0 +1,33 @@
1
+ pipeline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ pipeline/client_app.py,sha256=8NhmZ6ws0DjdxBoisoCmQpO8hkcfP9P6RkfLp05H4fA,76059
3
+ pipeline/server_app.py,sha256=ZaZFMHmXvCRZ2rDtHUH4ERpI_4qc5_bA8tQoK_S-taM,7463
4
+ pipeline/clients/__init__.py,sha256=qmcR76ATEDZRPrr4nhKpfelaRpl39u-5fnr53IPnRjQ,68
5
+ pipeline/clients/base_client.py,sha256=8PPSBoJolXkc21JRCHBPK_5JVT9nwrSz0Re7ZpqN0VM,28597
6
+ pipeline/clients/c2c_payloads.py,sha256=hekG0Hdrfxr0zw8x1g_qO8AQTZnPAmks7Juvpan7fkA,1216
7
+ pipeline/clients/client_qc_aggregator.py,sha256=59Ny0gUI9BCExl-BcQbALYmb463NirOI1qgn26IpYSY,7335
8
+ pipeline/clients/client_to_client.py,sha256=gMB7pJ9mENuYOioZnV5XklBxfcCdAWkYczawZLwr6Fg,5929
9
+ pipeline/clients/config.yaml,sha256=-jvMk-_ztdPbUtpgmNnD4Cr4D73yVy6nmSCHFw9BPp8,924
10
+ pipeline/clients/data_loder.py,sha256=VFJdLw58VG3HqzXvBe5B3-C2Ub-lUyUEad3l5XFHx3U,7242
11
+ pipeline/clients/flwr_config.py,sha256=HgYCELbxfzFPKx4fRjSYQNXisD1kbM6zCfKRjqmw7uk,763
12
+ pipeline/clients/iterative_king.py,sha256=acDvoSQ3UH617bxkzpF4CS50VpKS1dxJwemThHy4_xU,54613
13
+ pipeline/clients/iterative_lr.py,sha256=BAr5XgAZqDCJqsvvs7BvtO1pVQ9hWG3vG5CGdHvfYIU,23009
14
+ pipeline/clients/local_qc.py,sha256=hpZasg6JQwWR0Ajm-B4ovVBiU2X1KxNCGKBH0XH_4M0,10832
15
+ pipeline/clients/logger_manager.py,sha256=Fsi_8rSIrZyOlQhzyrKHxJZ_HP2w3FbHUEi4qgdu3bI,3526
16
+ pipeline/clients/lr_privacy.py,sha256=L8W8XjDYxLv0fMMyagezHUlun2N5VHoelo80fgGzFyI,1998
17
+ pipeline/clients/seed_sync.py,sha256=BdVgzPiiQNWNpMF65HIXxdpKa_cO9WrKPfj3pcpJJ0A,6550
18
+ pipeline/server/aggregator_king.py,sha256=ijVNBRcweRQjRqeXGSijROASXYYynQ1J74PE62FxulM,19542
19
+ pipeline/server/aggregator_lr.py,sha256=rHOC2F_g9OegBBRIp0bpolh_WwL5fNINwywzaZLMd44,20260
20
+ pipeline/server/prg_masking.py,sha256=y3kPVX-oxK7JwldlKqoFSvHb8FPS_QIiXaLAtFQB3RY,7268
21
+ pipeline/server/strategy_strict.py,sha256=K3vmab7wFdTdGeJoR9yTSMNQYQM2pEMZgH15NcSc_qk,23450
22
+ pipeline/utils/client_data_loader.py,sha256=H2hatXmB6bsiSAeI7IZDrC4DHxuovmAT0UOpKHHbiBw,280
23
+ pipeline/utils/monitoring_config.py,sha256=whYZmtLKsQQMRzl5TyfqvMo0fqf6KTT_zj1UWsosOfI,3911
24
+ pipeline/utils/retention_config.py,sha256=Ek1ZnDaXH-znEjpGiC1glorhz8vpFOzi-X8saM4XtMQ,3975
25
+ pipeline/utils/run_retention.py,sha256=YcIPSX0xmXgzPeuEfvowNqpigumTOrm83QoUSBYK-l4,7819
26
+ pipeline/utils/performance/__init__.py,sha256=v5Kpj6GirXMJZfeDMKjKISiXQB3a57Vx8bS129KOngY,506
27
+ pipeline/utils/performance/monitoring_runtime.py,sha256=G_wuNrCIKzctnwvititlDyZzqr8u5QihNSNeS6rF7kI,7588
28
+ pipeline/utils/performance/network_monitor.py,sha256=8prB1ucMuYoFoEnuVkkN3B3JTFABr83ECNBRl_fUSdg,14679
29
+ pipeline/utils/performance/performance_monitoring.py,sha256=Vp5_PNv4GoBtyYhwvyCsCuJPfFdt1AEJY1dhDGq0ybg,23333
30
+ fedgwas-0.3.1.dist-info/METADATA,sha256=En45321-Iyk5Wt2eNAw_XmsIz16bWktQmjiT-lQitvk,9298
31
+ fedgwas-0.3.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
32
+ fedgwas-0.3.1.dist-info/licenses/LICENSE,sha256=RARUjEIJIu5yUUi79GcnAVlVuLsH8AZTlqBOoKp_Xog,1062
33
+ fedgwas-0.3.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 idsla
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.
pipeline/__init__.py ADDED
File without changes