prokapeak 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.
- prokapeak-0.1.0/LICENSE +21 -0
- prokapeak-0.1.0/MANIFEST.in +5 -0
- prokapeak-0.1.0/PKG-INFO +266 -0
- prokapeak-0.1.0/README.md +245 -0
- prokapeak-0.1.0/assign_targets.py +251 -0
- prokapeak-0.1.0/example/expected/TFA_assigned_peaks.bed +9 -0
- prokapeak-0.1.0/example/expected/TFB_assigned_peaks.bed +16 -0
- prokapeak-0.1.0/example/expected/TFC_assigned_peaks.bed +11 -0
- prokapeak-0.1.0/example/expected/TFD_assigned_peaks.bed +3 -0
- prokapeak-0.1.0/example/expected/predicted_operon_pairs.tsv +99 -0
- prokapeak-0.1.0/example/expected/predicted_operons.tsv +25 -0
- prokapeak-0.1.0/example/genome.gff +197 -0
- prokapeak-0.1.0/example/operons.tsv +45 -0
- prokapeak-0.1.0/example/peaks/TFA.narrowPeak +15 -0
- prokapeak-0.1.0/example/peaks/TFB.narrowPeak +12 -0
- prokapeak-0.1.0/example/peaks/TFC.narrowPeak +10 -0
- prokapeak-0.1.0/example/peaks/TFD.narrowPeak +8 -0
- prokapeak-0.1.0/example/tss.bed +28 -0
- prokapeak-0.1.0/predict_operons.py +123 -0
- prokapeak-0.1.0/prokapeak.egg-info/PKG-INFO +266 -0
- prokapeak-0.1.0/prokapeak.egg-info/SOURCES.txt +31 -0
- prokapeak-0.1.0/prokapeak.egg-info/dependency_links.txt +1 -0
- prokapeak-0.1.0/prokapeak.egg-info/entry_points.txt +3 -0
- prokapeak-0.1.0/prokapeak.egg-info/requires.txt +5 -0
- prokapeak-0.1.0/prokapeak.egg-info/top_level.txt +2 -0
- prokapeak-0.1.0/pyproject.toml +39 -0
- prokapeak-0.1.0/setup.cfg +4 -0
- prokapeak-0.1.0/tests/data/uniop_example/uniop.genes +97 -0
- prokapeak-0.1.0/tests/data/uniop_example/uniop.operon +24 -0
- prokapeak-0.1.0/tests/data/uniop_example/uniop.pred +97 -0
- prokapeak-0.1.0/tests/test_assign_targets.py +81 -0
- prokapeak-0.1.0/tests/test_predict_operons.py +112 -0
- prokapeak-0.1.0/tests/uniop_fixtures.sh +8 -0
prokapeak-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Trouillon lab
|
|
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.
|
prokapeak-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: prokapeak
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: ProkaPeak: assign MACS3 peaks to target genes through TSS and gene-start windows
|
|
5
|
+
Author: Alexandre Dentler, Julian Trouillon
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/trouillon-lab/prokapeak
|
|
8
|
+
Keywords: ChIP-seq,DAP-seq,MACS3,transcription factor,operon,bacteria
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: numpy>=1.21
|
|
17
|
+
Requires-Dist: pandas>=1.4
|
|
18
|
+
Provides-Extra: test
|
|
19
|
+
Requires-Dist: pytest; extra == "test"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
<img align="left" width="170" src="https://raw.githubusercontent.com/trouillon-lab/prokapeak/v0.1.0/images/ProkaPeak_logo.png" />
|
|
23
|
+
|
|
24
|
+
### A Python package to assign **Proka**ryotic **Peak**s to target genes.
|
|
25
|
+
#### ➡️ [_ProkaPeak web app_](https://prokapeak.trouillonlab.org/)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<br clear="left"/>
|
|
30
|
+
|
|
31
|
+
# ProkaPeak
|
|
32
|
+
|
|
33
|
+
ProkaPeak assigns transcription factor (TF) binding peaks from ChIP-seq, DAP-seq, or similar assays to the genes
|
|
34
|
+
they likely regulate. A peak is assigned to a gene when its summit lies in a window around that gene's start or
|
|
35
|
+
transcription start site (TSS), depending on available annotation.
|
|
36
|
+
|
|
37
|
+
ProkaPeak can run with only a peak list and gene annotation, but also supports
|
|
38
|
+
both TSS and operon information for more precise predictions. If no operon information is provided, ProkaPeak can predict operons first.
|
|
39
|
+
ProkaPeak uses default window sizes and peak assignment rules chosen to maximize target gene recovery, as defined based on experimental
|
|
40
|
+
binding sites. All parameters are optionally modifiable.
|
|
41
|
+
|
|
42
|
+
### Web app
|
|
43
|
+
In addition to the Python package, we provide the [ProkaPeak web app](https://prokapeak.trouillonlab.org/), which allows for flexible peak assignment with visualisation of summary metrics. The web app allows to assign multiple peak files simultaneously, provides pre-made TSS and operon maps for selected bacterial species, and runs entirely locally in the user's browser without the need of data upload.
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install prokapeak
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Python ≥ 3.9; installs numpy ≥ 1.21, pandas ≥ 1.4 and the commands `prokapeak` and `prokapeak-operons`. The
|
|
52
|
+
development version installs with `pip install git+https://github.com/trouillon-lab/prokapeak`.
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
prokapeak --gff genome.gff --peaks peaks/*.narrowPeak --operons operons.tsv --tss tss.bed --out out/
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Without installing, `python assign_targets.py` in a clone takes the same options (`python predict_operons.py` for
|
|
61
|
+
`prokapeak-operons`). Only `--gff`, `--peaks` and `--out` are required. `--predict-operons` replaces `--operons`
|
|
62
|
+
with operons predicted from gene spacing (see Predicted operons). Each peak file is processed in turn and gives one
|
|
63
|
+
output file.
|
|
64
|
+
|
|
65
|
+
`assign_targets` can also be imported: `read_genome` and `read_peaks` read the input files, `build_units` and `assign`
|
|
66
|
+
take the resulting tables; `main()` is the command line.
|
|
67
|
+
|
|
68
|
+
## Example
|
|
69
|
+
|
|
70
|
+
`example/` in the [repository](https://github.com/trouillon-lab/prokapeak) holds an artificial genome to show the file
|
|
71
|
+
formats: 100 genes on two chromosomes (`chrom1`, `plasmid1`), 45 operons, 28 TSSs and peak files for four made-up
|
|
72
|
+
TFs. `example/expected/` is the output of
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
cd example
|
|
76
|
+
prokapeak --gff genome.gff --operons operons.tsv --tss tss.bed --peaks peaks/*.narrowPeak --out out
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
which should match `expected/` file for file. `expected/predicted_operons.tsv` and `predicted_operon_pairs.tsv` are
|
|
80
|
+
the operons predicted from the same genome by
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
prokapeak-operons --gff genome.gff --out expected/predicted_operons.tsv --pairs expected/predicted_operon_pairs.tsv
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
(25 operons instead of the 45 the example was built with: a genome of 100 genes is far too small for the method,
|
|
87
|
+
see Predicted operons).
|
|
88
|
+
|
|
89
|
+
## Input files
|
|
90
|
+
|
|
91
|
+
All coordinates refer to the same genome; the chromosome name (column 1, or the GFF seqid) must be written
|
|
92
|
+
identically in every file. Genomes with several chromosomes or plasmids are supported. Files are plain text, named
|
|
93
|
+
by format: `.gff` or `.gff3`, `.tsv`, `.bed`, `.narrowPeak`. Lines starting with `#` are skipped and extra columns are
|
|
94
|
+
ignored; a missing file or a file of the wrong shape (too few columns, header lines, non-integer coordinates, missing
|
|
95
|
+
summits) stops the run with a message naming it.
|
|
96
|
+
Rows that cannot be matched to the annotation (loci with rows on several chromosomes or strands, peaks on unknown
|
|
97
|
+
chromosomes, operon genes not in the GFF, operons with genes on several chromosomes or strands, linked
|
|
98
|
+
TSSs whose gene is not found) are counted in warnings on stderr.
|
|
99
|
+
|
|
100
|
+
### `--gff` genome annotation (required)
|
|
101
|
+
|
|
102
|
+
GFF3. Rows of the listed feature types are read (`--gff-feature`, default `gene,CDS`); a locus with several rows,
|
|
103
|
+
of one type or of several, spans all of them. Every row needs the attribute holding the gene identifier
|
|
104
|
+
(`--gff-attribute`, default `locus_tag`), which is used in all other files and in the output.
|
|
105
|
+
|
|
106
|
+
| column | used |
|
|
107
|
+
|---|---|
|
|
108
|
+
| 1 seqid | chromosome |
|
|
109
|
+
| 3 type | one of `--gff-feature` (default `gene,CDS`) |
|
|
110
|
+
| 4 start, 5 end | 1-based, inclusive |
|
|
111
|
+
| 7 strand | `+` or `-`; the start codon is `start` on `+` and `end` on `-` |
|
|
112
|
+
| 9 attributes | `<--gff-attribute>=...` |
|
|
113
|
+
|
|
114
|
+
### `--peaks` peak files (required, one or more)
|
|
115
|
+
|
|
116
|
+
One file per TF, either MACS3 narrowPeak (`.narrowPeak`, 10 tab-separated columns, no header) or a BED file of
|
|
117
|
+
summits (`.bed`, at least 3 columns, every row a 1-bp interval at the summit, as in MACS3 `NAME_summits.bed`). Both
|
|
118
|
+
give the same assignments; a summit BED has no signal, p- or q-value, so those output columns are `.` (see Output).
|
|
119
|
+
|
|
120
|
+
| column | content |
|
|
121
|
+
|---|---|
|
|
122
|
+
| 1 chrom | chromosome |
|
|
123
|
+
| 2 start | 0-based peak start |
|
|
124
|
+
| 3 end | peak end |
|
|
125
|
+
| 4 name | peak id (copied to the output) |
|
|
126
|
+
| 5 score | copied to the output |
|
|
127
|
+
| 6 strand | ignored |
|
|
128
|
+
| 7 signal | fold enrichment, copied to the output |
|
|
129
|
+
| 8 pValue, 9 qValue | −log10, copied to the output |
|
|
130
|
+
| 10 peak | summit offset from column 2 |
|
|
131
|
+
|
|
132
|
+
The summit is column 2 + column 10 (0-based), or column 3 of a summit BED. The TF name is the file name without
|
|
133
|
+
extension, so file names must be distinct. An empty peak file gives an output file with only the header line.
|
|
134
|
+
|
|
135
|
+
### `--operons` operon map (optional)
|
|
136
|
+
|
|
137
|
+
Tab-separated, no header, two columns: operon id, locus tags of its genes separated by commas. One row per operon;
|
|
138
|
+
rows with the same operon id are merged, so one gene per row works too. The order of the genes in the list does
|
|
139
|
+
not matter: the genes of an operon are ordered 5'→3' from their GFF coordinates. Genes not listed are single-gene
|
|
140
|
+
units. Listed genes that are not in the GFF, and operons whose genes lie on several chromosomes or strands, are
|
|
141
|
+
skipped with a warning.
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
op1 b0002,b0003,b0004
|
|
145
|
+
op2 b0005
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### `--tss` TSS map (optional)
|
|
149
|
+
|
|
150
|
+
BED6, tab-separated, no header, one row per TSS.
|
|
151
|
+
|
|
152
|
+
| column | content |
|
|
153
|
+
|---|---|
|
|
154
|
+
| 1 chrom | chromosome |
|
|
155
|
+
| 2 start, 3 end | the TSS as a 1-bp interval (0-based start; TSS position = end, 1-based) |
|
|
156
|
+
| 4 name | locus tag of the gene the TSS starts; `.` = not linked to a gene |
|
|
157
|
+
| 5 score | ignored |
|
|
158
|
+
| 6 strand | `+` or `-` |
|
|
159
|
+
|
|
160
|
+
A TSS is an anchor for the unit its gene starts: the operon or internal unit beginning with that gene, or the gene
|
|
161
|
+
itself. TSSs that are unlinked, or whose gene is not in the GFF or lies on another strand or chromosome, are skipped.
|
|
162
|
+
|
|
163
|
+
Example: `NC_000913.3 147 148 b0001 0 +`
|
|
164
|
+
|
|
165
|
+
## Assignment
|
|
166
|
+
|
|
167
|
+
**Units.** With `--operons`, every operon is a unit (operon start), and every gene of an operon other than the
|
|
168
|
+
first starts an internal unit: that gene and the genes downstream of it. Genes in no operon are single-gene
|
|
169
|
+
units. Without `--operons`, every gene is a unit.
|
|
170
|
+
|
|
171
|
+
**Windows** (bp, along the unit's strand, negative = upstream; summit position minus anchor position):
|
|
172
|
+
|
|
173
|
+
| unit | anchor | default | option |
|
|
174
|
+
|---|---|---|---|
|
|
175
|
+
| any unit with a linked TSS | the TSS | −200 to +100 | `--tss-window` |
|
|
176
|
+
| operon start or single gene without a TSS | start codon of the first gene | −400 to +25 | `--start-window` |
|
|
177
|
+
| internal start without a TSS | start codon of that gene | −250 to +50 | `--internal-window` |
|
|
178
|
+
|
|
179
|
+
Pass windows with `=`, as in `--tss-window=-150,100`, so the leading minus is not read as an option.
|
|
180
|
+
|
|
181
|
+
**Overlapping windows** (function `resolve` in the script).
|
|
182
|
+
1. A unit with several TSSs is assigned once, through the TSS nearest the summit.
|
|
183
|
+
2. Of several units on one strand, only the one with the nearest anchor is assigned (`--same-strand`).
|
|
184
|
+
3. A summit in windows on both strands (between divergent genes) is assigned only on the strand with the nearest
|
|
185
|
+
anchor (`--opp-strand`), compared over the units kept by rule 2.
|
|
186
|
+
Units or strands tied in distance are all kept.
|
|
187
|
+
4. An assigned unit assigns all its genes; a gene assigned through several units is listed once, through the
|
|
188
|
+
nearest anchor.
|
|
189
|
+
|
|
190
|
+
## Predicted operons
|
|
191
|
+
|
|
192
|
+
Without an operon map, operons can be predicted from gene spacing using the method from UniOP (Su, Zhang and
|
|
193
|
+
Söding, bioRxiv 2024, doi:10.1101/2024.11.11.623000). Pairs at or above the cutoff (default 0.5) are joined; operons
|
|
194
|
+
of two or more genes are kept, in the operon map format.
|
|
195
|
+
|
|
196
|
+
The simplest is to predict them as part of the run, with `--predict-operons` in place of `--operons`:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
prokapeak --gff genome.gff --peaks peaks/*.narrowPeak --predict-operons --out out/
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
`predicted_operons.tsv` and `predicted_operon_pairs.tsv` are written into `--out`; `--operon-cutoff` sets the cutoff.
|
|
203
|
+
|
|
204
|
+
Alternatively, `prokapeak-operons` predicts them on their own, to inspect them or pass them later to `--operons`:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
prokapeak-operons --gff genome.gff --out operons.tsv [--pairs pairs.tsv] [--cutoff 0.5]
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
`--gff-feature` and `--gff-attribute` work as in `prokapeak`. The pair table has one row per pair of consecutive genes:
|
|
211
|
+
|
|
212
|
+
| column | content |
|
|
213
|
+
|---|---|
|
|
214
|
+
| chrom | chromosome |
|
|
215
|
+
| a, b | locus tags, in genome order |
|
|
216
|
+
| gap | start of b − end of a + 1 |
|
|
217
|
+
| class | `same`, `convergent` or `divergent` |
|
|
218
|
+
| prob | probability that a and b are in one operon; empty for opposite-strand pairs |
|
|
219
|
+
|
|
220
|
+
The probabilities equal those of the UniOP script (`tests/`), except that pairs are formed within a chromosome
|
|
221
|
+
only, the prior is clipped to 0.01–0.99, and a genome without convergent or without divergent pairs uses the
|
|
222
|
+
other class alone. The method needs a genome-sized gene set: below about 1,000 same-strand pairs the gaps stop
|
|
223
|
+
separating the pairs and nearly all same-strand neighbours are joined.
|
|
224
|
+
|
|
225
|
+
## Options
|
|
226
|
+
|
|
227
|
+
| option | effect |
|
|
228
|
+
|---|---|
|
|
229
|
+
| `--gff-feature` | GFF feature types to read, comma-separated (default `gene,CDS`); a locus spans all its rows |
|
|
230
|
+
| `--gff-attribute` | GFF attribute holding the gene id (default `locus_tag`) |
|
|
231
|
+
| `--predict-operons` | operons predicted from gene spacing instead of `--operons` |
|
|
232
|
+
| `--operon-cutoff` | pair probability that joins two genes for `--predict-operons` (default 0.5) |
|
|
233
|
+
| `--no-gene-start` | no start-codon windows; units without a TSS are not assigned |
|
|
234
|
+
| `--no-internal` | operon starts only, no internal units |
|
|
235
|
+
| `--same-strand closest\|both\|farthest` | a summit in windows of several units on one strand: assign the unit with the nearest anchor (default), all of them, or the one with the farthest anchor |
|
|
236
|
+
| `--opp-strand closest\|both\|farthest` | a summit in windows on both strands: assign the strand with the nearest anchor (default), both strands, or only the other strand |
|
|
237
|
+
| `--tss-window`, `--start-window`, `--internal-window` | window `up,down` in bp |
|
|
238
|
+
|
|
239
|
+
## Output
|
|
240
|
+
|
|
241
|
+
One `<TF>_assigned_peaks.bed` per peak file in `--out`: tab-separated, a `#` header line naming the columns, then
|
|
242
|
+
one row per peak and assigned gene, sorted by position. A peak assigned to an operon of four genes gives four rows;
|
|
243
|
+
a peak in no window is not listed. With `--predict-operons`, `--out` also holds `predicted_operons.tsv` and
|
|
244
|
+
`predicted_operon_pairs.tsv` (see Predicted operons).
|
|
245
|
+
|
|
246
|
+
| column | content |
|
|
247
|
+
|---|---|
|
|
248
|
+
| 1 chrom | chromosome of the peak |
|
|
249
|
+
| 2 start, 3 end | summit as a 1-bp interval (0-based start) |
|
|
250
|
+
| 4 target | locus tag of the assigned gene |
|
|
251
|
+
| 5 peak_score | column 5 of the peak file; `.` for a 3-column summit BED |
|
|
252
|
+
| 6 strand | strand of the target gene |
|
|
253
|
+
| 7 signal, 8 pscore, 9 qscore | narrowPeak columns 7–9; `.` for a summit BED |
|
|
254
|
+
| 10 target_chrom | chromosome of the target gene |
|
|
255
|
+
| 11 target_start, 12 target_end | target gene coordinates (0-based start) |
|
|
256
|
+
| 13 peak_id | column 4 of the peak file; `.` for a 3-column summit BED |
|
|
257
|
+
| 14 operon | operon id, `.` for a gene in no operon |
|
|
258
|
+
| 15 anchor | `TSS` or `start_codon` |
|
|
259
|
+
| 16 distance_to_anchor | summit minus anchor, along the target's strand (negative = upstream) |
|
|
260
|
+
|
|
261
|
+
`prokapeak` prints one line per TF: peaks assigned and number of target genes.
|
|
262
|
+
|
|
263
|
+
## License
|
|
264
|
+
|
|
265
|
+
ProkaPeak is released under the [MIT License](https://github.com/trouillon-lab/prokapeak/blob/main/LICENSE),
|
|
266
|
+
copyright (c) 2026 Trouillon lab.
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
<img align="left" width="170" src="https://raw.githubusercontent.com/trouillon-lab/prokapeak/v0.1.0/images/ProkaPeak_logo.png" />
|
|
2
|
+
|
|
3
|
+
### A Python package to assign **Proka**ryotic **Peak**s to target genes.
|
|
4
|
+
#### ➡️ [_ProkaPeak web app_](https://prokapeak.trouillonlab.org/)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
<br clear="left"/>
|
|
9
|
+
|
|
10
|
+
# ProkaPeak
|
|
11
|
+
|
|
12
|
+
ProkaPeak assigns transcription factor (TF) binding peaks from ChIP-seq, DAP-seq, or similar assays to the genes
|
|
13
|
+
they likely regulate. A peak is assigned to a gene when its summit lies in a window around that gene's start or
|
|
14
|
+
transcription start site (TSS), depending on available annotation.
|
|
15
|
+
|
|
16
|
+
ProkaPeak can run with only a peak list and gene annotation, but also supports
|
|
17
|
+
both TSS and operon information for more precise predictions. If no operon information is provided, ProkaPeak can predict operons first.
|
|
18
|
+
ProkaPeak uses default window sizes and peak assignment rules chosen to maximize target gene recovery, as defined based on experimental
|
|
19
|
+
binding sites. All parameters are optionally modifiable.
|
|
20
|
+
|
|
21
|
+
### Web app
|
|
22
|
+
In addition to the Python package, we provide the [ProkaPeak web app](https://prokapeak.trouillonlab.org/), which allows for flexible peak assignment with visualisation of summary metrics. The web app allows to assign multiple peak files simultaneously, provides pre-made TSS and operon maps for selected bacterial species, and runs entirely locally in the user's browser without the need of data upload.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install prokapeak
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Python ≥ 3.9; installs numpy ≥ 1.21, pandas ≥ 1.4 and the commands `prokapeak` and `prokapeak-operons`. The
|
|
31
|
+
development version installs with `pip install git+https://github.com/trouillon-lab/prokapeak`.
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
prokapeak --gff genome.gff --peaks peaks/*.narrowPeak --operons operons.tsv --tss tss.bed --out out/
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Without installing, `python assign_targets.py` in a clone takes the same options (`python predict_operons.py` for
|
|
40
|
+
`prokapeak-operons`). Only `--gff`, `--peaks` and `--out` are required. `--predict-operons` replaces `--operons`
|
|
41
|
+
with operons predicted from gene spacing (see Predicted operons). Each peak file is processed in turn and gives one
|
|
42
|
+
output file.
|
|
43
|
+
|
|
44
|
+
`assign_targets` can also be imported: `read_genome` and `read_peaks` read the input files, `build_units` and `assign`
|
|
45
|
+
take the resulting tables; `main()` is the command line.
|
|
46
|
+
|
|
47
|
+
## Example
|
|
48
|
+
|
|
49
|
+
`example/` in the [repository](https://github.com/trouillon-lab/prokapeak) holds an artificial genome to show the file
|
|
50
|
+
formats: 100 genes on two chromosomes (`chrom1`, `plasmid1`), 45 operons, 28 TSSs and peak files for four made-up
|
|
51
|
+
TFs. `example/expected/` is the output of
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
cd example
|
|
55
|
+
prokapeak --gff genome.gff --operons operons.tsv --tss tss.bed --peaks peaks/*.narrowPeak --out out
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
which should match `expected/` file for file. `expected/predicted_operons.tsv` and `predicted_operon_pairs.tsv` are
|
|
59
|
+
the operons predicted from the same genome by
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
prokapeak-operons --gff genome.gff --out expected/predicted_operons.tsv --pairs expected/predicted_operon_pairs.tsv
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
(25 operons instead of the 45 the example was built with: a genome of 100 genes is far too small for the method,
|
|
66
|
+
see Predicted operons).
|
|
67
|
+
|
|
68
|
+
## Input files
|
|
69
|
+
|
|
70
|
+
All coordinates refer to the same genome; the chromosome name (column 1, or the GFF seqid) must be written
|
|
71
|
+
identically in every file. Genomes with several chromosomes or plasmids are supported. Files are plain text, named
|
|
72
|
+
by format: `.gff` or `.gff3`, `.tsv`, `.bed`, `.narrowPeak`. Lines starting with `#` are skipped and extra columns are
|
|
73
|
+
ignored; a missing file or a file of the wrong shape (too few columns, header lines, non-integer coordinates, missing
|
|
74
|
+
summits) stops the run with a message naming it.
|
|
75
|
+
Rows that cannot be matched to the annotation (loci with rows on several chromosomes or strands, peaks on unknown
|
|
76
|
+
chromosomes, operon genes not in the GFF, operons with genes on several chromosomes or strands, linked
|
|
77
|
+
TSSs whose gene is not found) are counted in warnings on stderr.
|
|
78
|
+
|
|
79
|
+
### `--gff` genome annotation (required)
|
|
80
|
+
|
|
81
|
+
GFF3. Rows of the listed feature types are read (`--gff-feature`, default `gene,CDS`); a locus with several rows,
|
|
82
|
+
of one type or of several, spans all of them. Every row needs the attribute holding the gene identifier
|
|
83
|
+
(`--gff-attribute`, default `locus_tag`), which is used in all other files and in the output.
|
|
84
|
+
|
|
85
|
+
| column | used |
|
|
86
|
+
|---|---|
|
|
87
|
+
| 1 seqid | chromosome |
|
|
88
|
+
| 3 type | one of `--gff-feature` (default `gene,CDS`) |
|
|
89
|
+
| 4 start, 5 end | 1-based, inclusive |
|
|
90
|
+
| 7 strand | `+` or `-`; the start codon is `start` on `+` and `end` on `-` |
|
|
91
|
+
| 9 attributes | `<--gff-attribute>=...` |
|
|
92
|
+
|
|
93
|
+
### `--peaks` peak files (required, one or more)
|
|
94
|
+
|
|
95
|
+
One file per TF, either MACS3 narrowPeak (`.narrowPeak`, 10 tab-separated columns, no header) or a BED file of
|
|
96
|
+
summits (`.bed`, at least 3 columns, every row a 1-bp interval at the summit, as in MACS3 `NAME_summits.bed`). Both
|
|
97
|
+
give the same assignments; a summit BED has no signal, p- or q-value, so those output columns are `.` (see Output).
|
|
98
|
+
|
|
99
|
+
| column | content |
|
|
100
|
+
|---|---|
|
|
101
|
+
| 1 chrom | chromosome |
|
|
102
|
+
| 2 start | 0-based peak start |
|
|
103
|
+
| 3 end | peak end |
|
|
104
|
+
| 4 name | peak id (copied to the output) |
|
|
105
|
+
| 5 score | copied to the output |
|
|
106
|
+
| 6 strand | ignored |
|
|
107
|
+
| 7 signal | fold enrichment, copied to the output |
|
|
108
|
+
| 8 pValue, 9 qValue | −log10, copied to the output |
|
|
109
|
+
| 10 peak | summit offset from column 2 |
|
|
110
|
+
|
|
111
|
+
The summit is column 2 + column 10 (0-based), or column 3 of a summit BED. The TF name is the file name without
|
|
112
|
+
extension, so file names must be distinct. An empty peak file gives an output file with only the header line.
|
|
113
|
+
|
|
114
|
+
### `--operons` operon map (optional)
|
|
115
|
+
|
|
116
|
+
Tab-separated, no header, two columns: operon id, locus tags of its genes separated by commas. One row per operon;
|
|
117
|
+
rows with the same operon id are merged, so one gene per row works too. The order of the genes in the list does
|
|
118
|
+
not matter: the genes of an operon are ordered 5'→3' from their GFF coordinates. Genes not listed are single-gene
|
|
119
|
+
units. Listed genes that are not in the GFF, and operons whose genes lie on several chromosomes or strands, are
|
|
120
|
+
skipped with a warning.
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
op1 b0002,b0003,b0004
|
|
124
|
+
op2 b0005
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### `--tss` TSS map (optional)
|
|
128
|
+
|
|
129
|
+
BED6, tab-separated, no header, one row per TSS.
|
|
130
|
+
|
|
131
|
+
| column | content |
|
|
132
|
+
|---|---|
|
|
133
|
+
| 1 chrom | chromosome |
|
|
134
|
+
| 2 start, 3 end | the TSS as a 1-bp interval (0-based start; TSS position = end, 1-based) |
|
|
135
|
+
| 4 name | locus tag of the gene the TSS starts; `.` = not linked to a gene |
|
|
136
|
+
| 5 score | ignored |
|
|
137
|
+
| 6 strand | `+` or `-` |
|
|
138
|
+
|
|
139
|
+
A TSS is an anchor for the unit its gene starts: the operon or internal unit beginning with that gene, or the gene
|
|
140
|
+
itself. TSSs that are unlinked, or whose gene is not in the GFF or lies on another strand or chromosome, are skipped.
|
|
141
|
+
|
|
142
|
+
Example: `NC_000913.3 147 148 b0001 0 +`
|
|
143
|
+
|
|
144
|
+
## Assignment
|
|
145
|
+
|
|
146
|
+
**Units.** With `--operons`, every operon is a unit (operon start), and every gene of an operon other than the
|
|
147
|
+
first starts an internal unit: that gene and the genes downstream of it. Genes in no operon are single-gene
|
|
148
|
+
units. Without `--operons`, every gene is a unit.
|
|
149
|
+
|
|
150
|
+
**Windows** (bp, along the unit's strand, negative = upstream; summit position minus anchor position):
|
|
151
|
+
|
|
152
|
+
| unit | anchor | default | option |
|
|
153
|
+
|---|---|---|---|
|
|
154
|
+
| any unit with a linked TSS | the TSS | −200 to +100 | `--tss-window` |
|
|
155
|
+
| operon start or single gene without a TSS | start codon of the first gene | −400 to +25 | `--start-window` |
|
|
156
|
+
| internal start without a TSS | start codon of that gene | −250 to +50 | `--internal-window` |
|
|
157
|
+
|
|
158
|
+
Pass windows with `=`, as in `--tss-window=-150,100`, so the leading minus is not read as an option.
|
|
159
|
+
|
|
160
|
+
**Overlapping windows** (function `resolve` in the script).
|
|
161
|
+
1. A unit with several TSSs is assigned once, through the TSS nearest the summit.
|
|
162
|
+
2. Of several units on one strand, only the one with the nearest anchor is assigned (`--same-strand`).
|
|
163
|
+
3. A summit in windows on both strands (between divergent genes) is assigned only on the strand with the nearest
|
|
164
|
+
anchor (`--opp-strand`), compared over the units kept by rule 2.
|
|
165
|
+
Units or strands tied in distance are all kept.
|
|
166
|
+
4. An assigned unit assigns all its genes; a gene assigned through several units is listed once, through the
|
|
167
|
+
nearest anchor.
|
|
168
|
+
|
|
169
|
+
## Predicted operons
|
|
170
|
+
|
|
171
|
+
Without an operon map, operons can be predicted from gene spacing using the method from UniOP (Su, Zhang and
|
|
172
|
+
Söding, bioRxiv 2024, doi:10.1101/2024.11.11.623000). Pairs at or above the cutoff (default 0.5) are joined; operons
|
|
173
|
+
of two or more genes are kept, in the operon map format.
|
|
174
|
+
|
|
175
|
+
The simplest is to predict them as part of the run, with `--predict-operons` in place of `--operons`:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
prokapeak --gff genome.gff --peaks peaks/*.narrowPeak --predict-operons --out out/
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
`predicted_operons.tsv` and `predicted_operon_pairs.tsv` are written into `--out`; `--operon-cutoff` sets the cutoff.
|
|
182
|
+
|
|
183
|
+
Alternatively, `prokapeak-operons` predicts them on their own, to inspect them or pass them later to `--operons`:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
prokapeak-operons --gff genome.gff --out operons.tsv [--pairs pairs.tsv] [--cutoff 0.5]
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
`--gff-feature` and `--gff-attribute` work as in `prokapeak`. The pair table has one row per pair of consecutive genes:
|
|
190
|
+
|
|
191
|
+
| column | content |
|
|
192
|
+
|---|---|
|
|
193
|
+
| chrom | chromosome |
|
|
194
|
+
| a, b | locus tags, in genome order |
|
|
195
|
+
| gap | start of b − end of a + 1 |
|
|
196
|
+
| class | `same`, `convergent` or `divergent` |
|
|
197
|
+
| prob | probability that a and b are in one operon; empty for opposite-strand pairs |
|
|
198
|
+
|
|
199
|
+
The probabilities equal those of the UniOP script (`tests/`), except that pairs are formed within a chromosome
|
|
200
|
+
only, the prior is clipped to 0.01–0.99, and a genome without convergent or without divergent pairs uses the
|
|
201
|
+
other class alone. The method needs a genome-sized gene set: below about 1,000 same-strand pairs the gaps stop
|
|
202
|
+
separating the pairs and nearly all same-strand neighbours are joined.
|
|
203
|
+
|
|
204
|
+
## Options
|
|
205
|
+
|
|
206
|
+
| option | effect |
|
|
207
|
+
|---|---|
|
|
208
|
+
| `--gff-feature` | GFF feature types to read, comma-separated (default `gene,CDS`); a locus spans all its rows |
|
|
209
|
+
| `--gff-attribute` | GFF attribute holding the gene id (default `locus_tag`) |
|
|
210
|
+
| `--predict-operons` | operons predicted from gene spacing instead of `--operons` |
|
|
211
|
+
| `--operon-cutoff` | pair probability that joins two genes for `--predict-operons` (default 0.5) |
|
|
212
|
+
| `--no-gene-start` | no start-codon windows; units without a TSS are not assigned |
|
|
213
|
+
| `--no-internal` | operon starts only, no internal units |
|
|
214
|
+
| `--same-strand closest\|both\|farthest` | a summit in windows of several units on one strand: assign the unit with the nearest anchor (default), all of them, or the one with the farthest anchor |
|
|
215
|
+
| `--opp-strand closest\|both\|farthest` | a summit in windows on both strands: assign the strand with the nearest anchor (default), both strands, or only the other strand |
|
|
216
|
+
| `--tss-window`, `--start-window`, `--internal-window` | window `up,down` in bp |
|
|
217
|
+
|
|
218
|
+
## Output
|
|
219
|
+
|
|
220
|
+
One `<TF>_assigned_peaks.bed` per peak file in `--out`: tab-separated, a `#` header line naming the columns, then
|
|
221
|
+
one row per peak and assigned gene, sorted by position. A peak assigned to an operon of four genes gives four rows;
|
|
222
|
+
a peak in no window is not listed. With `--predict-operons`, `--out` also holds `predicted_operons.tsv` and
|
|
223
|
+
`predicted_operon_pairs.tsv` (see Predicted operons).
|
|
224
|
+
|
|
225
|
+
| column | content |
|
|
226
|
+
|---|---|
|
|
227
|
+
| 1 chrom | chromosome of the peak |
|
|
228
|
+
| 2 start, 3 end | summit as a 1-bp interval (0-based start) |
|
|
229
|
+
| 4 target | locus tag of the assigned gene |
|
|
230
|
+
| 5 peak_score | column 5 of the peak file; `.` for a 3-column summit BED |
|
|
231
|
+
| 6 strand | strand of the target gene |
|
|
232
|
+
| 7 signal, 8 pscore, 9 qscore | narrowPeak columns 7–9; `.` for a summit BED |
|
|
233
|
+
| 10 target_chrom | chromosome of the target gene |
|
|
234
|
+
| 11 target_start, 12 target_end | target gene coordinates (0-based start) |
|
|
235
|
+
| 13 peak_id | column 4 of the peak file; `.` for a 3-column summit BED |
|
|
236
|
+
| 14 operon | operon id, `.` for a gene in no operon |
|
|
237
|
+
| 15 anchor | `TSS` or `start_codon` |
|
|
238
|
+
| 16 distance_to_anchor | summit minus anchor, along the target's strand (negative = upstream) |
|
|
239
|
+
|
|
240
|
+
`prokapeak` prints one line per TF: peaks assigned and number of target genes.
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
ProkaPeak is released under the [MIT License](https://github.com/trouillon-lab/prokapeak/blob/main/LICENSE),
|
|
245
|
+
copyright (c) 2026 Trouillon lab.
|