Phylopower 0.1.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.
@@ -0,0 +1,22 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use PhyloPower, please cite this software and the associated manuscript."
3
+ title: "PhyloPower: manuscript-aligned power and sample-size estimation for meta-omics beta-diversity studies"
4
+ type: software
5
+ authors:
6
+ - family-names: Li
7
+ given-names: Yutong
8
+ affiliation: Jilin University
9
+ version: 0.1.0
10
+ date-released: 2026-07-24
11
+ license: MIT
12
+ repository-code: "https://github.com/Yutongli534/PhyloPower"
13
+ keywords:
14
+ - microbiome
15
+ - metagenomics
16
+ - metaproteomics
17
+ - power analysis
18
+ - sample size
19
+ - beta diversity
20
+ - PERMANOVA
21
+ - phylogenetics
22
+ doi: 10.5281/zenodo.21991013
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 π-PhyloPower authors
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.
@@ -0,0 +1,14 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CITATION.cff
4
+ include REPRODUCIBILITY.md
5
+ include phylopower/datagene/*.csv
6
+ include phylopower/datagene/*.nwk
7
+ include phylopower/datapro/sample_metadata.csv
8
+ include phylopower/datapro/taxon_function_table.csv
9
+ include phylopower/datapro/rooted_tree.nwk
10
+ recursive-include phylopower/tutorials *.ipynb
11
+ include requirements-lock.txt
12
+
13
+ prune *.egg-info
14
+ global-exclude *.py[cod]
@@ -0,0 +1,300 @@
1
+ Metadata-Version: 2.4
2
+ Name: Phylopower
3
+ Version: 0.1.0
4
+ Summary: PhyloPower: manuscript-aligned power and minimum-sample-size estimation for meta-omics beta-diversity studies.
5
+ Author: Yutong Li
6
+ License-Expression: MIT
7
+ Keywords: microbiome,metagenomics,metaproteomics,power-analysis,beta-diversity,PERMANOVA,phylogenetic,bootstrap,sample-size,PhyloFunc,Gemelli
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Operating System :: MacOS
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: numpy>=1.22
22
+ Requires-Dist: pandas>=1.5
23
+ Requires-Dist: scipy>=1.9
24
+ Requires-Dist: scikit-bio>=0.6.3
25
+ Requires-Dist: joblib>=1.2
26
+ Requires-Dist: matplotlib>=3.7
27
+ Requires-Dist: tqdm>=4.64
28
+ Requires-Dist: psutil>=5.9
29
+ Requires-Dist: phylofunc<3,>=2.0
30
+ Requires-Dist: biopython>=1.80
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=7; extra == "dev"
33
+ Requires-Dist: ruff>=0.4; extra == "dev"
34
+ Requires-Dist: black>=24.0; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # PhyloPower
38
+
39
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.21991013.svg)](https://doi.org/10.5281/zenodo.21991013)
40
+ ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
41
+
42
+ PhyloPower estimates the minimum balanced per-group sample size required for
43
+ community-level meta-omics studies at a target statistical power and realized
44
+ PERMANOVA effect size (ω²).
45
+
46
+ ## For reviewers
47
+
48
+ The exact code version associated with the manuscript is permanently archived
49
+ at Zenodo: https://doi.org/10.5281/zenodo.21991013. To verify the manuscript's
50
+ claims, start from:
51
+
52
+ - `tutorials/tutorial.ipynb` — end-to-end
53
+ walkthrough of both workflows on the bundled demo data;
54
+ - `figures/README.md` — figure-to-script map: every
55
+ manuscript figure and supplementary figure has exactly one generating
56
+ script, with precomputed result caches so figures can be regenerated
57
+ without re-running the full simulations;
58
+ - `REPRODUCIBILITY.md` — environment setup, seeds, and
59
+ Monte Carlo settings used for the manuscript;
60
+ - `validation_datasets/` — processed external
61
+ validation cohorts with preparation summaries and checksums.
62
+
63
+ These companion files are distributed with the Zenodo archive and are not part
64
+ of the PyPI package; `pip install` provides the Python package and the bundled
65
+ demo datasets only.
66
+
67
+ ## Overview
68
+
69
+ The manuscript-aligned implementation is `phylopower.cli`. It provides
70
+ two raw-pool workflows:
71
+
72
+ | Command | Synthetic generator | Distance |
73
+ |---|---|---|
74
+ | `gene` | PCAM | Gemelli phylogenetic RPCA |
75
+ | `protein` | MDC-TF-MC | PhyloFunc |
76
+
77
+ A step-by-step walkthrough of both workflows is provided in the tutorial
78
+ notebook `tutorials/tutorial.ipynb`. Manuscript
79
+ figure scripts and the figure-to-script map are documented in
80
+ `figures/README.md`.
81
+
82
+ `phylopower/cli.py` is a generated, self-contained runner. It embeds the
83
+ lower-level core and all other project-local runtime modules, so it does not
84
+ import an external `phylopower/core.py`.
85
+
86
+ ## Usage
87
+
88
+ Run the workflows from this directory with `python -m phylopower`, or install
89
+ the package first (`python -m pip install .`) and use the `phylopower`
90
+ command. The bundled `phylopower/datagene/` and `phylopower/datapro/` demo
91
+ datasets are found automatically; set `PHYLOPOWER_DATA_DIR` or provide input
92
+ paths explicitly to use your own data.
93
+
94
+ For the protein workflow, install the runtime dependencies with:
95
+
96
+ ```bash
97
+ python -m pip install \
98
+ "numpy>=1.22" "pandas>=1.5" "scipy>=1.9" "scikit-bio>=0.6.3" \
99
+ "joblib>=1.2" "matplotlib>=3.7" "tqdm>=4.64" "psutil>=5.9" \
100
+ phylofunc "biopython>=1.80"
101
+ ```
102
+
103
+ Both pandas 2.x and 3.x are supported; the workflows are verified against
104
+ pandas 3.0 Copy-on-Write semantics (`DataFrame.to_numpy()` read-only views).
105
+
106
+ The gene workflow must be launched from the compatible QIIME 2 environment
107
+ that contains Gemelli and `biom-format`; selecting that environment only with
108
+ `--qiime-env` is not a substitute for activating it because PCAM calls the
109
+ Gemelli Python API in-process.
110
+
111
+ ```bash
112
+ python -m phylopower --help
113
+
114
+ python -m phylopower gene \
115
+ --table /data/feature_table.csv \
116
+ --tree /data/rooted_tree.nwk \
117
+ --taxonomy /data/taxonomy.csv \
118
+ --group /data/sample_metadata.csv \
119
+ --target-power 0.80 \
120
+ --out gene_result
121
+
122
+ python -m phylopower protein \
123
+ --table /data/taxon_function_table.csv \
124
+ --tree /data/rooted_tree.nwk \
125
+ --group /data/sample_metadata.csv \
126
+ --target-power 0.80 \
127
+ --out protein_result
128
+ ```
129
+
130
+ A full `protein` run with the default Monte Carlo settings targets
131
+ publication-grade estimates and can take tens of minutes and several GB of
132
+ memory. For a quick smoke test on the bundled demo data (reduced Monte Carlo
133
+ effort, not suitable for publication estimates):
134
+
135
+ ```bash
136
+ python -m phylopower protein \
137
+ --target-power 0.80 \
138
+ --min-n 2 --max-n 4 --coarse-step 2 \
139
+ --boot-number 10 --permutations 49 \
140
+ --pool-size-per-group 10 \
141
+ --mdctf-strength-candidates 6 --mdctf-preview-pool-size 60 \
142
+ --power-preview-boot-number 5 --power-preview-permutations 19 \
143
+ --out protein_quick
144
+ ```
145
+
146
+ If `--target-omega2` is omitted, the observed ω² of the resolved pilot is used
147
+ and recorded in `summary.json`.
148
+
149
+ The effect grid is widened automatically when the target ω² exceeds the
150
+ simulated range (`--pcam-scale-extend-max` for `gene`, `--mdctf-strength-max`
151
+ for `protein`). If the target still falls outside the realized ω² range, the
152
+ fitted power at the target would rest on curve extrapolation only: a warning
153
+ is printed, the extrapolated fit is not allowed to qualify, no minimum n is
154
+ reported, and `summary.json` records `"target_omega2_bracketed": false`
155
+ (together with `low_omega_support_warning`). Widen the grid with the flags
156
+ above and rerun in that case.
157
+
158
+ ### Monte Carlo settings
159
+
160
+ The default settings are `--boot-number 200` bootstrap iterations per
161
+ effect level and `--permutations 199` permutations per PERMANOVA; scikit-bio
162
+ applies the `+1` correction internally, so p-value denominators are 200.
163
+ Publication-grade estimates should use substantially larger counts — see
164
+ `REPRODUCIBILITY.md`. All stochastic steps, including
165
+ the PERMANOVA permutation streams and tree perturbation, are deterministically
166
+ derived from `--random-seed`, so a fixed seed reproduces a run bit-for-bit.
167
+
168
+ To inspect the exact embedded-module hashes:
169
+
170
+ ```bash
171
+ python phylopower/cli.py --standalone-info
172
+ ```
173
+
174
+ The maintainable build sources are `phylopower/_cli_source.py` and
175
+ `phylopower/_core_source.py`; both are included under `phylopower/`. They
176
+ are used only to regenerate the self-contained runners; the generated
177
+ `phylopower/cli.py` does not read them at runtime. The regeneration script
178
+ (`scripts/build_standalone.py`) is maintained in the GitHub repository.
179
+
180
+ ### Optional controls
181
+
182
+ - **Parallelism:** `--scenario-n-jobs` sets the number of independent effect
183
+ scenarios processed concurrently, and `--bootstrap-n-jobs` sets the joblib
184
+ workers used inside the bootstrap/PERMANOVA loops (`0` = automatic).
185
+ - **Tree perturbation:** `--tree-jitter-sigma` and `--tree-nni-prob` set the
186
+ perturbation magnitudes; `--tree-support-threshold` restricts NNI to nodes
187
+ below a given support value; `--tree-set trees.nwk` estimates both
188
+ magnitudes from a set of bootstrap or posterior trees, with explicit values
189
+ taking precedence. All tree-perturbation options are off by default.
190
+ - **Pilot stability diagnostic:** `phylopower diagnose --modality
191
+ {gene,protein} --table ... --tree ... --group ... [--taxonomy ...]
192
+ --out diagnosis/` subsamples the pilot, reruns the workflow with a reduced
193
+ effect grid, and reports the median and interquartile range of the resulting
194
+ minimum n.
195
+
196
+ ### Versions used for the manuscript
197
+
198
+ The reported analyses used Python 3.10.14, QIIME 2 2024.10.1 (environment
199
+ `qiime2-metagenome-2024.10`), Gemelli 0.0.12, PhyloFunc 2.0, scikit-bio 0.6.3,
200
+ biom-format 2.1.15, NumPy 1.26.4, pandas 2.2.2, SciPy 1.10.1, Biopython 1.83,
201
+ joblib 1.4.2, Matplotlib 3.8.4, tqdm 4.67.3, and psutil 6.1.0. The exact pins
202
+ are provided in `requirements-lock.txt`, which is shipped with the source
203
+ distribution and the archived release.
204
+
205
+ ## Package installation
206
+
207
+ From this source directory:
208
+
209
+ ```bash
210
+ python -m pip install .
211
+ phylopower --help
212
+ ```
213
+
214
+ The installed `phylopower` command and `python -m phylopower` both invoke
215
+ `phylopower.cli`.
216
+
217
+ The tutorial notebook is installed with the package at
218
+ `phylopower/tutorials/tutorial.ipynb`; it is also provided as
219
+ `tutorials/tutorial.ipynb` in the archived release.
220
+
221
+
222
+ The protein workflow requires the dependencies declared in
223
+ `pyproject.toml`. The gene workflow additionally requires a QIIME 2
224
+ environment containing compatible versions of Gemelli, `biom-format`, and
225
+ scikit-bio. The manuscript development environment was named
226
+ `qiime2-metagenome-2024.10`. Activate that environment before installing and
227
+ running the gene workflow:
228
+
229
+ ```bash
230
+ conda activate qiime2-metagenome-2024.10
231
+ python -m pip install .
232
+ phylopower gene --target-power 0.80 --out gene_result
233
+ ```
234
+
235
+ ## Python API
236
+
237
+ ```python
238
+ from phylopower import (
239
+ compute_gene_min_sample_size,
240
+ compute_protein_min_sample_size,
241
+ demo_path,
242
+ )
243
+
244
+ result = compute_protein_min_sample_size(
245
+ table=demo_path("datapro", "taxon_function_table.csv"),
246
+ tree=demo_path("datapro", "rooted_tree.nwk"),
247
+ group=demo_path("datapro", "sample_metadata.csv"),
248
+ target_power=0.80,
249
+ target_omega2=0.05,
250
+ out="protein_result",
251
+ )
252
+ ```
253
+
254
+ The compatibility aliases `compute_taxon` and `compute_taxon_function` point
255
+ to these manuscript-aligned functions; they do not call the older workflows
256
+ in `core.py`.
257
+
258
+ ## Input files
259
+
260
+ ### Gene workflow
261
+
262
+ - feature table: CSV with a `Taxon` column and one column per sample;
263
+ - rooted phylogenetic tree: Newick;
264
+ - taxonomy: CSV containing `Feature ID` and `Taxon`;
265
+ - group map: CSV containing `sample_id` and `group_name`.
266
+
267
+ ### Protein workflow
268
+
269
+ - Taxon–Function table: CSV with `Taxon`, `Function`, and one column per
270
+ sample;
271
+ - rooted phylogenetic tree: Newick;
272
+ - group map: CSV containing `sample_id` and `group_name`.
273
+
274
+ The raw-pool implementation supports two or more groups (the per-group sample
275
+ size recommendation assumes a balanced design with the same n per group).
276
+
277
+ ## Outputs
278
+
279
+ Each run writes:
280
+
281
+ - `summary.json`;
282
+ - `power_by_sample_size.csv`;
283
+ - `scenario_metrics_by_sample_size.csv` (per-scenario power with Monte Carlo
284
+ standard error and 95% Wilson interval columns);
285
+ - `sample_size_decision.png`.
286
+
287
+ The Python API returns the same summary and two result tables in a dictionary.
288
+
289
+ ## Reproducibility
290
+
291
+ See `REPRODUCIBILITY.md`.
292
+
293
+ The bundled datasets are convenient execution examples. Before a public
294
+ Zenodo release, the depositors should verify and document their original
295
+ accessions, citations, and redistribution terms.
296
+
297
+ ## Citation and license
298
+
299
+ Citation metadata are provided in `CITATION.cff`. PhyloPower
300
+ is distributed under the MIT License; see `LICENSE`.
@@ -0,0 +1,264 @@
1
+ # PhyloPower
2
+
3
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.21991013.svg)](https://doi.org/10.5281/zenodo.21991013)
4
+ ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
5
+
6
+ PhyloPower estimates the minimum balanced per-group sample size required for
7
+ community-level meta-omics studies at a target statistical power and realized
8
+ PERMANOVA effect size (ω²).
9
+
10
+ ## For reviewers
11
+
12
+ The exact code version associated with the manuscript is permanently archived
13
+ at Zenodo: https://doi.org/10.5281/zenodo.21991013. To verify the manuscript's
14
+ claims, start from:
15
+
16
+ - `tutorials/tutorial.ipynb` — end-to-end
17
+ walkthrough of both workflows on the bundled demo data;
18
+ - `figures/README.md` — figure-to-script map: every
19
+ manuscript figure and supplementary figure has exactly one generating
20
+ script, with precomputed result caches so figures can be regenerated
21
+ without re-running the full simulations;
22
+ - `REPRODUCIBILITY.md` — environment setup, seeds, and
23
+ Monte Carlo settings used for the manuscript;
24
+ - `validation_datasets/` — processed external
25
+ validation cohorts with preparation summaries and checksums.
26
+
27
+ These companion files are distributed with the Zenodo archive and are not part
28
+ of the PyPI package; `pip install` provides the Python package and the bundled
29
+ demo datasets only.
30
+
31
+ ## Overview
32
+
33
+ The manuscript-aligned implementation is `phylopower.cli`. It provides
34
+ two raw-pool workflows:
35
+
36
+ | Command | Synthetic generator | Distance |
37
+ |---|---|---|
38
+ | `gene` | PCAM | Gemelli phylogenetic RPCA |
39
+ | `protein` | MDC-TF-MC | PhyloFunc |
40
+
41
+ A step-by-step walkthrough of both workflows is provided in the tutorial
42
+ notebook `tutorials/tutorial.ipynb`. Manuscript
43
+ figure scripts and the figure-to-script map are documented in
44
+ `figures/README.md`.
45
+
46
+ `phylopower/cli.py` is a generated, self-contained runner. It embeds the
47
+ lower-level core and all other project-local runtime modules, so it does not
48
+ import an external `phylopower/core.py`.
49
+
50
+ ## Usage
51
+
52
+ Run the workflows from this directory with `python -m phylopower`, or install
53
+ the package first (`python -m pip install .`) and use the `phylopower`
54
+ command. The bundled `phylopower/datagene/` and `phylopower/datapro/` demo
55
+ datasets are found automatically; set `PHYLOPOWER_DATA_DIR` or provide input
56
+ paths explicitly to use your own data.
57
+
58
+ For the protein workflow, install the runtime dependencies with:
59
+
60
+ ```bash
61
+ python -m pip install \
62
+ "numpy>=1.22" "pandas>=1.5" "scipy>=1.9" "scikit-bio>=0.6.3" \
63
+ "joblib>=1.2" "matplotlib>=3.7" "tqdm>=4.64" "psutil>=5.9" \
64
+ phylofunc "biopython>=1.80"
65
+ ```
66
+
67
+ Both pandas 2.x and 3.x are supported; the workflows are verified against
68
+ pandas 3.0 Copy-on-Write semantics (`DataFrame.to_numpy()` read-only views).
69
+
70
+ The gene workflow must be launched from the compatible QIIME 2 environment
71
+ that contains Gemelli and `biom-format`; selecting that environment only with
72
+ `--qiime-env` is not a substitute for activating it because PCAM calls the
73
+ Gemelli Python API in-process.
74
+
75
+ ```bash
76
+ python -m phylopower --help
77
+
78
+ python -m phylopower gene \
79
+ --table /data/feature_table.csv \
80
+ --tree /data/rooted_tree.nwk \
81
+ --taxonomy /data/taxonomy.csv \
82
+ --group /data/sample_metadata.csv \
83
+ --target-power 0.80 \
84
+ --out gene_result
85
+
86
+ python -m phylopower protein \
87
+ --table /data/taxon_function_table.csv \
88
+ --tree /data/rooted_tree.nwk \
89
+ --group /data/sample_metadata.csv \
90
+ --target-power 0.80 \
91
+ --out protein_result
92
+ ```
93
+
94
+ A full `protein` run with the default Monte Carlo settings targets
95
+ publication-grade estimates and can take tens of minutes and several GB of
96
+ memory. For a quick smoke test on the bundled demo data (reduced Monte Carlo
97
+ effort, not suitable for publication estimates):
98
+
99
+ ```bash
100
+ python -m phylopower protein \
101
+ --target-power 0.80 \
102
+ --min-n 2 --max-n 4 --coarse-step 2 \
103
+ --boot-number 10 --permutations 49 \
104
+ --pool-size-per-group 10 \
105
+ --mdctf-strength-candidates 6 --mdctf-preview-pool-size 60 \
106
+ --power-preview-boot-number 5 --power-preview-permutations 19 \
107
+ --out protein_quick
108
+ ```
109
+
110
+ If `--target-omega2` is omitted, the observed ω² of the resolved pilot is used
111
+ and recorded in `summary.json`.
112
+
113
+ The effect grid is widened automatically when the target ω² exceeds the
114
+ simulated range (`--pcam-scale-extend-max` for `gene`, `--mdctf-strength-max`
115
+ for `protein`). If the target still falls outside the realized ω² range, the
116
+ fitted power at the target would rest on curve extrapolation only: a warning
117
+ is printed, the extrapolated fit is not allowed to qualify, no minimum n is
118
+ reported, and `summary.json` records `"target_omega2_bracketed": false`
119
+ (together with `low_omega_support_warning`). Widen the grid with the flags
120
+ above and rerun in that case.
121
+
122
+ ### Monte Carlo settings
123
+
124
+ The default settings are `--boot-number 200` bootstrap iterations per
125
+ effect level and `--permutations 199` permutations per PERMANOVA; scikit-bio
126
+ applies the `+1` correction internally, so p-value denominators are 200.
127
+ Publication-grade estimates should use substantially larger counts — see
128
+ `REPRODUCIBILITY.md`. All stochastic steps, including
129
+ the PERMANOVA permutation streams and tree perturbation, are deterministically
130
+ derived from `--random-seed`, so a fixed seed reproduces a run bit-for-bit.
131
+
132
+ To inspect the exact embedded-module hashes:
133
+
134
+ ```bash
135
+ python phylopower/cli.py --standalone-info
136
+ ```
137
+
138
+ The maintainable build sources are `phylopower/_cli_source.py` and
139
+ `phylopower/_core_source.py`; both are included under `phylopower/`. They
140
+ are used only to regenerate the self-contained runners; the generated
141
+ `phylopower/cli.py` does not read them at runtime. The regeneration script
142
+ (`scripts/build_standalone.py`) is maintained in the GitHub repository.
143
+
144
+ ### Optional controls
145
+
146
+ - **Parallelism:** `--scenario-n-jobs` sets the number of independent effect
147
+ scenarios processed concurrently, and `--bootstrap-n-jobs` sets the joblib
148
+ workers used inside the bootstrap/PERMANOVA loops (`0` = automatic).
149
+ - **Tree perturbation:** `--tree-jitter-sigma` and `--tree-nni-prob` set the
150
+ perturbation magnitudes; `--tree-support-threshold` restricts NNI to nodes
151
+ below a given support value; `--tree-set trees.nwk` estimates both
152
+ magnitudes from a set of bootstrap or posterior trees, with explicit values
153
+ taking precedence. All tree-perturbation options are off by default.
154
+ - **Pilot stability diagnostic:** `phylopower diagnose --modality
155
+ {gene,protein} --table ... --tree ... --group ... [--taxonomy ...]
156
+ --out diagnosis/` subsamples the pilot, reruns the workflow with a reduced
157
+ effect grid, and reports the median and interquartile range of the resulting
158
+ minimum n.
159
+
160
+ ### Versions used for the manuscript
161
+
162
+ The reported analyses used Python 3.10.14, QIIME 2 2024.10.1 (environment
163
+ `qiime2-metagenome-2024.10`), Gemelli 0.0.12, PhyloFunc 2.0, scikit-bio 0.6.3,
164
+ biom-format 2.1.15, NumPy 1.26.4, pandas 2.2.2, SciPy 1.10.1, Biopython 1.83,
165
+ joblib 1.4.2, Matplotlib 3.8.4, tqdm 4.67.3, and psutil 6.1.0. The exact pins
166
+ are provided in `requirements-lock.txt`, which is shipped with the source
167
+ distribution and the archived release.
168
+
169
+ ## Package installation
170
+
171
+ From this source directory:
172
+
173
+ ```bash
174
+ python -m pip install .
175
+ phylopower --help
176
+ ```
177
+
178
+ The installed `phylopower` command and `python -m phylopower` both invoke
179
+ `phylopower.cli`.
180
+
181
+ The tutorial notebook is installed with the package at
182
+ `phylopower/tutorials/tutorial.ipynb`; it is also provided as
183
+ `tutorials/tutorial.ipynb` in the archived release.
184
+
185
+
186
+ The protein workflow requires the dependencies declared in
187
+ `pyproject.toml`. The gene workflow additionally requires a QIIME 2
188
+ environment containing compatible versions of Gemelli, `biom-format`, and
189
+ scikit-bio. The manuscript development environment was named
190
+ `qiime2-metagenome-2024.10`. Activate that environment before installing and
191
+ running the gene workflow:
192
+
193
+ ```bash
194
+ conda activate qiime2-metagenome-2024.10
195
+ python -m pip install .
196
+ phylopower gene --target-power 0.80 --out gene_result
197
+ ```
198
+
199
+ ## Python API
200
+
201
+ ```python
202
+ from phylopower import (
203
+ compute_gene_min_sample_size,
204
+ compute_protein_min_sample_size,
205
+ demo_path,
206
+ )
207
+
208
+ result = compute_protein_min_sample_size(
209
+ table=demo_path("datapro", "taxon_function_table.csv"),
210
+ tree=demo_path("datapro", "rooted_tree.nwk"),
211
+ group=demo_path("datapro", "sample_metadata.csv"),
212
+ target_power=0.80,
213
+ target_omega2=0.05,
214
+ out="protein_result",
215
+ )
216
+ ```
217
+
218
+ The compatibility aliases `compute_taxon` and `compute_taxon_function` point
219
+ to these manuscript-aligned functions; they do not call the older workflows
220
+ in `core.py`.
221
+
222
+ ## Input files
223
+
224
+ ### Gene workflow
225
+
226
+ - feature table: CSV with a `Taxon` column and one column per sample;
227
+ - rooted phylogenetic tree: Newick;
228
+ - taxonomy: CSV containing `Feature ID` and `Taxon`;
229
+ - group map: CSV containing `sample_id` and `group_name`.
230
+
231
+ ### Protein workflow
232
+
233
+ - Taxon–Function table: CSV with `Taxon`, `Function`, and one column per
234
+ sample;
235
+ - rooted phylogenetic tree: Newick;
236
+ - group map: CSV containing `sample_id` and `group_name`.
237
+
238
+ The raw-pool implementation supports two or more groups (the per-group sample
239
+ size recommendation assumes a balanced design with the same n per group).
240
+
241
+ ## Outputs
242
+
243
+ Each run writes:
244
+
245
+ - `summary.json`;
246
+ - `power_by_sample_size.csv`;
247
+ - `scenario_metrics_by_sample_size.csv` (per-scenario power with Monte Carlo
248
+ standard error and 95% Wilson interval columns);
249
+ - `sample_size_decision.png`.
250
+
251
+ The Python API returns the same summary and two result tables in a dictionary.
252
+
253
+ ## Reproducibility
254
+
255
+ See `REPRODUCIBILITY.md`.
256
+
257
+ The bundled datasets are convenient execution examples. Before a public
258
+ Zenodo release, the depositors should verify and document their original
259
+ accessions, citations, and redistribution terms.
260
+
261
+ ## Citation and license
262
+
263
+ Citation metadata are provided in `CITATION.cff`. PhyloPower
264
+ is distributed under the MIT License; see `LICENSE`.