MetaPont 0.1.0__tar.gz → 0.1.2__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.
- metapont-0.1.2/PKG-INFO +224 -0
- metapont-0.1.2/README.md +202 -0
- {metapont-0.1.0 → metapont-0.1.2}/pyproject.toml +1 -1
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/__init__.py +1 -1
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/cli.py +11 -2
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/pipeline.py +26 -16
- metapont-0.1.2/src/MetaPont.egg-info/PKG-INFO +224 -0
- metapont-0.1.0/PKG-INFO +0 -368
- metapont-0.1.0/README.md +0 -346
- metapont-0.1.0/src/MetaPont.egg-info/PKG-INFO +0 -368
- {metapont-0.1.0 → metapont-0.1.2}/LICENSE +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/setup.cfg +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/analysis.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/compat.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/constants.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/layout.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/old/Contig_Coverage_Summary.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/old/Extract_By_Function.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/old/Extract_By_Taxa.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/old/Extract_Function_By_Taxa.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/old/Extract_Reads_By_Function.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/old/Function_By_Taxa.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/old/MetaPont_Combine.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/old/Report_Contig_Lineage.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/old/__init__.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/old/constants.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont/parsers.py +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont.egg-info/SOURCES.txt +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont.egg-info/dependency_links.txt +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont.egg-info/entry_points.txt +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont.egg-info/requires.txt +0 -0
- {metapont-0.1.0 → metapont-0.1.2}/src/MetaPont.egg-info/top_level.txt +0 -0
metapont-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: MetaPont
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Integrated analysis of metagenomic assembly, readmapping, Kraken2 and eggNOG-mapper outputs.
|
|
5
|
+
Author-email: Nicholas Dimonaco <nicholas@dimonaco.co.uk>
|
|
6
|
+
License-Expression: GPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/TheHuwsLab/MetaPont
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/TheHuwsLab/MetaPont/issues
|
|
9
|
+
Keywords: metagenomics,bioinformatics,genomics,Kraken2,eggNOG-mapper,readmapping
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Provides-Extra: plots
|
|
18
|
+
Requires-Dist: matplotlib>=3.7; extra == "plots"
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# MetaPont v0.1.2
|
|
24
|
+
|
|
25
|
+
MetaPont integrates existing metagenomic workflow outputs into per-sample and
|
|
26
|
+
cross-sample tables for contigs, taxonomy, readmapping support, and eggNOG-mapper
|
|
27
|
+
functional annotations. It is designed for outputs from the
|
|
28
|
+
[HuwsLab Metagenomic Workflow](https://github.com/TheHuwsLab/Metagenomic_Workflow),
|
|
29
|
+
but does not run assembly, readmapping, Kraken2, or eggNOG-mapper itself.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
MetaPont requires Python 3.10 or later and has no required third-party runtime
|
|
34
|
+
dependencies.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install MetaPont
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Check the installed version and available commands with:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
metapont --version
|
|
44
|
+
metapont --help
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Input layout
|
|
48
|
+
|
|
49
|
+
Pass MetaPont the directory containing sample directories. Sample directories
|
|
50
|
+
are selected when their names start with one of the comma-separated prefixes
|
|
51
|
+
provided with `--prefix`.
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
workflow-output/
|
|
55
|
+
├── E1.0/
|
|
56
|
+
│ ├── E1.0_metaspades/contigs.fasta
|
|
57
|
+
│ ├── E1.0_pyrodigal/
|
|
58
|
+
│ ├── E1.0_eggnog_mapper/
|
|
59
|
+
│ │ └── E1.0_pyrodigal_eggnog_mapped.emapper.annotations
|
|
60
|
+
│ ├── E1.0_kraken2/
|
|
61
|
+
│ │ ├── E1.0_kraken2.txt
|
|
62
|
+
│ │ └── E1.0_kraken2_report.txt
|
|
63
|
+
│ └── E1.0_readmapped/
|
|
64
|
+
│ ├── E1.0_readmapped_contig_summary.txt
|
|
65
|
+
│ └── E1.0_readmapped_cds_summary.txt
|
|
66
|
+
└── E2.0/
|
|
67
|
+
└── ...
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
MetaPont discovers common workflow naming variants and searches within each
|
|
71
|
+
sample directory for the relevant files. The main inputs are:
|
|
72
|
+
|
|
73
|
+
| Input | Used for |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| eggNOG-mapper `.emapper.annotations` | Gene annotations and functional features |
|
|
76
|
+
| Kraken2 contig classifications and report | Contig taxonomic assignments and lineages |
|
|
77
|
+
| Readmapping contig summary | Contig lengths, mapped-read counts, and mapping proportions |
|
|
78
|
+
| Readmapping CDS summary | Read support attributed to annotated genes |
|
|
79
|
+
| Contig FASTA | Contig inventory and lengths when a readmapping contig summary is absent |
|
|
80
|
+
|
|
81
|
+
Inputs are discovered independently, so incomplete samples can still be
|
|
82
|
+
included. Missing or stale outputs are reported as warnings; MetaPont does not
|
|
83
|
+
rerun missing upstream analyses. Kraken2 assignments shorter than the selected
|
|
84
|
+
minimum contig length are omitted from taxonomy attribution by default. This
|
|
85
|
+
filter does not rerun Kraken2.
|
|
86
|
+
|
|
87
|
+
## Commands
|
|
88
|
+
|
|
89
|
+
### Build integrated results
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
metapont run \
|
|
93
|
+
--root-dir /path/to/workflow-output \
|
|
94
|
+
--prefix E
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`--prefix` accepts comma-separated values, for example `E,L,P`. By default,
|
|
98
|
+
results are written under `ROOT/MetaPont_Results`. Override that location with
|
|
99
|
+
`--output-dir`.
|
|
100
|
+
|
|
101
|
+
Useful options:
|
|
102
|
+
|
|
103
|
+
| Option | Default | Description |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
| `--force` | Off | Regenerate outputs even when the input signature matches a cached run. |
|
|
106
|
+
| `--no-heal-flags` | Off | Do not recreate missing upstream success flags when their outputs are complete and current. |
|
|
107
|
+
| `--min-contig-length N` | `2500` | Minimum Kraken2-assigned contig length retained for taxonomy attribution; use `0` to disable the filter. |
|
|
108
|
+
| `--taxon-function-abundance` | Off | Build the expanded taxon-by-function table. This can use substantial memory and disk space. |
|
|
109
|
+
| `--plots` | Off | Write optional quick-look PNG plots. Requires the `plots` installation extra. |
|
|
110
|
+
|
|
111
|
+
`metapont combine` is an alias for `metapont run`. The `metapont-combine`
|
|
112
|
+
command is also available for compatibility with the earlier combine command.
|
|
113
|
+
|
|
114
|
+
### Audit sample inputs
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
metapont inventory --root-dir /path/to/workflow-output --prefix E
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The inventory reports discovered inputs, expected outputs, success flags, and
|
|
121
|
+
warnings for each sample. Add `--heal-flags` to recreate a missing stage flag
|
|
122
|
+
only when its corresponding output files are complete and current.
|
|
123
|
+
|
|
124
|
+
### Summarise readmapping coverage
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
metapont coverage \
|
|
128
|
+
--root-dir /path/to/workflow-output \
|
|
129
|
+
--prefix E \
|
|
130
|
+
--read-length 150
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The optional read length adds an approximate mapped-read coverage estimate.
|
|
134
|
+
Without `--output`, the TSV is written to
|
|
135
|
+
`MetaPont_Results/summary/contig_coverage_summary.tsv`.
|
|
136
|
+
|
|
137
|
+
### Query functions and taxa
|
|
138
|
+
|
|
139
|
+
Find taxa supporting a functional ID:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
metapont query-function \
|
|
143
|
+
--root-dir /path/to/workflow-output \
|
|
144
|
+
--function-id GO:0016597 \
|
|
145
|
+
--category GO \
|
|
146
|
+
--rank Genus \
|
|
147
|
+
--top 10 \
|
|
148
|
+
--output go_taxa.tsv
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Omit `--category` to search all supported annotation categories. `--top`
|
|
152
|
+
limits the results to the highest-support taxa per sample. Alternatively,
|
|
153
|
+
provide `--gene-table` to query a particular integrated gene table, or
|
|
154
|
+
`--output-dir` to select a non-default results directory.
|
|
155
|
+
|
|
156
|
+
Find the most supported features associated with a taxon:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
metapont query-taxon \
|
|
160
|
+
--root-dir /path/to/workflow-output \
|
|
161
|
+
--taxon Bacillus \
|
|
162
|
+
--category GO \
|
|
163
|
+
--rank Genus \
|
|
164
|
+
--top 20 \
|
|
165
|
+
--output bacillus_go.tsv
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Taxon matching is case-insensitive and searches the chosen rank as well as the
|
|
169
|
+
full lineage. `--category` is required for this query. Both query commands
|
|
170
|
+
accept an explicit `--gene-table` path; plain TSV and gzip-compressed TSV files
|
|
171
|
+
are supported.
|
|
172
|
+
|
|
173
|
+
## Results
|
|
174
|
+
|
|
175
|
+
The default output tree is:
|
|
176
|
+
|
|
177
|
+
```text
|
|
178
|
+
MetaPont_Results/
|
|
179
|
+
├── combined/
|
|
180
|
+
│ ├── all_contigs.tsv.gz
|
|
181
|
+
│ └── gene_annotations.tsv.gz
|
|
182
|
+
├── functional/
|
|
183
|
+
│ ├── functional_abundance.tsv
|
|
184
|
+
│ ├── matrices/
|
|
185
|
+
│ └── taxon_function_abundance.tsv
|
|
186
|
+
├── inventory/
|
|
187
|
+
│ └── sample_inventory.tsv
|
|
188
|
+
├── metadata/
|
|
189
|
+
│ ├── input_signature.json
|
|
190
|
+
│ └── run_manifest.json
|
|
191
|
+
├── per_sample_contigs/
|
|
192
|
+
│ └── SAMPLE_Contigs.tsv.gz
|
|
193
|
+
├── summary/
|
|
194
|
+
│ ├── pipeline_warnings.tsv
|
|
195
|
+
│ ├── sample_inventory.tsv
|
|
196
|
+
│ └── sample_summary.tsv
|
|
197
|
+
└── taxonomy/
|
|
198
|
+
└── taxonomy_abundance.tsv
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The main tables are tab-delimited; `.tsv.gz` files are gzip-compressed TSVs.
|
|
202
|
+
Functional matrices are written separately for every supported annotation
|
|
203
|
+
category, with both gene counts and gene read-support values. The optional
|
|
204
|
+
taxon-function abundance table contains taxon/category/feature combinations
|
|
205
|
+
across taxonomic ranks.
|
|
206
|
+
|
|
207
|
+
Supported functional categories include `COG`, `eggNOG_OG`, `GO`, `EC`,
|
|
208
|
+
`KEGG_KO`, `KEGG_Pathway`, `KEGG_Module`, `KEGG_Reaction`, `KEGG_rclass`,
|
|
209
|
+
`BRITE`, `KEGG_TC`, `CAZy`, `BiGG_Reaction`, and `PFAM`.
|
|
210
|
+
|
|
211
|
+
`Gene_Read_Support` is derived from read-to-CDS overlaps in the CDS summary; it
|
|
212
|
+
is not a count of unique reads across genes. A read can support multiple genes
|
|
213
|
+
or annotations, so functional support values are not mutually exclusive.
|
|
214
|
+
Taxonomic relative abundance uses total mapped-read support as its denominator.
|
|
215
|
+
|
|
216
|
+
Samples with missing or stale workflow outputs are retained where possible and
|
|
217
|
+
listed in `summary/pipeline_warnings.tsv`. A clean run writes
|
|
218
|
+
`MetaPont_analysis.success`; a run with warnings writes
|
|
219
|
+
`completed_with_warnings.flag`.
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
MetaPont is distributed under the
|
|
224
|
+
[GNU General Public License v3.0 or later](LICENSE).
|
metapont-0.1.2/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# MetaPont v0.1.2
|
|
2
|
+
|
|
3
|
+
MetaPont integrates existing metagenomic workflow outputs into per-sample and
|
|
4
|
+
cross-sample tables for contigs, taxonomy, readmapping support, and eggNOG-mapper
|
|
5
|
+
functional annotations. It is designed for outputs from the
|
|
6
|
+
[HuwsLab Metagenomic Workflow](https://github.com/TheHuwsLab/Metagenomic_Workflow),
|
|
7
|
+
but does not run assembly, readmapping, Kraken2, or eggNOG-mapper itself.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
MetaPont requires Python 3.10 or later and has no required third-party runtime
|
|
12
|
+
dependencies.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install MetaPont
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Check the installed version and available commands with:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
metapont --version
|
|
22
|
+
metapont --help
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Input layout
|
|
26
|
+
|
|
27
|
+
Pass MetaPont the directory containing sample directories. Sample directories
|
|
28
|
+
are selected when their names start with one of the comma-separated prefixes
|
|
29
|
+
provided with `--prefix`.
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
workflow-output/
|
|
33
|
+
├── E1.0/
|
|
34
|
+
│ ├── E1.0_metaspades/contigs.fasta
|
|
35
|
+
│ ├── E1.0_pyrodigal/
|
|
36
|
+
│ ├── E1.0_eggnog_mapper/
|
|
37
|
+
│ │ └── E1.0_pyrodigal_eggnog_mapped.emapper.annotations
|
|
38
|
+
│ ├── E1.0_kraken2/
|
|
39
|
+
│ │ ├── E1.0_kraken2.txt
|
|
40
|
+
│ │ └── E1.0_kraken2_report.txt
|
|
41
|
+
│ └── E1.0_readmapped/
|
|
42
|
+
│ ├── E1.0_readmapped_contig_summary.txt
|
|
43
|
+
│ └── E1.0_readmapped_cds_summary.txt
|
|
44
|
+
└── E2.0/
|
|
45
|
+
└── ...
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
MetaPont discovers common workflow naming variants and searches within each
|
|
49
|
+
sample directory for the relevant files. The main inputs are:
|
|
50
|
+
|
|
51
|
+
| Input | Used for |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| eggNOG-mapper `.emapper.annotations` | Gene annotations and functional features |
|
|
54
|
+
| Kraken2 contig classifications and report | Contig taxonomic assignments and lineages |
|
|
55
|
+
| Readmapping contig summary | Contig lengths, mapped-read counts, and mapping proportions |
|
|
56
|
+
| Readmapping CDS summary | Read support attributed to annotated genes |
|
|
57
|
+
| Contig FASTA | Contig inventory and lengths when a readmapping contig summary is absent |
|
|
58
|
+
|
|
59
|
+
Inputs are discovered independently, so incomplete samples can still be
|
|
60
|
+
included. Missing or stale outputs are reported as warnings; MetaPont does not
|
|
61
|
+
rerun missing upstream analyses. Kraken2 assignments shorter than the selected
|
|
62
|
+
minimum contig length are omitted from taxonomy attribution by default. This
|
|
63
|
+
filter does not rerun Kraken2.
|
|
64
|
+
|
|
65
|
+
## Commands
|
|
66
|
+
|
|
67
|
+
### Build integrated results
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
metapont run \
|
|
71
|
+
--root-dir /path/to/workflow-output \
|
|
72
|
+
--prefix E
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`--prefix` accepts comma-separated values, for example `E,L,P`. By default,
|
|
76
|
+
results are written under `ROOT/MetaPont_Results`. Override that location with
|
|
77
|
+
`--output-dir`.
|
|
78
|
+
|
|
79
|
+
Useful options:
|
|
80
|
+
|
|
81
|
+
| Option | Default | Description |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| `--force` | Off | Regenerate outputs even when the input signature matches a cached run. |
|
|
84
|
+
| `--no-heal-flags` | Off | Do not recreate missing upstream success flags when their outputs are complete and current. |
|
|
85
|
+
| `--min-contig-length N` | `2500` | Minimum Kraken2-assigned contig length retained for taxonomy attribution; use `0` to disable the filter. |
|
|
86
|
+
| `--taxon-function-abundance` | Off | Build the expanded taxon-by-function table. This can use substantial memory and disk space. |
|
|
87
|
+
| `--plots` | Off | Write optional quick-look PNG plots. Requires the `plots` installation extra. |
|
|
88
|
+
|
|
89
|
+
`metapont combine` is an alias for `metapont run`. The `metapont-combine`
|
|
90
|
+
command is also available for compatibility with the earlier combine command.
|
|
91
|
+
|
|
92
|
+
### Audit sample inputs
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
metapont inventory --root-dir /path/to/workflow-output --prefix E
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The inventory reports discovered inputs, expected outputs, success flags, and
|
|
99
|
+
warnings for each sample. Add `--heal-flags` to recreate a missing stage flag
|
|
100
|
+
only when its corresponding output files are complete and current.
|
|
101
|
+
|
|
102
|
+
### Summarise readmapping coverage
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
metapont coverage \
|
|
106
|
+
--root-dir /path/to/workflow-output \
|
|
107
|
+
--prefix E \
|
|
108
|
+
--read-length 150
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The optional read length adds an approximate mapped-read coverage estimate.
|
|
112
|
+
Without `--output`, the TSV is written to
|
|
113
|
+
`MetaPont_Results/summary/contig_coverage_summary.tsv`.
|
|
114
|
+
|
|
115
|
+
### Query functions and taxa
|
|
116
|
+
|
|
117
|
+
Find taxa supporting a functional ID:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
metapont query-function \
|
|
121
|
+
--root-dir /path/to/workflow-output \
|
|
122
|
+
--function-id GO:0016597 \
|
|
123
|
+
--category GO \
|
|
124
|
+
--rank Genus \
|
|
125
|
+
--top 10 \
|
|
126
|
+
--output go_taxa.tsv
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Omit `--category` to search all supported annotation categories. `--top`
|
|
130
|
+
limits the results to the highest-support taxa per sample. Alternatively,
|
|
131
|
+
provide `--gene-table` to query a particular integrated gene table, or
|
|
132
|
+
`--output-dir` to select a non-default results directory.
|
|
133
|
+
|
|
134
|
+
Find the most supported features associated with a taxon:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
metapont query-taxon \
|
|
138
|
+
--root-dir /path/to/workflow-output \
|
|
139
|
+
--taxon Bacillus \
|
|
140
|
+
--category GO \
|
|
141
|
+
--rank Genus \
|
|
142
|
+
--top 20 \
|
|
143
|
+
--output bacillus_go.tsv
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Taxon matching is case-insensitive and searches the chosen rank as well as the
|
|
147
|
+
full lineage. `--category` is required for this query. Both query commands
|
|
148
|
+
accept an explicit `--gene-table` path; plain TSV and gzip-compressed TSV files
|
|
149
|
+
are supported.
|
|
150
|
+
|
|
151
|
+
## Results
|
|
152
|
+
|
|
153
|
+
The default output tree is:
|
|
154
|
+
|
|
155
|
+
```text
|
|
156
|
+
MetaPont_Results/
|
|
157
|
+
├── combined/
|
|
158
|
+
│ ├── all_contigs.tsv.gz
|
|
159
|
+
│ └── gene_annotations.tsv.gz
|
|
160
|
+
├── functional/
|
|
161
|
+
│ ├── functional_abundance.tsv
|
|
162
|
+
│ ├── matrices/
|
|
163
|
+
│ └── taxon_function_abundance.tsv
|
|
164
|
+
├── inventory/
|
|
165
|
+
│ └── sample_inventory.tsv
|
|
166
|
+
├── metadata/
|
|
167
|
+
│ ├── input_signature.json
|
|
168
|
+
│ └── run_manifest.json
|
|
169
|
+
├── per_sample_contigs/
|
|
170
|
+
│ └── SAMPLE_Contigs.tsv.gz
|
|
171
|
+
├── summary/
|
|
172
|
+
│ ├── pipeline_warnings.tsv
|
|
173
|
+
│ ├── sample_inventory.tsv
|
|
174
|
+
│ └── sample_summary.tsv
|
|
175
|
+
└── taxonomy/
|
|
176
|
+
└── taxonomy_abundance.tsv
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The main tables are tab-delimited; `.tsv.gz` files are gzip-compressed TSVs.
|
|
180
|
+
Functional matrices are written separately for every supported annotation
|
|
181
|
+
category, with both gene counts and gene read-support values. The optional
|
|
182
|
+
taxon-function abundance table contains taxon/category/feature combinations
|
|
183
|
+
across taxonomic ranks.
|
|
184
|
+
|
|
185
|
+
Supported functional categories include `COG`, `eggNOG_OG`, `GO`, `EC`,
|
|
186
|
+
`KEGG_KO`, `KEGG_Pathway`, `KEGG_Module`, `KEGG_Reaction`, `KEGG_rclass`,
|
|
187
|
+
`BRITE`, `KEGG_TC`, `CAZy`, `BiGG_Reaction`, and `PFAM`.
|
|
188
|
+
|
|
189
|
+
`Gene_Read_Support` is derived from read-to-CDS overlaps in the CDS summary; it
|
|
190
|
+
is not a count of unique reads across genes. A read can support multiple genes
|
|
191
|
+
or annotations, so functional support values are not mutually exclusive.
|
|
192
|
+
Taxonomic relative abundance uses total mapped-read support as its denominator.
|
|
193
|
+
|
|
194
|
+
Samples with missing or stale workflow outputs are retained where possible and
|
|
195
|
+
listed in `summary/pipeline_warnings.tsv`. A clean run writes
|
|
196
|
+
`MetaPont_analysis.success`; a run with warnings writes
|
|
197
|
+
`completed_with_warnings.flag`.
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
|
|
201
|
+
MetaPont is distributed under the
|
|
202
|
+
[GNU General Public License v3.0 or later](LICENSE).
|
|
@@ -94,7 +94,14 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
94
94
|
run_p.add_argument("--no-heal-flags", action="store_true", help="Do not recreate missing pipeline flags when all corresponding outputs exist.")
|
|
95
95
|
run_p.add_argument("--min-contig-length", type=int, default=2500, help="Minimum contig length to retain an existing Kraken2 assignment; classifications are not rerun.")
|
|
96
96
|
run_p.add_argument("--plots", action="store_true", help="Generate optional quick-look PNG plots (requires matplotlib).")
|
|
97
|
-
|
|
97
|
+
run_p.add_argument(
|
|
98
|
+
"--taxon-function-abundance",
|
|
99
|
+
action="store_true",
|
|
100
|
+
help=(
|
|
101
|
+
"Generate the expanded taxon-function abundance table. "
|
|
102
|
+
"Can require substantial memory and disk space."
|
|
103
|
+
),
|
|
104
|
+
)
|
|
98
105
|
inv_p = sub.add_parser("inventory", help="Audit per-sample inputs, pipeline outputs and success flags.")
|
|
99
106
|
_add_root_prefix(inv_p)
|
|
100
107
|
inv_p.add_argument("--heal-flags", action="store_true", help="Recreate missing flags only when the relevant output set is complete and current.")
|
|
@@ -105,7 +112,8 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
105
112
|
cov_p.add_argument("--output", default=None, help="Output TSV path (defaults under MetaPont_Results/summary).")
|
|
106
113
|
|
|
107
114
|
qf_p = sub.add_parser("query-function", help="Find taxa supporting a particular eggNOG functional ID.")
|
|
108
|
-
qf_p.add_argument("--root-dir", "-d",
|
|
115
|
+
qf_p.add_argument("--root-dir", "-d", default=None,
|
|
116
|
+
help="Workflow root used to find the default gene table; not needed with --gene-table or --output-dir.")
|
|
109
117
|
qf_p.add_argument("--output-dir", default=None)
|
|
110
118
|
qf_p.add_argument("--gene-table", default=None, help="Gene annotation TSV/TSV.GZ; defaults to the integrated output table.")
|
|
111
119
|
qf_p.add_argument("--function-id", "-f", required=True, help="Exact function ID, e.g. GO:0016597 or EC:2.7.11.1.")
|
|
@@ -132,6 +140,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
132
140
|
min_contig_length=args.min_contig_length,
|
|
133
141
|
heal_flags=not args.no_heal_flags,
|
|
134
142
|
force=args.force,
|
|
143
|
+
include_taxon_function_abundance=args.taxon_function_abundance,
|
|
135
144
|
)
|
|
136
145
|
if args.plots:
|
|
137
146
|
output_root = Path(result["output_dir"])
|
|
@@ -201,7 +201,7 @@ def _iter_base_contigs(sample: SamplePaths, assignments: dict[str, dict[str, Any
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
|
|
204
|
-
def _annotation_maps(sample: SamplePaths, contig_ids: set[str], assignments: dict[str, dict[str, Any]], gene_support: dict[str, int], gene_writer: csv.DictWriter):
|
|
204
|
+
def _annotation_maps(sample: SamplePaths, contig_ids: set[str], assignments: dict[str, dict[str, Any]], gene_support: dict[str, int], gene_writer: csv.DictWriter, include_taxon_functions: bool = False):
|
|
205
205
|
by_contig: dict[str, dict[str, Any]] = {}
|
|
206
206
|
gene_count = 0
|
|
207
207
|
functional: dict[tuple[str, str], list[int]] = defaultdict(lambda: [0, 0])
|
|
@@ -233,13 +233,14 @@ def _annotation_maps(sample: SamplePaths, contig_ids: set[str], assignments: dic
|
|
|
233
233
|
record["features"][category].add(feature)
|
|
234
234
|
functional[(category, feature)][0] += 1
|
|
235
235
|
functional[(category, feature)][1] += support
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
236
|
+
if include_taxon_functions:
|
|
237
|
+
lineage = assignments.get(contig, {}).get("lineage", empty_lineage())
|
|
238
|
+
for rank in LINEAGE_RANKS:
|
|
239
|
+
taxon = _lineage_taxon(lineage, rank)
|
|
240
|
+
if taxon != UNKNOWN:
|
|
241
|
+
lineage_value = lineage_string(lineage)
|
|
242
|
+
taxon_function[(rank, taxon, lineage_value, f"{category}\t{feature}")][0] += 1
|
|
243
|
+
taxon_function[(rank, taxon, lineage_value, f"{category}\t{feature}")][1] += support
|
|
243
244
|
tax = assignments.get(contig, {})
|
|
244
245
|
gene_count += 1
|
|
245
246
|
gene_lineage = tax.get("lineage", empty_lineage())
|
|
@@ -284,7 +285,8 @@ def _contig_row(sample_name: str, base: dict[str, Any], tax: dict[str, Any] | No
|
|
|
284
285
|
return out
|
|
285
286
|
|
|
286
287
|
|
|
287
|
-
def _input_signature(samples: list[SamplePaths], min_contig_length: int
|
|
288
|
+
def _input_signature(samples: list[SamplePaths], min_contig_length: int,
|
|
289
|
+
include_taxon_function_abundance: bool) -> dict[str, Any]:
|
|
288
290
|
records = []
|
|
289
291
|
for sample in samples:
|
|
290
292
|
selected = [
|
|
@@ -296,13 +298,17 @@ def _input_signature(samples: list[SamplePaths], min_contig_length: int) -> dict
|
|
|
296
298
|
if path and path.is_file():
|
|
297
299
|
st = path.stat()
|
|
298
300
|
records.append({"sample": sample.name, "path": str(path), "size": st.st_size, "mtime_ns": st.st_mtime_ns})
|
|
299
|
-
parameters = {
|
|
301
|
+
parameters = {
|
|
302
|
+
"min_contig_length": int(min_contig_length),
|
|
303
|
+
"include_taxon_function_abundance": include_taxon_function_abundance,
|
|
304
|
+
}
|
|
300
305
|
payload = {"inputs": records, "parameters": parameters}
|
|
301
306
|
digest = hashlib.sha256(json.dumps(payload, sort_keys=True).encode()).hexdigest()
|
|
302
307
|
return {"version": __version__, "signature": digest, "parameters": parameters, "inputs": records}
|
|
303
308
|
|
|
304
309
|
|
|
305
|
-
def _valid_cached_outputs(output_root: Path, signature: dict[str, Any], force: bool,
|
|
310
|
+
def _valid_cached_outputs(output_root: Path, signature: dict[str, Any], force: bool,
|
|
311
|
+
samples: list[SamplePaths], include_taxon_function_abundance: bool) -> bool:
|
|
306
312
|
manifest = output_root / "metadata" / "input_signature.json"
|
|
307
313
|
required = [
|
|
308
314
|
output_root / "combined" / "all_contigs.tsv.gz",
|
|
@@ -311,10 +317,13 @@ def _valid_cached_outputs(output_root: Path, signature: dict[str, Any], force: b
|
|
|
311
317
|
output_root / "summary" / "sample_inventory.tsv",
|
|
312
318
|
output_root / "taxonomy" / "taxonomy_abundance.tsv",
|
|
313
319
|
output_root / "functional" / "functional_abundance.tsv",
|
|
314
|
-
output_root / "functional" / "taxon_function_abundance.tsv",
|
|
315
320
|
output_root / "summary" / "pipeline_warnings.tsv",
|
|
316
321
|
output_root / "metadata" / "run_manifest.json",
|
|
317
322
|
]
|
|
323
|
+
if include_taxon_function_abundance:
|
|
324
|
+
required.append(
|
|
325
|
+
output_root / "functional" / "taxon_function_abundance.tsv"
|
|
326
|
+
)
|
|
318
327
|
required.extend(output_root / "per_sample_contigs" / f"{sample.name}_Contigs.tsv.gz" for sample in samples)
|
|
319
328
|
for category in FEATURE_COLUMNS:
|
|
320
329
|
required.append(output_root / "functional" / "matrices" / f"{category}_gene_counts.tsv")
|
|
@@ -329,7 +338,7 @@ def _valid_cached_outputs(output_root: Path, signature: dict[str, Any], force: b
|
|
|
329
338
|
|
|
330
339
|
|
|
331
340
|
def run_analysis(root_dir: str | Path, prefixes: str, output_dir: str | Path | None = None,
|
|
332
|
-
min_contig_length: int = 2500, heal_flags: bool = True, force: bool = False) -> dict[str, Any]:
|
|
341
|
+
min_contig_length: int = 2500, heal_flags: bool = True, force: bool = False, include_taxon_function_abundance: bool = True) -> dict[str, Any]:
|
|
333
342
|
"""Build the integrated MetaPont result set; partial samples are included with warnings."""
|
|
334
343
|
root = Path(root_dir).expanduser().resolve()
|
|
335
344
|
output_root = Path(output_dir).expanduser().resolve() if output_dir else root / OUTPUT_DIRNAME
|
|
@@ -350,8 +359,8 @@ def run_analysis(root_dir: str | Path, prefixes: str, output_dir: str | Path | N
|
|
|
350
359
|
with (dirs["inventory"] / "flag_healing.log").open("a", encoding="utf-8") as handle:
|
|
351
360
|
handle.write("\n".join(healed_events) + "\n")
|
|
352
361
|
|
|
353
|
-
signature = _input_signature(samples, min_contig_length)
|
|
354
|
-
if _valid_cached_outputs(output_root, signature, force, samples):
|
|
362
|
+
signature = _input_signature(samples, min_contig_length, include_taxon_function_abundance)
|
|
363
|
+
if _valid_cached_outputs(output_root, signature, force, samples, include_taxon_function_abundance):
|
|
355
364
|
warnings_path = dirs["summary"] / "pipeline_warnings.tsv"
|
|
356
365
|
has_warnings = _nonempty(warnings_path) and sum(1 for _ in warnings_path.open(encoding="utf-8")) > 1
|
|
357
366
|
complete_flag = output_root / "MetaPont_analysis.success"
|
|
@@ -410,7 +419,8 @@ def run_analysis(root_dir: str | Path, prefixes: str, output_dir: str | Path | N
|
|
|
410
419
|
gene_support = parse_cds_summary(sample.cds_summary)
|
|
411
420
|
known_contigs = set(assignments)
|
|
412
421
|
annotation_map, gene_count, sample_functional, sample_taxon_functions = _annotation_maps(
|
|
413
|
-
sample, known_contigs, assignments, gene_support, gene_writer
|
|
422
|
+
sample, known_contigs, assignments, gene_support, gene_writer, include_taxon_functions=include_taxon_function_abundance,
|
|
423
|
+
|
|
414
424
|
)
|
|
415
425
|
for (category, feature), counts in sample_functional.items():
|
|
416
426
|
functional[(category, feature)][0] += counts[0]
|