CodonAdaptPy 1.0.0__tar.gz → 1.0.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.
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/Dockerfile +1 -2
- {codonadaptpy-1.0.0/src/CodonAdaptPy.egg-info → codonadaptpy-1.0.1}/PKG-INFO +21 -20
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/README.md +19 -18
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/docs/api.md +6 -6
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/docs/cli.md +2 -3
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/docs/conf.py +1 -2
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/docs/getting_started.md +12 -6
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/docs/index.md +14 -7
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/docs/input_validation.md +2 -2
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/docs/interpretation.md +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/pyproject.toml +2 -2
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1/src/CodonAdaptPy.egg-info}/PKG-INFO +21 -20
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/__init__.py +3 -3
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/__main__.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/__version__.py +2 -2
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/aggregation.py +2 -2
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/analyzer.py +5 -5
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/cli.py +6 -6
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/comparative.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/exceptions.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/genetic_code.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/metrics/__init__.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/metrics/adaptation.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/metrics/composition.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/metrics/evolutionary.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/metrics/host.py +2 -2
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/metrics/pairs.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/metrics/usage.py +2 -2
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/models.py +2 -2
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/optimizer.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/parsers.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/phylo_visualization.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/phylogenetics.py +2 -2
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/references.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/reporting.py +2 -2
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/validation.py +1 -2
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/visualization.py +1 -1
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/tests/test_analyzer.py +2 -2
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/LICENSE +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/MANIFEST.in +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/docs/assets/codonadaptpy_graphical_abstract.png +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/docs/metrics.md +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/docs/requirements.txt +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/environment.yml +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/examples/basic_analysis.py +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/setup.cfg +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/CodonAdaptPy.egg-info/SOURCES.txt +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/CodonAdaptPy.egg-info/dependency_links.txt +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/CodonAdaptPy.egg-info/entry_points.txt +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/CodonAdaptPy.egg-info/requires.txt +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/CodonAdaptPy.egg-info/top_level.txt +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/src/codonadaptpy/py.typed +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/tests/test_aggregation.py +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/tests/test_comparative.py +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/tests/test_independent_validation_fixtures.py +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/tests/test_metrics.py +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/tests/test_optimizer.py +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/tests/test_parsers.py +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/tests/test_phylogenetics.py +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/tests/test_references_reporting_cli.py +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/tests/test_validation.py +0 -0
- {codonadaptpy-1.0.0 → codonadaptpy-1.0.1}/tests/test_visualization.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
FROM python:3.12-slim
|
|
2
2
|
|
|
3
3
|
LABEL org.opencontainers.image.authors="Naveen Duhan"
|
|
4
|
-
LABEL org.opencontainers.image.version="1.0.
|
|
4
|
+
LABEL org.opencontainers.image.version="1.0.1"
|
|
5
5
|
LABEL org.opencontainers.image.title="CodonAdaptPy"
|
|
6
6
|
|
|
7
7
|
WORKDIR /opt/codonadaptpy
|
|
@@ -10,4 +10,3 @@ RUN pip install --no-cache-dir ".[all]"
|
|
|
10
10
|
|
|
11
11
|
ENTRYPOINT ["codonadaptpy"]
|
|
12
12
|
CMD ["--help"]
|
|
13
|
-
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CodonAdaptPy
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Codon usage, host adaptation, evolutionary analysis, phylogenetics, and sequence design
|
|
5
5
|
Author: Naveen Duhan
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
7
7
|
Project-URL: Homepage, https://github.com/navduhan/CodonAdaptPy
|
|
@@ -71,8 +71,9 @@ Dynamic: license-file
|
|
|
71
71
|
|
|
72
72
|
[](https://github.com/navduhan/CodonAdaptPy/actions/workflows/ci.yml)
|
|
73
73
|
[](https://codonadaptpy.readthedocs.io/en/latest/?badge=latest)
|
|
74
|
+
[](https://pypi.org/project/CodonAdaptPy/)
|
|
74
75
|
|
|
75
|
-
CodonAdaptPy 1.0.
|
|
76
|
+
CodonAdaptPy 1.0.1 is a Python package for coding-sequence validation, codon-usage analysis, multi-host comparison, evolutionary diagnostics, reproducible reporting, and constrained codon optimization or deoptimization.
|
|
76
77
|
|
|
77
78
|

|
|
78
79
|
|
|
@@ -99,17 +100,17 @@ Codon-usage similarity is descriptive. It is not direct proof of increased expre
|
|
|
99
100
|
Install the dependency-free core and CLI:
|
|
100
101
|
|
|
101
102
|
```bash
|
|
102
|
-
python -m pip install
|
|
103
|
+
python -m pip install CodonAdaptPy
|
|
103
104
|
```
|
|
104
105
|
|
|
105
|
-
Install
|
|
106
|
+
Install all optional analysis, input, plotting, and reporting dependencies:
|
|
106
107
|
|
|
107
108
|
```bash
|
|
108
|
-
python -m pip install "
|
|
109
|
+
python -m pip install "CodonAdaptPy[all]"
|
|
109
110
|
```
|
|
110
111
|
|
|
111
|
-
Phylogenetic workflows
|
|
112
|
-
|
|
112
|
+
Phylogenetic workflows also require external command-line programs. The
|
|
113
|
+
supplied Conda environment installs them together with CodonAdaptPy:
|
|
113
114
|
|
|
114
115
|
```bash
|
|
115
116
|
conda env create -f environment.yml
|
|
@@ -120,11 +121,11 @@ For an existing environment such as `ngs`:
|
|
|
120
121
|
|
|
121
122
|
```bash
|
|
122
123
|
conda install -n ngs -c bioconda -c conda-forge mafft trimal iqtree fasttree ete3
|
|
123
|
-
python -m pip install "
|
|
124
|
+
python -m pip install "CodonAdaptPy[phylo]"
|
|
124
125
|
```
|
|
125
126
|
|
|
126
|
-
CodonAdaptPy reports a missing executable instead of silently substituting
|
|
127
|
-
|
|
127
|
+
CodonAdaptPy reports a missing executable instead of silently substituting an
|
|
128
|
+
alternative method. Publication mode requires trimAL unless `--no-trim` is
|
|
128
129
|
explicitly selected.
|
|
129
130
|
|
|
130
131
|
For development:
|
|
@@ -147,7 +148,7 @@ codonadaptpy analyze coding_sequences.fasta \
|
|
|
147
148
|
--output results
|
|
148
149
|
```
|
|
149
150
|
|
|
150
|
-
Compare the same sequences
|
|
151
|
+
Compare the same sequences against multiple host reference profiles:
|
|
151
152
|
|
|
152
153
|
```bash
|
|
153
154
|
codonadaptpy compare coding_sequences.fasta \
|
|
@@ -178,7 +179,7 @@ ATG...TAA
|
|
|
178
179
|
ATG...TAA
|
|
179
180
|
```
|
|
180
181
|
|
|
181
|
-
For a FASTA plus a separate metadata file, pass `--metadata metadata.csv`. During genome-wide aggregation every CDS is validated independently, its reading frame
|
|
182
|
+
For a FASTA plus a separate metadata file, pass `--metadata metadata.csv`. During genome-wide aggregation, every CDS is validated independently, its reading frame restarts at position zero, its terminal stop is removed, and no nucleotide word or codon pair is counted across gene boundaries.
|
|
182
183
|
|
|
183
184
|
Build a versioned reference profile from highly expressed coding sequences:
|
|
184
185
|
|
|
@@ -222,8 +223,8 @@ codonadaptpy phylogeny f_gene_sequences.fasta \
|
|
|
222
223
|
```
|
|
223
224
|
|
|
224
225
|
This produces ML and time-tree figures, a root-to-tip regression, dated Newick,
|
|
225
|
-
lineage-through-time output, and JSON provenance. The
|
|
226
|
-
|
|
226
|
+
lineage-through-time output, and JSON provenance. The time tree and LTT curve
|
|
227
|
+
are rapid, deterministic diagnostics—not relaxed-clock posterior
|
|
227
228
|
dating, effective population-size inference, or 95% HPD intervals.
|
|
228
229
|
|
|
229
230
|
## Python API
|
|
@@ -249,7 +250,7 @@ print(result.metrics["enc"])
|
|
|
249
250
|
print(result.metrics["gc3"])
|
|
250
251
|
```
|
|
251
252
|
|
|
252
|
-
Create a publication-ready figure
|
|
253
|
+
Create a publication-ready figure with CodonAdaptPy:
|
|
253
254
|
|
|
254
255
|
```python
|
|
255
256
|
from codonadaptpy import PublicationPlotManager
|
|
@@ -264,7 +265,7 @@ plots.save(figure, "f_gene_diagnostics.pdf")
|
|
|
264
265
|
plots.save(figure, "f_gene_diagnostics.png", dpi=600)
|
|
265
266
|
```
|
|
266
267
|
|
|
267
|
-
Run phylogenetics through the
|
|
268
|
+
Run phylogenetics through the Python API:
|
|
268
269
|
|
|
269
270
|
```python
|
|
270
271
|
from codonadaptpy import ETE3TreePlotter, PhylogeneticAnalyzer, TemporalAnalyzer
|
|
@@ -300,7 +301,7 @@ JSON profiles preserve provenance and versioning:
|
|
|
300
301
|
}
|
|
301
302
|
```
|
|
302
303
|
|
|
303
|
-
Missing sense codons are
|
|
304
|
+
Missing sense codons are represented by zero counts during validation. CSV/TSV profiles use `codon,count` or `codon,frequency` columns. The only bundled profile is `uniform_standard`, an explicitly non-biological testing baseline; biological host profiles must retain a documented source and release.
|
|
304
305
|
|
|
305
306
|
## CAI edge-case policy
|
|
306
307
|
|
|
@@ -329,7 +330,7 @@ Every analysis captures CodonAdaptPy and Python versions, UTC analysis time, gen
|
|
|
329
330
|
```text
|
|
330
331
|
src/codonadaptpy/
|
|
331
332
|
├── aggregation.py # Per-isolate gene and genome-wide CDS scopes
|
|
332
|
-
├── analyzer.py # Main
|
|
333
|
+
├── analyzer.py # Main analysis API
|
|
333
334
|
├── comparative.py # Group and multivariate analysis
|
|
334
335
|
├── genetic_code.py # Translation tables and codon families
|
|
335
336
|
├── metrics/ # Adaptation, usage, composition, pair, host, evolution
|
|
@@ -342,5 +343,5 @@ src/codonadaptpy/
|
|
|
342
343
|
├── reporting.py # JSON/CSV/Excel/HTML/PDF/FASTA output
|
|
343
344
|
├── validation.py # Coding-sequence quality control
|
|
344
345
|
├── visualization.py # Interactive and static plots
|
|
345
|
-
└── cli.py #
|
|
346
|
+
└── cli.py # Command-line subcommands
|
|
346
347
|
```
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/navduhan/CodonAdaptPy/actions/workflows/ci.yml)
|
|
4
4
|
[](https://codonadaptpy.readthedocs.io/en/latest/?badge=latest)
|
|
5
|
+
[](https://pypi.org/project/CodonAdaptPy/)
|
|
5
6
|
|
|
6
|
-
CodonAdaptPy 1.0.
|
|
7
|
+
CodonAdaptPy 1.0.1 is a Python package for coding-sequence validation, codon-usage analysis, multi-host comparison, evolutionary diagnostics, reproducible reporting, and constrained codon optimization or deoptimization.
|
|
7
8
|
|
|
8
9
|

|
|
9
10
|
|
|
@@ -30,17 +31,17 @@ Codon-usage similarity is descriptive. It is not direct proof of increased expre
|
|
|
30
31
|
Install the dependency-free core and CLI:
|
|
31
32
|
|
|
32
33
|
```bash
|
|
33
|
-
python -m pip install
|
|
34
|
+
python -m pip install CodonAdaptPy
|
|
34
35
|
```
|
|
35
36
|
|
|
36
|
-
Install
|
|
37
|
+
Install all optional analysis, input, plotting, and reporting dependencies:
|
|
37
38
|
|
|
38
39
|
```bash
|
|
39
|
-
python -m pip install "
|
|
40
|
+
python -m pip install "CodonAdaptPy[all]"
|
|
40
41
|
```
|
|
41
42
|
|
|
42
|
-
Phylogenetic workflows
|
|
43
|
-
|
|
43
|
+
Phylogenetic workflows also require external command-line programs. The
|
|
44
|
+
supplied Conda environment installs them together with CodonAdaptPy:
|
|
44
45
|
|
|
45
46
|
```bash
|
|
46
47
|
conda env create -f environment.yml
|
|
@@ -51,11 +52,11 @@ For an existing environment such as `ngs`:
|
|
|
51
52
|
|
|
52
53
|
```bash
|
|
53
54
|
conda install -n ngs -c bioconda -c conda-forge mafft trimal iqtree fasttree ete3
|
|
54
|
-
python -m pip install "
|
|
55
|
+
python -m pip install "CodonAdaptPy[phylo]"
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
CodonAdaptPy reports a missing executable instead of silently substituting
|
|
58
|
-
|
|
58
|
+
CodonAdaptPy reports a missing executable instead of silently substituting an
|
|
59
|
+
alternative method. Publication mode requires trimAL unless `--no-trim` is
|
|
59
60
|
explicitly selected.
|
|
60
61
|
|
|
61
62
|
For development:
|
|
@@ -78,7 +79,7 @@ codonadaptpy analyze coding_sequences.fasta \
|
|
|
78
79
|
--output results
|
|
79
80
|
```
|
|
80
81
|
|
|
81
|
-
Compare the same sequences
|
|
82
|
+
Compare the same sequences against multiple host reference profiles:
|
|
82
83
|
|
|
83
84
|
```bash
|
|
84
85
|
codonadaptpy compare coding_sequences.fasta \
|
|
@@ -109,7 +110,7 @@ ATG...TAA
|
|
|
109
110
|
ATG...TAA
|
|
110
111
|
```
|
|
111
112
|
|
|
112
|
-
For a FASTA plus a separate metadata file, pass `--metadata metadata.csv`. During genome-wide aggregation every CDS is validated independently, its reading frame
|
|
113
|
+
For a FASTA plus a separate metadata file, pass `--metadata metadata.csv`. During genome-wide aggregation, every CDS is validated independently, its reading frame restarts at position zero, its terminal stop is removed, and no nucleotide word or codon pair is counted across gene boundaries.
|
|
113
114
|
|
|
114
115
|
Build a versioned reference profile from highly expressed coding sequences:
|
|
115
116
|
|
|
@@ -153,8 +154,8 @@ codonadaptpy phylogeny f_gene_sequences.fasta \
|
|
|
153
154
|
```
|
|
154
155
|
|
|
155
156
|
This produces ML and time-tree figures, a root-to-tip regression, dated Newick,
|
|
156
|
-
lineage-through-time output, and JSON provenance. The
|
|
157
|
-
|
|
157
|
+
lineage-through-time output, and JSON provenance. The time tree and LTT curve
|
|
158
|
+
are rapid, deterministic diagnostics—not relaxed-clock posterior
|
|
158
159
|
dating, effective population-size inference, or 95% HPD intervals.
|
|
159
160
|
|
|
160
161
|
## Python API
|
|
@@ -180,7 +181,7 @@ print(result.metrics["enc"])
|
|
|
180
181
|
print(result.metrics["gc3"])
|
|
181
182
|
```
|
|
182
183
|
|
|
183
|
-
Create a publication-ready figure
|
|
184
|
+
Create a publication-ready figure with CodonAdaptPy:
|
|
184
185
|
|
|
185
186
|
```python
|
|
186
187
|
from codonadaptpy import PublicationPlotManager
|
|
@@ -195,7 +196,7 @@ plots.save(figure, "f_gene_diagnostics.pdf")
|
|
|
195
196
|
plots.save(figure, "f_gene_diagnostics.png", dpi=600)
|
|
196
197
|
```
|
|
197
198
|
|
|
198
|
-
Run phylogenetics through the
|
|
199
|
+
Run phylogenetics through the Python API:
|
|
199
200
|
|
|
200
201
|
```python
|
|
201
202
|
from codonadaptpy import ETE3TreePlotter, PhylogeneticAnalyzer, TemporalAnalyzer
|
|
@@ -231,7 +232,7 @@ JSON profiles preserve provenance and versioning:
|
|
|
231
232
|
}
|
|
232
233
|
```
|
|
233
234
|
|
|
234
|
-
Missing sense codons are
|
|
235
|
+
Missing sense codons are represented by zero counts during validation. CSV/TSV profiles use `codon,count` or `codon,frequency` columns. The only bundled profile is `uniform_standard`, an explicitly non-biological testing baseline; biological host profiles must retain a documented source and release.
|
|
235
236
|
|
|
236
237
|
## CAI edge-case policy
|
|
237
238
|
|
|
@@ -260,7 +261,7 @@ Every analysis captures CodonAdaptPy and Python versions, UTC analysis time, gen
|
|
|
260
261
|
```text
|
|
261
262
|
src/codonadaptpy/
|
|
262
263
|
├── aggregation.py # Per-isolate gene and genome-wide CDS scopes
|
|
263
|
-
├── analyzer.py # Main
|
|
264
|
+
├── analyzer.py # Main analysis API
|
|
264
265
|
├── comparative.py # Group and multivariate analysis
|
|
265
266
|
├── genetic_code.py # Translation tables and codon families
|
|
266
267
|
├── metrics/ # Adaptation, usage, composition, pair, host, evolution
|
|
@@ -273,5 +274,5 @@ src/codonadaptpy/
|
|
|
273
274
|
├── reporting.py # JSON/CSV/Excel/HTML/PDF/FASTA output
|
|
274
275
|
├── validation.py # Coding-sequence quality control
|
|
275
276
|
├── visualization.py # Interactive and static plots
|
|
276
|
-
└── cli.py #
|
|
277
|
+
└── cli.py # Command-line subcommands
|
|
277
278
|
```
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# Python API and extension guide
|
|
2
2
|
|
|
3
|
-
`CodonAnalyzer` is the
|
|
3
|
+
`CodonAnalyzer` is the primary analysis interface. Individual calculators in `codonadaptpy.metrics` can also be used independently. Inputs and outputs are standard-library dataclasses that can be serialized without a framework-specific schema library and remain available regardless of which optional dependencies are installed.
|
|
4
4
|
|
|
5
|
-
`CDSAggregator`
|
|
5
|
+
`CDSAggregator` uses a configured `CodonAnalyzer` to generate per-gene results, boundary-aware genome-wide results for each isolate, and results for any requested focus genes. Records identify their isolate and gene through metadata; no gene name is hard-coded.
|
|
6
6
|
|
|
7
7
|
Add a metric by implementing a focused calculation class and invoking it from `CodonAnalyzer.analyze`. Add a new input format in `SequenceParser.parse`. Add reference sources by constructing `ReferenceProfile` objects and registering them with `ReferenceManager`. Biological tables should always include database/release provenance, selection criteria, taxonomy, and checksums when available.
|
|
8
8
|
|
|
9
|
-
`ComparativeAnalyzer.automatic_test(left, right, paired=False, alpha=0.05)` records its normality diagnostic and selects Welch's t test or Mann--Whitney U for independent samples, and a paired t test or Wilcoxon signed-rank test for paired samples. Normality is assessed on within-pair differences for paired designs. The returned dictionary includes the selected test, sample sizes, statistic, p value, effect-size name and value, and the
|
|
9
|
+
`ComparativeAnalyzer.automatic_test(left, right, paired=False, alpha=0.05)` records its normality diagnostic and selects Welch's t test or Mann--Whitney U for independent samples, and a paired t test or Wilcoxon signed-rank test for paired samples. Normality is assessed on within-pair differences for paired designs. The returned dictionary includes the selected test, sample sizes, statistic, p value, effect-size name and value, and the documented selection policy.
|
|
10
10
|
|
|
11
|
-
`ComparativeAnalyzer` accepts
|
|
11
|
+
`ComparativeAnalyzer` accepts mappings containing numeric metrics and grouping metadata. SciPy is used for inferential tests and clustering, while NumPy and scikit-learn support multivariate analyses. It exposes Welch and Mann-Whitney tests, Hedges' g, FDR correction, PCA, correspondence analysis, stratified LDA with a reproducible train/test split, hierarchical clustering, correlations, and distances.
|
|
12
12
|
|
|
13
13
|
`PlotManager` returns interactive Plotly figures. `PublicationPlotManager` returns static Matplotlib figures with the Okabe-Ito palette, redundant markers, sample sizes, standard errors, outward-offset axes, and vector-compatible output. Its methods cover grouped PCA and LDA, held-out confusion matrices, exact 59-codon RSCU profiles and heatmaps, composition summaries, ENC-GC3s/neutrality/PR2 diagnostics, all 16 dinucleotide O/E profiles and heatmaps, scalar metric panels, and multi-host CAI/RCDI/SiD comparisons. `save` exports PNG, TIFF, PDF, or SVG.
|
|
14
14
|
|
|
@@ -22,7 +22,7 @@ publication workflows because it prevents silent use of an untrimmed alignment.
|
|
|
22
22
|
|
|
23
23
|
`TemporalAnalyzer.temporal_signal` performs a root-to-tip regression and can
|
|
24
24
|
search candidate roots in the style of a rapid TempEst diagnostic. The result
|
|
25
|
-
contains rate, fitted root date, R², p
|
|
25
|
+
contains rate, fitted root date, R², p value, residuals, and the selected
|
|
26
26
|
outgroup. `date_tree` applies that deterministic strict-clock mapping while
|
|
27
27
|
anchoring observed tips to their collection dates. `lineage_through_time`
|
|
28
28
|
counts dated branches across a calendar grid. These methods do not implement a
|
|
@@ -35,7 +35,7 @@ for quantifying whole-genome versus focus-gene topology discordance.
|
|
|
35
35
|
|
|
36
36
|
`ETE3TreePlotter` uses ETE3 for topology parsing, rooting, traversal, pruning,
|
|
37
37
|
and node metadata, then renders headlessly with Matplotlib. It provides ML tree,
|
|
38
|
-
time-tree, temporal-signal, and deterministic LTT figures as 600
|
|
38
|
+
time-tree, temporal-signal, and deterministic LTT figures as 600 dpi raster or
|
|
39
39
|
vector output without ETE3's optional Qt interface.
|
|
40
40
|
|
|
41
41
|
## High-level analysis API
|
|
@@ -17,7 +17,7 @@ codonadaptpy analyze coding_sequences.fasta \
|
|
|
17
17
|
--output results
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
For a table containing isolate and gene metadata, run gene
|
|
20
|
+
For a table containing isolate and gene metadata, run per-gene analysis and boundary-aware pooling together:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
23
|
codonadaptpy analyze isolate_cds.csv \
|
|
@@ -60,7 +60,7 @@ codonadaptpy phylogeny coding_sequences.fasta \
|
|
|
60
60
|
--output phylogeny_results
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
Publication mode requires trimAL unless `--no-trim` is explicitly selected. CodonAdaptPy reports missing executables and does not silently substitute
|
|
63
|
+
Publication mode requires trimAL unless `--no-trim` is explicitly selected. CodonAdaptPy reports missing executables and does not silently substitute an alternative method.
|
|
64
64
|
|
|
65
65
|
## Optimize a coding sequence
|
|
66
66
|
|
|
@@ -73,4 +73,3 @@ codonadaptpy optimize input.fasta \
|
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
Optimized candidates require downstream review for RNA structure, splicing, regulatory elements and experimental performance not represented by the selected constraints.
|
|
76
|
-
|
|
@@ -7,7 +7,7 @@ public Python API.
|
|
|
7
7
|
:Created: July 22, 2026
|
|
8
8
|
:Updated: July 22, 2026
|
|
9
9
|
:Author: Naveen Duhan
|
|
10
|
-
:Version: 1.0.
|
|
10
|
+
:Version: 1.0.1
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
13
|
from __future__ import annotations
|
|
@@ -58,4 +58,3 @@ html_context = {
|
|
|
58
58
|
"github_version": "main",
|
|
59
59
|
"conf_py_path": "/docs/",
|
|
60
60
|
}
|
|
61
|
-
|
|
@@ -2,19 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
## Choose an installation
|
|
4
4
|
|
|
5
|
-
The core package has no mandatory third-party Python dependencies.
|
|
5
|
+
The core package has no mandatory third-party Python dependencies. Install the stable release from PyPI:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
python -m pip install
|
|
8
|
+
python -m pip install CodonAdaptPy
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Install all optional Python dependencies with:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
python -m pip install "
|
|
14
|
+
python -m pip install "CodonAdaptPy[all]"
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
From a cloned repository, install an editable development environment with:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
python -m pip install --editable ".[dev,all]"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
For alignment and phylogenetic inference, use the supplied Conda environment so MAFFT, trimAL, IQ-TREE and FastTree are available on the command line:
|
|
18
24
|
|
|
19
25
|
```bash
|
|
20
26
|
conda env create -f environment.yml
|
|
@@ -58,7 +64,7 @@ Supported inputs include pasted DNA or RNA, FASTA, GenBank, CSV, TSV and ZIP arc
|
|
|
58
64
|
|
|
59
65
|
## Boundary-aware per-isolate analysis
|
|
60
66
|
|
|
61
|
-
Genome-wide codon analysis should pool validated
|
|
67
|
+
Genome-wide codon analysis should pool counts from validated CDSs within each isolate. A raw genome sequence should not be treated as one continuous CDS, and adjacent genes should not create artificial codons or codon pairs.
|
|
62
68
|
|
|
63
69
|
```python
|
|
64
70
|
from codonadaptpy import CDSAggregator, CodonAnalyzer
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CodonAdaptPy
|
|
2
2
|
|
|
3
|
-
CodonAdaptPy is a
|
|
3
|
+
CodonAdaptPy is a Python package for validated coding-sequence analysis, codon-usage and host-adaptation metrics, comparative statistics, evolutionary diagnostics, phylogenetic context, reproducible reporting, and constrained synonymous sequence design.
|
|
4
4
|
|
|
5
5
|
```{image} assets/codonadaptpy_graphical_abstract.png
|
|
6
6
|
:alt: CodonAdaptPy workflow from validated coding sequences through four analytical lenses to auditable molecular-evolution evidence
|
|
@@ -12,21 +12,27 @@ CodonAdaptPy treats codon-usage similarity as descriptive evidence rather than d
|
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
-
Install the dependency-free analysis core
|
|
15
|
+
Install the dependency-free analysis core and command-line interface from PyPI:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
python -m pip install
|
|
18
|
+
python -m pip install CodonAdaptPy
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Install all optional Python dependencies with:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
python -m pip install "CodonAdaptPy[all]"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
For development, clone the repository and use an editable installation:
|
|
22
28
|
|
|
23
29
|
```bash
|
|
24
30
|
git clone https://github.com/navduhan/CodonAdaptPy.git
|
|
25
31
|
cd CodonAdaptPy
|
|
26
|
-
python -m pip install ".[all]"
|
|
32
|
+
python -m pip install --editable ".[dev,all]"
|
|
27
33
|
```
|
|
28
34
|
|
|
29
|
-
Phylogenetic workflows
|
|
35
|
+
Phylogenetic workflows also require MAFFT, trimAL, IQ-TREE or FastTree. The supplied `environment.yml` installs these external programs together with CodonAdaptPy.
|
|
30
36
|
|
|
31
37
|
```{toctree}
|
|
32
38
|
:maxdepth: 2
|
|
@@ -49,7 +55,8 @@ api
|
|
|
49
55
|
## Project information
|
|
50
56
|
|
|
51
57
|
- **Author:** Naveen Duhan
|
|
52
|
-
- **Version:** 1.0.
|
|
58
|
+
- **Version:** 1.0.1
|
|
53
59
|
- **License:** GNU General Public License v3 or later
|
|
60
|
+
- **PyPI:** [pypi.org/project/CodonAdaptPy](https://pypi.org/project/CodonAdaptPy/)
|
|
54
61
|
- **Source code:** [github.com/navduhan/CodonAdaptPy](https://github.com/navduhan/CodonAdaptPy)
|
|
55
62
|
- **Issue tracker:** [GitHub Issues](https://github.com/navduhan/CodonAdaptPy/issues)
|
|
@@ -4,8 +4,8 @@ FASTA identifiers must be unique. CSV/TSV input requires `identifier` (or `id`/`
|
|
|
4
4
|
|
|
5
5
|
Per-isolate aggregation requires an isolate field and a gene field. These can be columns in the sequence table, key/value tokens in FASTA descriptions, GenBank CDS annotations, or a separate CSV/TSV joined with `--metadata`. A typical metadata table contains `identifier,isolate,gene,genotype,host,collection_date,country,accession`.
|
|
6
6
|
|
|
7
|
-
Genome-wide codon analysis pools annotated CDSs; it does not analyze a raw multi-ORF genome as one reading frame. Each CDS must be oriented 5′→3′ in its coding direction. Reading frames restart independently, terminal stops are removed, and word
|
|
7
|
+
Genome-wide codon analysis pools annotated CDSs; it does not analyze a raw multi-ORF genome as one reading frame. Each CDS must be oriented 5′→3′ in its coding direction. Reading frames restart independently, terminal stops are removed, and nucleotide-word and codon-pair calculations respect gene boundaries.
|
|
8
8
|
|
|
9
|
-
RNA `U` is converted to DNA `T` by default and recorded as a warning. IUPAC ambiguous nucleotides are recognized and handled according to `reject`, `skip`, or `allow`. Unsupported symbols are errors. The reading frame is a zero-based offset.
|
|
9
|
+
RNA `U` is converted to DNA `T` by default and recorded as a warning. IUPAC ambiguous nucleotides are recognized and handled according to `reject`, `skip`, or `allow`. Unsupported symbols are errors. The reading frame is a zero-based offset. In partial mode, missing start or stop codons and trailing incomplete codons may be downgraded from errors; internal stops remain errors.
|
|
10
10
|
|
|
11
11
|
Strict mode raises on invalid sequences. Lenient mode returns a `ValidationReport` so a batch workflow can inspect problems. Metrics exclude ambiguous codons because assigning them probabilistically would introduce an undocumented model assumption.
|
|
@@ -4,7 +4,7 @@ Codon usage reflects interacting effects of mutation, selection, drift, gene exp
|
|
|
4
4
|
|
|
5
5
|
Reference construction is often the largest source of avoidable bias. Use curated complete CDSs, document whether highly expressed genes were selected, avoid mixing genetic codes, preserve database releases, and compare sensitivity across reference definitions. Very short genes and compositionally unusual proteins provide few independent synonymous observations.
|
|
6
6
|
|
|
7
|
-
Optimization modifies nucleotide
|
|
7
|
+
Optimization modifies nucleotide sequences and may affect RNA structure, splicing, transcription, innate immune recognition, synthesis, and regulatory motifs not included in the selected constraint set. CodonAdaptPy therefore returns multiple candidates and explicit constraint violations. Candidates require downstream in silico review and experimental validation.
|
|
8
8
|
|
|
9
9
|
Root-to-tip regression and deterministic lineage-through-time output are rapid
|
|
10
10
|
temporal diagnostics. A fitted root date is sensitive to rooting, recombination,
|
|
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "CodonAdaptPy"
|
|
7
|
-
version = "1.0.
|
|
8
|
-
description = "
|
|
7
|
+
version = "1.0.1"
|
|
8
|
+
description = "Codon usage, host adaptation, evolutionary analysis, phylogenetics, and sequence design"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
license = "GPL-3.0-or-later"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CodonAdaptPy
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Codon usage, host adaptation, evolutionary analysis, phylogenetics, and sequence design
|
|
5
5
|
Author: Naveen Duhan
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
7
7
|
Project-URL: Homepage, https://github.com/navduhan/CodonAdaptPy
|
|
@@ -71,8 +71,9 @@ Dynamic: license-file
|
|
|
71
71
|
|
|
72
72
|
[](https://github.com/navduhan/CodonAdaptPy/actions/workflows/ci.yml)
|
|
73
73
|
[](https://codonadaptpy.readthedocs.io/en/latest/?badge=latest)
|
|
74
|
+
[](https://pypi.org/project/CodonAdaptPy/)
|
|
74
75
|
|
|
75
|
-
CodonAdaptPy 1.0.
|
|
76
|
+
CodonAdaptPy 1.0.1 is a Python package for coding-sequence validation, codon-usage analysis, multi-host comparison, evolutionary diagnostics, reproducible reporting, and constrained codon optimization or deoptimization.
|
|
76
77
|
|
|
77
78
|

|
|
78
79
|
|
|
@@ -99,17 +100,17 @@ Codon-usage similarity is descriptive. It is not direct proof of increased expre
|
|
|
99
100
|
Install the dependency-free core and CLI:
|
|
100
101
|
|
|
101
102
|
```bash
|
|
102
|
-
python -m pip install
|
|
103
|
+
python -m pip install CodonAdaptPy
|
|
103
104
|
```
|
|
104
105
|
|
|
105
|
-
Install
|
|
106
|
+
Install all optional analysis, input, plotting, and reporting dependencies:
|
|
106
107
|
|
|
107
108
|
```bash
|
|
108
|
-
python -m pip install "
|
|
109
|
+
python -m pip install "CodonAdaptPy[all]"
|
|
109
110
|
```
|
|
110
111
|
|
|
111
|
-
Phylogenetic workflows
|
|
112
|
-
|
|
112
|
+
Phylogenetic workflows also require external command-line programs. The
|
|
113
|
+
supplied Conda environment installs them together with CodonAdaptPy:
|
|
113
114
|
|
|
114
115
|
```bash
|
|
115
116
|
conda env create -f environment.yml
|
|
@@ -120,11 +121,11 @@ For an existing environment such as `ngs`:
|
|
|
120
121
|
|
|
121
122
|
```bash
|
|
122
123
|
conda install -n ngs -c bioconda -c conda-forge mafft trimal iqtree fasttree ete3
|
|
123
|
-
python -m pip install "
|
|
124
|
+
python -m pip install "CodonAdaptPy[phylo]"
|
|
124
125
|
```
|
|
125
126
|
|
|
126
|
-
CodonAdaptPy reports a missing executable instead of silently substituting
|
|
127
|
-
|
|
127
|
+
CodonAdaptPy reports a missing executable instead of silently substituting an
|
|
128
|
+
alternative method. Publication mode requires trimAL unless `--no-trim` is
|
|
128
129
|
explicitly selected.
|
|
129
130
|
|
|
130
131
|
For development:
|
|
@@ -147,7 +148,7 @@ codonadaptpy analyze coding_sequences.fasta \
|
|
|
147
148
|
--output results
|
|
148
149
|
```
|
|
149
150
|
|
|
150
|
-
Compare the same sequences
|
|
151
|
+
Compare the same sequences against multiple host reference profiles:
|
|
151
152
|
|
|
152
153
|
```bash
|
|
153
154
|
codonadaptpy compare coding_sequences.fasta \
|
|
@@ -178,7 +179,7 @@ ATG...TAA
|
|
|
178
179
|
ATG...TAA
|
|
179
180
|
```
|
|
180
181
|
|
|
181
|
-
For a FASTA plus a separate metadata file, pass `--metadata metadata.csv`. During genome-wide aggregation every CDS is validated independently, its reading frame
|
|
182
|
+
For a FASTA plus a separate metadata file, pass `--metadata metadata.csv`. During genome-wide aggregation, every CDS is validated independently, its reading frame restarts at position zero, its terminal stop is removed, and no nucleotide word or codon pair is counted across gene boundaries.
|
|
182
183
|
|
|
183
184
|
Build a versioned reference profile from highly expressed coding sequences:
|
|
184
185
|
|
|
@@ -222,8 +223,8 @@ codonadaptpy phylogeny f_gene_sequences.fasta \
|
|
|
222
223
|
```
|
|
223
224
|
|
|
224
225
|
This produces ML and time-tree figures, a root-to-tip regression, dated Newick,
|
|
225
|
-
lineage-through-time output, and JSON provenance. The
|
|
226
|
-
|
|
226
|
+
lineage-through-time output, and JSON provenance. The time tree and LTT curve
|
|
227
|
+
are rapid, deterministic diagnostics—not relaxed-clock posterior
|
|
227
228
|
dating, effective population-size inference, or 95% HPD intervals.
|
|
228
229
|
|
|
229
230
|
## Python API
|
|
@@ -249,7 +250,7 @@ print(result.metrics["enc"])
|
|
|
249
250
|
print(result.metrics["gc3"])
|
|
250
251
|
```
|
|
251
252
|
|
|
252
|
-
Create a publication-ready figure
|
|
253
|
+
Create a publication-ready figure with CodonAdaptPy:
|
|
253
254
|
|
|
254
255
|
```python
|
|
255
256
|
from codonadaptpy import PublicationPlotManager
|
|
@@ -264,7 +265,7 @@ plots.save(figure, "f_gene_diagnostics.pdf")
|
|
|
264
265
|
plots.save(figure, "f_gene_diagnostics.png", dpi=600)
|
|
265
266
|
```
|
|
266
267
|
|
|
267
|
-
Run phylogenetics through the
|
|
268
|
+
Run phylogenetics through the Python API:
|
|
268
269
|
|
|
269
270
|
```python
|
|
270
271
|
from codonadaptpy import ETE3TreePlotter, PhylogeneticAnalyzer, TemporalAnalyzer
|
|
@@ -300,7 +301,7 @@ JSON profiles preserve provenance and versioning:
|
|
|
300
301
|
}
|
|
301
302
|
```
|
|
302
303
|
|
|
303
|
-
Missing sense codons are
|
|
304
|
+
Missing sense codons are represented by zero counts during validation. CSV/TSV profiles use `codon,count` or `codon,frequency` columns. The only bundled profile is `uniform_standard`, an explicitly non-biological testing baseline; biological host profiles must retain a documented source and release.
|
|
304
305
|
|
|
305
306
|
## CAI edge-case policy
|
|
306
307
|
|
|
@@ -329,7 +330,7 @@ Every analysis captures CodonAdaptPy and Python versions, UTC analysis time, gen
|
|
|
329
330
|
```text
|
|
330
331
|
src/codonadaptpy/
|
|
331
332
|
├── aggregation.py # Per-isolate gene and genome-wide CDS scopes
|
|
332
|
-
├── analyzer.py # Main
|
|
333
|
+
├── analyzer.py # Main analysis API
|
|
333
334
|
├── comparative.py # Group and multivariate analysis
|
|
334
335
|
├── genetic_code.py # Translation tables and codon families
|
|
335
336
|
├── metrics/ # Adaptation, usage, composition, pair, host, evolution
|
|
@@ -342,5 +343,5 @@ src/codonadaptpy/
|
|
|
342
343
|
├── reporting.py # JSON/CSV/Excel/HTML/PDF/FASTA output
|
|
343
344
|
├── validation.py # Coding-sequence quality control
|
|
344
345
|
├── visualization.py # Interactive and static plots
|
|
345
|
-
└── cli.py #
|
|
346
|
+
└── cli.py # Command-line subcommands
|
|
346
347
|
```
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"""
|
|
2
2
|
CodonAdaptPy Package
|
|
3
3
|
|
|
4
|
-
CodonAdaptPy is
|
|
4
|
+
CodonAdaptPy is a Python package for validating
|
|
5
5
|
coding sequences, calculating codon-usage and host-adaptation statistics,
|
|
6
6
|
performing comparative and evolutionary analyses, generating reproducible
|
|
7
|
-
reports, and designing
|
|
7
|
+
reports, and designing synonymous coding sequences under user-defined constraints.
|
|
8
8
|
|
|
9
9
|
Features:
|
|
10
10
|
- FASTA, GenBank, tabular, pasted-sequence, and batch input workflows
|
|
@@ -22,7 +22,7 @@ Scientific interpretation:
|
|
|
22
22
|
:Created: July 20, 2026
|
|
23
23
|
:Updated: July 20, 2026
|
|
24
24
|
:Author: Naveen Duhan
|
|
25
|
-
:Version: 1.0.
|
|
25
|
+
:Version: 1.0.1
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
from .__version__ import __author__, __email__, __version__
|
|
@@ -8,12 +8,12 @@ a raw multi-ORF genome as one continuous reading frame.
|
|
|
8
8
|
|
|
9
9
|
Classes:
|
|
10
10
|
- IsolateAnalysis: Per-gene, genome-wide, and focus-gene results.
|
|
11
|
-
- CDSAggregator: Metadata-aware
|
|
11
|
+
- CDSAggregator: Metadata-aware analysis of isolate collections.
|
|
12
12
|
|
|
13
13
|
:Created: July 20, 2026
|
|
14
14
|
:Updated: July 20, 2026
|
|
15
15
|
:Author: Naveen Duhan
|
|
16
|
-
:Version: 1.0.
|
|
16
|
+
:Version: 1.0.1
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
from __future__ import annotations
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
|
-
CodonAdaptPy Analysis
|
|
2
|
+
CodonAdaptPy Analysis Interface
|
|
3
3
|
|
|
4
|
-
This module exposes the primary
|
|
4
|
+
This module exposes the primary high-level Python API. :class:`CodonAnalyzer`
|
|
5
5
|
coordinates normalization, validation, intrinsic metrics, optional reference-
|
|
6
6
|
dependent adaptation statistics, multi-host comparisons, simulation, and
|
|
7
7
|
sliding-window profiles while keeping each calculation module independently
|
|
@@ -14,7 +14,7 @@ Classes:
|
|
|
14
14
|
:Created: July 20, 2026
|
|
15
15
|
:Updated: July 20, 2026
|
|
16
16
|
:Author: Naveen Duhan
|
|
17
|
-
:Version: 1.0.
|
|
17
|
+
:Version: 1.0.1
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
20
|
from __future__ import annotations
|
|
@@ -55,7 +55,7 @@ class AnalysisConfig:
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
class CodonAnalyzer:
|
|
58
|
-
"""
|
|
58
|
+
"""Coordinate codon-usage and adaptation analyses through one interface."""
|
|
59
59
|
|
|
60
60
|
def __init__(
|
|
61
61
|
self,
|
|
@@ -85,7 +85,7 @@ class CodonAnalyzer:
|
|
|
85
85
|
)
|
|
86
86
|
|
|
87
87
|
def analyze(self, record: SequenceRecord) -> AnalysisResult:
|
|
88
|
-
"""Analyze one sequence and return a
|
|
88
|
+
"""Analyze one sequence and return a structured result."""
|
|
89
89
|
|
|
90
90
|
validation = self.validator.validate(record, raise_on_error=self.config.strict)
|
|
91
91
|
sequence = validation.normalized_sequence
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"""
|
|
2
2
|
CodonAdaptPy Command-Line Interface
|
|
3
3
|
|
|
4
|
-
This module
|
|
4
|
+
This module provides commands for coding-sequence analysis,
|
|
5
5
|
multi-host comparison, reference construction/cataloging, and constrained
|
|
6
6
|
optimization or deoptimization. It also exposes MAFFT/trimAL/IQ-TREE/FastTree
|
|
7
7
|
phylogenetics with ETE3-backed static tree and temporal-diagnostic figures.
|
|
8
|
-
CLI workflows
|
|
9
|
-
|
|
8
|
+
CLI workflows use the same public Python API as direct Python calls and write
|
|
9
|
+
reproducible, structured output directories.
|
|
10
10
|
|
|
11
11
|
Commands:
|
|
12
12
|
- analyze: Analyze one sequence or a batch input file.
|
|
@@ -22,7 +22,7 @@ Functions:
|
|
|
22
22
|
:Created: July 20, 2026
|
|
23
23
|
:Updated: July 20, 2026
|
|
24
24
|
:Author: Naveen Duhan
|
|
25
|
-
:Version: 1.0.
|
|
25
|
+
:Version: 1.0.1
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
from __future__ import annotations
|
|
@@ -49,7 +49,7 @@ from .visualization import PlotManager
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
def build_parser() -> argparse.ArgumentParser:
|
|
52
|
-
"""Construct the top-level parser and
|
|
52
|
+
"""Construct the top-level parser and its subcommands."""
|
|
53
53
|
|
|
54
54
|
parser = argparse.ArgumentParser(
|
|
55
55
|
prog="codonadaptpy",
|
|
@@ -62,7 +62,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
62
62
|
_add_analysis_arguments(analyze)
|
|
63
63
|
analyze.set_defaults(handler=_run_analyze)
|
|
64
64
|
|
|
65
|
-
compare = subparsers.add_parser("compare", help="Compare sequences
|
|
65
|
+
compare = subparsers.add_parser("compare", help="Compare sequences against multiple host references.")
|
|
66
66
|
_add_analysis_arguments(compare)
|
|
67
67
|
compare.set_defaults(handler=_run_analyze)
|
|
68
68
|
|
|
@@ -12,7 +12,7 @@ Classes:
|
|
|
12
12
|
:Created: July 20, 2026
|
|
13
13
|
:Updated: July 20, 2026
|
|
14
14
|
:Author: Naveen Duhan
|
|
15
|
-
:Version: 1.0.
|
|
15
|
+
:Version: 1.0.1
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
from __future__ import annotations
|
|
@@ -64,7 +64,7 @@ class HostComparator:
|
|
|
64
64
|
self.adaptation = AdaptationMetrics(self.genetic_code)
|
|
65
65
|
|
|
66
66
|
def compare(self, codons: list[str], reference: Mapping[str, float]) -> dict[str, float]:
|
|
67
|
-
"""Calculate a
|
|
67
|
+
"""Calculate a structured host-comparison result for one reference."""
|
|
68
68
|
|
|
69
69
|
keys = sorted(codon for codon, aa in self.genetic_code.forward_table.items() if aa != "*")
|
|
70
70
|
query_frequency = self.usage.frequencies(codons)
|
|
@@ -12,7 +12,7 @@ Classes:
|
|
|
12
12
|
:Created: July 20, 2026
|
|
13
13
|
:Updated: July 20, 2026
|
|
14
14
|
:Author: Naveen Duhan
|
|
15
|
-
:Version: 1.0.
|
|
15
|
+
:Version: 1.0.1
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
from __future__ import annotations
|
|
@@ -32,7 +32,7 @@ class CodonUsageMetrics:
|
|
|
32
32
|
self.genetic_code = genetic_code or GeneticCode.from_ncbi(1)
|
|
33
33
|
|
|
34
34
|
def counts(self, codons: Iterable[str], *, include_stops: bool = False) -> dict[str, int]:
|
|
35
|
-
"""Count unambiguous recognized codons and return a
|
|
35
|
+
"""Count unambiguous recognized codons and return a 64-codon map."""
|
|
36
36
|
|
|
37
37
|
observed = Counter(codon.upper().replace("U", "T") for codon in codons)
|
|
38
38
|
return {
|
|
@@ -11,12 +11,12 @@ Classes:
|
|
|
11
11
|
- ValidationConfig: User-selected validation policy.
|
|
12
12
|
- ValidationIssue: One structured validation observation.
|
|
13
13
|
- ValidationReport: Validation outcome and normalized sequence.
|
|
14
|
-
- AnalysisResult:
|
|
14
|
+
- AnalysisResult: Metrics and metadata for a single sequence.
|
|
15
15
|
|
|
16
16
|
:Created: July 20, 2026
|
|
17
17
|
:Updated: July 20, 2026
|
|
18
18
|
:Author: Naveen Duhan
|
|
19
|
-
:Version: 1.0.
|
|
19
|
+
:Version: 1.0.1
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
22
|
from __future__ import annotations
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
CodonAdaptPy Phylogenetic and Temporal Analysis
|
|
3
3
|
|
|
4
|
-
This module provides
|
|
4
|
+
This module provides reusable interfaces for reproducible nucleotide or
|
|
5
5
|
protein phylogenetics and lightweight temporal exploration. External programs
|
|
6
6
|
are invoked with argument lists rather than shell strings, their commands and
|
|
7
7
|
outputs are retained, and failures include captured diagnostic text.
|
|
@@ -23,7 +23,7 @@ Classes:
|
|
|
23
23
|
:Created: July 20, 2026
|
|
24
24
|
:Updated: July 20, 2026
|
|
25
25
|
:Author: Naveen Duhan
|
|
26
|
-
:Version: 1.0.
|
|
26
|
+
:Version: 1.0.1
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
29
|
from __future__ import annotations
|
|
@@ -12,7 +12,7 @@ Classes:
|
|
|
12
12
|
:Created: July 20, 2026
|
|
13
13
|
:Updated: July 20, 2026
|
|
14
14
|
:Author: Naveen Duhan
|
|
15
|
-
:Version: 1.0.
|
|
15
|
+
:Version: 1.0.1
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
from __future__ import annotations
|
|
@@ -33,7 +33,7 @@ class ReportGenerator:
|
|
|
33
33
|
"""Export package results to machine-readable and publication-friendly files."""
|
|
34
34
|
|
|
35
35
|
def write_json(self, results: list[AnalysisResult], path: str | Path) -> Path:
|
|
36
|
-
"""Write
|
|
36
|
+
"""Write nested analysis results as indented JSON."""
|
|
37
37
|
|
|
38
38
|
destination = Path(path)
|
|
39
39
|
destination.write_text(
|
|
@@ -18,7 +18,7 @@ Classes:
|
|
|
18
18
|
:Created: July 20, 2026
|
|
19
19
|
:Updated: July 20, 2026
|
|
20
20
|
:Author: Naveen Duhan
|
|
21
|
-
:Version: 1.0.
|
|
21
|
+
:Version: 1.0.1
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
24
|
from __future__ import annotations
|
|
@@ -166,4 +166,3 @@ class SequenceValidator:
|
|
|
166
166
|
if raise_on_error and not report.is_valid:
|
|
167
167
|
raise SequenceValidationError("; ".join(issue.message for issue in report.errors))
|
|
168
168
|
return report
|
|
169
|
-
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Integration tests for the high-level
|
|
1
|
+
"""Integration tests for the high-level analysis API."""
|
|
2
2
|
|
|
3
3
|
from codonadaptpy import CodonAnalyzer, SequenceRecord
|
|
4
4
|
from codonadaptpy.references import ReferenceManager
|
|
@@ -11,7 +11,7 @@ def test_complete_analysis_with_reference() -> None:
|
|
|
11
11
|
assert result.metrics["cai"] == 1.0
|
|
12
12
|
assert result.metrics["sense_codons"] == 4
|
|
13
13
|
assert len(result.codon_counts) == 61
|
|
14
|
-
assert result.metadata["software_version"] == "1.0.
|
|
14
|
+
assert result.metadata["software_version"] == "1.0.1"
|
|
15
15
|
assert len(result.metadata["input_sha256"]) == 64
|
|
16
16
|
|
|
17
17
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|