gffkit 0.6.0__tar.gz → 1.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.
- {gffkit-0.6.0 → gffkit-1.1.0}/MANIFEST.in +1 -0
- gffkit-1.1.0/PKG-INFO +488 -0
- gffkit-1.1.0/README.md +461 -0
- gffkit-1.1.0/docs/gffkit_auto_bridge_detection_design.md +362 -0
- gffkit-1.1.0/docs/gffkit_oversplit_repair_design.md +243 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/pyproject.toml +5 -2
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit/__init__.py +1 -1
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit/complement_annotations.py +175 -101
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit/detect_bridge_merged_genes.py +236 -52
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit/gffstat.py +92 -18
- gffkit-1.1.0/src/gffkit/isoseq_discovery.py +357 -0
- gffkit-1.1.0/src/gffkit/isoseq_options.py +126 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit/main.py +161 -12
- gffkit-1.1.0/src/gffkit/oversplit_chains.py +150 -0
- gffkit-1.1.0/src/gffkit/oversplit_reconstruction.py +529 -0
- gffkit-1.1.0/src/gffkit/oversplit_supported.py +235 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit/rename_sort_gff3.py +5 -0
- gffkit-1.1.0/src/gffkit/repair_oversplit_genes.py +612 -0
- gffkit-1.1.0/src/gffkit.egg-info/PKG-INFO +488 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit.egg-info/SOURCES.txt +15 -1
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit.egg-info/entry_points.txt +1 -0
- gffkit-1.1.0/src/gffkit.egg-info/requires.txt +4 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/tests/test_analysis_commands.py +44 -5
- gffkit-1.1.0/tests/test_complement_sources.py +155 -0
- gffkit-1.1.0/tests/test_detect_bridge_thresholds.py +73 -0
- gffkit-1.1.0/tests/test_isoseq_discovery.py +195 -0
- gffkit-1.1.0/tests/test_oversplit_chains.py +135 -0
- gffkit-1.1.0/tests/test_oversplit_reconstruction.py +335 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/tests/test_rename_sort.py +34 -0
- gffkit-1.1.0/tests/test_repair_oversplit.py +282 -0
- gffkit-0.6.0/PKG-INFO +0 -241
- gffkit-0.6.0/README.md +0 -216
- gffkit-0.6.0/src/gffkit.egg-info/PKG-INFO +0 -241
- gffkit-0.6.0/tests/test_complement_sources.py +0 -62
- {gffkit-0.6.0 → gffkit-1.1.0}/LICENSE +0 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/setup.cfg +0 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit/__main__.py +0 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit/add_utr.py +0 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit/get_longest_transcript.py +0 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit.egg-info/dependency_links.txt +0 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/src/gffkit.egg-info/top_level.txt +0 -0
- {gffkit-0.6.0 → gffkit-1.1.0}/tests/test_parallel_performance.py +0 -0
gffkit-1.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: gffkit
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: GFF annotation integration and analysis toolkit
|
|
5
|
+
Author: caijunhao
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/qunjie-zhang/gffkit
|
|
8
|
+
Project-URL: Repository, https://github.com/qunjie-zhang/gffkit
|
|
9
|
+
Project-URL: Issues, https://github.com/qunjie-zhang/gffkit/issues
|
|
10
|
+
Keywords: GFF3,GTF,genome annotation,bioinformatics,UTR,gene annotation
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Provides-Extra: isoseq
|
|
25
|
+
Requires-Dist: pysam>=0.22; extra == "isoseq"
|
|
26
|
+
Requires-Dist: biopython>=1.80; extra == "isoseq"
|
|
27
|
+
|
|
28
|
+
# gffkit
|
|
29
|
+
|
|
30
|
+
`gffkit` is a lightweight toolkit for GFF/GTF annotation integration and analysis.
|
|
31
|
+
Version 1.1.0 provides seven standalone utilities:
|
|
32
|
+
|
|
33
|
+
1. `detect-bridge`: detect suspicious merged-gene artifacts caused by bridge transcripts.
|
|
34
|
+
2. `complement`: complement/merge annotations, with optional region-swap mode.
|
|
35
|
+
3. `add-utr`: reconstruct `five_prime_UTR` and `three_prime_UTR` features from exon/CDS coordinates.
|
|
36
|
+
4. `rename-sort`: rename gene/transcript/child IDs with a prefix and sort the final GFF3.
|
|
37
|
+
5. `get_longest_transcript`: retain one longest transcript isoform per gene.
|
|
38
|
+
6. `stat`: calculate basic gene-annotation statistics for one GFF or a directory of GFF files.
|
|
39
|
+
7. `repair-oversplit`: evaluate adjacent or overlapping genes for Iso-Seq-supported reconstruction.
|
|
40
|
+
|
|
41
|
+
The `integrate` workflow uses the original four integration utilities by
|
|
42
|
+
default. With `--repair-over-split-genes`, a post-integration repair step runs
|
|
43
|
+
before UTR reconstruction and ID renaming. `get_longest_transcript` and `stat`
|
|
44
|
+
remain independent commands.
|
|
45
|
+
|
|
46
|
+
Design documentation:
|
|
47
|
+
|
|
48
|
+
- `docs/gffkit_auto_bridge_detection_design.md`
|
|
49
|
+
- `docs/gffkit_oversplit_repair_design.md`
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install "gffkit[isoseq]"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
### Full integration pipeline
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
gffkit integrate \
|
|
64
|
+
--annotation-a EviAnn.gff3 \
|
|
65
|
+
--annotation-b ANNEVO.gff3 \
|
|
66
|
+
--isoseq-bam isoseq_bams.txt \
|
|
67
|
+
--genome mapping_reference.fa \
|
|
68
|
+
--protein-fasta original_protein_evidence.fa \
|
|
69
|
+
--diamond /path/to/diamond \
|
|
70
|
+
--repair-over-split-genes \
|
|
71
|
+
--outdir gffkit_out \
|
|
72
|
+
--prefix sample \
|
|
73
|
+
-t 8
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Outputs:
|
|
77
|
+
|
|
78
|
+
- `gffkit_out/sample.suspicious.tsv`
|
|
79
|
+
- `gffkit_out/sample.merged.pre_oversplit.gff3`
|
|
80
|
+
- `gffkit_out/sample.oversplit_candidates.tsv`
|
|
81
|
+
- `gffkit_out/sample.oversplit_evidence.tsv`
|
|
82
|
+
- `gffkit_out/sample.merged.gff3`
|
|
83
|
+
- `gffkit_out/sample.final.withUTR.gff3.pre_rename.gff3`
|
|
84
|
+
- `gffkit_out/sample.final.withUTR.gff3`
|
|
85
|
+
- `gffkit_out/sample.final.withUTR.gff3.id_map.tsv`
|
|
86
|
+
|
|
87
|
+
In `integrate`, `--prefix sample` is also used for final ID renaming. Final gene IDs are written like `sample_C01g00001`, transcript IDs like `sample_C01g00001.t1`, and child IDs like `sample_C01g00001.t1.exon1`.
|
|
88
|
+
|
|
89
|
+
### Step-by-step usage
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# 1. Detect suspicious merged genes in Annotation A
|
|
93
|
+
gffkit detect-bridge -i EviAnn.gff3 -o suspicious.tsv -t 8
|
|
94
|
+
|
|
95
|
+
# 2. Use A globally and replace only suspicious A gene IDs with same-strand B models
|
|
96
|
+
gffkit complement \
|
|
97
|
+
--ref EviAnn.gff3 \
|
|
98
|
+
--add ANNEVO.gff3 \
|
|
99
|
+
--swap_region_tsv suspicious.tsv \
|
|
100
|
+
--swap_region_flank 100 \
|
|
101
|
+
--output merged.gff3 \
|
|
102
|
+
-t 8
|
|
103
|
+
|
|
104
|
+
# 3. Optionally repair adjacent or overlapping over-split genes after integration
|
|
105
|
+
gffkit repair-oversplit \
|
|
106
|
+
-i merged.gff3 \
|
|
107
|
+
--isoseq-bam isoseq_bams.txt \
|
|
108
|
+
--genome mapping_reference.fa \
|
|
109
|
+
--protein-fasta original_protein_evidence.fa \
|
|
110
|
+
--diamond /path/to/diamond \
|
|
111
|
+
--candidates oversplit_candidates.tsv \
|
|
112
|
+
--evidence oversplit_evidence.tsv \
|
|
113
|
+
-o merged.repaired.gff3 \
|
|
114
|
+
-t 8
|
|
115
|
+
|
|
116
|
+
# 4. Add UTR features
|
|
117
|
+
gffkit add-utr -i merged.repaired.gff3 -o final.annotation.withUTR.pre_rename.gff3
|
|
118
|
+
|
|
119
|
+
# 5. Rename IDs, drop unplaced seqids, and sort the final GFF3
|
|
120
|
+
gffkit rename-sort \
|
|
121
|
+
-i final.annotation.withUTR.pre_rename.gff3 \
|
|
122
|
+
-o final.annotation.withUTR.gff3 \
|
|
123
|
+
--prefix sample
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Adaptive bridge threshold scan
|
|
127
|
+
|
|
128
|
+
The default detector keeps the fixed `--min-gap 10000` behavior. To scan an
|
|
129
|
+
annotation-specific threshold range, use:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
gffkit detect-bridge \
|
|
133
|
+
-i EviAnn.gff3 \
|
|
134
|
+
-o suspicious.auto.tsv \
|
|
135
|
+
--threshold-mode auto
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Auto mode deduplicates introns by chromosome, strand, and coordinates, then
|
|
139
|
+
uses Q95 through `max(Q99.5, --min-gap)` as its search range. It evaluates only
|
|
140
|
+
thresholds where a transcript's bridge classification can change. Candidate
|
|
141
|
+
rows include the threshold ranges that support the call, the selected
|
|
142
|
+
representative threshold, and a threshold stability label. The adjacent
|
|
143
|
+
`suspicious.auto.tsv.meta.json` records the background size, quantile method,
|
|
144
|
+
and search range. With fewer than 1,000 unique introns, auto mode reports that
|
|
145
|
+
it fell back to the fixed threshold; this fallback is not considered stable.
|
|
146
|
+
|
|
147
|
+
A bridge must overlap actual exon blocks from at least two core transcript
|
|
148
|
+
clusters. Overlap with a cluster's broad genomic span alone is insufficient.
|
|
149
|
+
Missing exon/CDS structure is excluded from bridge evidence. `integrate
|
|
150
|
+
--threshold-mode auto` uses only `stable_candidate` rows for region swapping;
|
|
151
|
+
the standalone detector still reports sensitive candidates for review.
|
|
152
|
+
Threshold stability is a screening measure, not a calibrated probability.
|
|
153
|
+
|
|
154
|
+
### Optional Iso-Seq genome-wide discovery
|
|
155
|
+
|
|
156
|
+
Iso-Seq BAM input is supported on both `detect-bridge` and `integrate`.
|
|
157
|
+
Install the optional BAM dependency with `pip install
|
|
158
|
+
'.[isoseq]'`. Commands without BAM input do not require `pysam`.
|
|
159
|
+
|
|
160
|
+
Create a text file with one coordinate-sorted and indexed BAM path per tissue
|
|
161
|
+
or sample. Blank lines and lines beginning with `#` are ignored. Relative BAM
|
|
162
|
+
paths are resolved from the directory containing the text file.
|
|
163
|
+
|
|
164
|
+
```text
|
|
165
|
+
# B73_isoseq_bams.txt
|
|
166
|
+
/path/to/B73_ear.bam
|
|
167
|
+
/path/to/B73_embryo.bam
|
|
168
|
+
/path/to/B73_endosperm.bam
|
|
169
|
+
/path/to/B73_pollen.bam
|
|
170
|
+
/path/to/B73_root.bam
|
|
171
|
+
/path/to/B73_tassel.bam
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Pass the text file to `--isoseq-bam`:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
gffkit detect-bridge \
|
|
178
|
+
-i annotation.gff3 \
|
|
179
|
+
-o suspicious.tsv \
|
|
180
|
+
--isoseq-bam B73_isoseq_bams.txt
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Iso-Seq mode scans each BAM across the whole genome and collects anchored CIGAR
|
|
184
|
+
`N` junctions of at least `--min-gap`. It combines minimap2 `ts:A:+/-` with the
|
|
185
|
+
SAM reverse flag to determine genomic transcript strand. Secondary,
|
|
186
|
+
supplementary, duplicate-marked, QC-failed, low-MAPQ, and known multimapping
|
|
187
|
+
records are excluded.
|
|
188
|
+
|
|
189
|
+
A long junction becomes a BAM bridge candidate when the same sample contains
|
|
190
|
+
the required number of exact junction templates and independent non-bridge
|
|
191
|
+
templates on both flanks. BAM candidates are mapped to GFF genes where
|
|
192
|
+
possible, then unioned and deduplicated with GFF structural candidates:
|
|
193
|
+
|
|
194
|
+
```text
|
|
195
|
+
suspicious.tsv = GFF structural candidates ∪ Iso-Seq BAM candidates
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
GFF candidates remain in the output when Iso-Seq has no coverage. Iso-Seq can
|
|
199
|
+
also add candidates absent from the GFF structural screen. The genome-wide
|
|
200
|
+
report defaults to `OUTPUT.isoseq.tsv`; use `--isoseq-report` to choose another
|
|
201
|
+
path.
|
|
202
|
+
|
|
203
|
+
| Option | Default | Meaning |
|
|
204
|
+
| --- | --- | --- |
|
|
205
|
+
| `--isoseq-bam` | none | TXT file containing one coordinate-sorted, indexed BAM path per line. |
|
|
206
|
+
| `--isoseq-report` | `OUTPUT.isoseq.tsv` | Genome-wide long-junction evidence report. |
|
|
207
|
+
| `--isoseq-min-mapq` | `20` | Minimum mapping quality. |
|
|
208
|
+
| `--isoseq-min-anchor` | `10` | Minimum aligned bases on each side of a CIGAR `N`. |
|
|
209
|
+
| `--isoseq-min-junction-reads` | `1` | Exact long-junction templates required in one sample. |
|
|
210
|
+
| `--isoseq-min-flank-reads` | `2` | Non-bridge templates required on each flank in the same sample. |
|
|
211
|
+
| `--isoseq-min-samples` | `1` | Samples meeting both junction and flank thresholds. |
|
|
212
|
+
| `--isoseq-flank-window` | `100` | Bases inspected on each side of a junction. |
|
|
213
|
+
|
|
214
|
+
`integrate` accepts the same options and passes them to its detection step:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
gffkit integrate \
|
|
218
|
+
--annotation-a EviAnn.gff3 \
|
|
219
|
+
--annotation-b Helixer.gff3 \
|
|
220
|
+
--outdir gffkit_isoseq_out \
|
|
221
|
+
--prefix B73 \
|
|
222
|
+
--isoseq-bam B73_isoseq_bams.txt
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Iso-Seq evidence is a screening heuristic. A supported long intron may be a
|
|
226
|
+
normal isoform or readthrough transcript, so review `suspicious.tsv` before
|
|
227
|
+
automatic biological interpretation.
|
|
228
|
+
|
|
229
|
+
Transcript evidence fetches indexed exonic windows sequentially, opening each BAM once;
|
|
230
|
+
`-t` still controls the existing structural detection and complement workers.
|
|
231
|
+
Memory for template tracking scales with local coverage. In BAM mode the
|
|
232
|
+
candidate TSV and RNA report must be new paths; existing files are refused.
|
|
233
|
+
|
|
234
|
+
Implementation references: [pysam API](https://pysam.readthedocs.io/en/stable/api.html)
|
|
235
|
+
and [SAM format specification](https://samtools.github.io/hts-specs/SAMv1.pdf).
|
|
236
|
+
|
|
237
|
+
### Merge three or more annotations
|
|
238
|
+
|
|
239
|
+
Use repeated `--add` arguments. Files are merged in the order provided.
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
gffkit complement \
|
|
243
|
+
--ref EviAnn.gff3 \
|
|
244
|
+
--add ANNEVO.gff3 \
|
|
245
|
+
--add Helixer.gff3 \
|
|
246
|
+
--add PASA.gff3 \
|
|
247
|
+
--output merged.multi.gff3 \
|
|
248
|
+
-t 8
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Extract the longest transcript
|
|
252
|
+
|
|
253
|
+
For each gene, `get_longest_transcript` selects the isoform with the longest
|
|
254
|
+
concatenated CDS. If none of a gene's isoforms has CDS features, it uses the
|
|
255
|
+
longest concatenated exon length. Ties retain the first isoform encountered in
|
|
256
|
+
the input file.
|
|
257
|
+
|
|
258
|
+
Process one GFF/GFF3 file:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
gffkit get_longest_transcript \
|
|
262
|
+
-i annotation.gff3 \
|
|
263
|
+
-o longest_gff
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Process all `.gff`/`.gff3` files directly inside a directory:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
gffkit get_longest_transcript \
|
|
270
|
+
-f input_gff_directory \
|
|
271
|
+
-o longest_gff
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Compressed `.gff.gz` and `.gff3.gz` inputs are also supported by this command.
|
|
275
|
+
Output files are named `*.longest.gff` or `*.longest.gff3`. Existing output
|
|
276
|
+
files are refused unless `--force` is supplied.
|
|
277
|
+
|
|
278
|
+
### Calculate annotation statistics
|
|
279
|
+
|
|
280
|
+
Process one GFF/GFF3 file and write the default `gffstat.txt`:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
gffkit stat -i annotation.gff3
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Process all `.gff`/`.gff3` files directly inside a directory and select an
|
|
287
|
+
output path:
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
gffkit stat \
|
|
291
|
+
-f input_gff_directory \
|
|
292
|
+
-o annotation.gffstat.txt
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
The tab-separated output contains species/file name, gene count, average gene
|
|
296
|
+
span, average mature-transcript length, average CDS length per gene, average
|
|
297
|
+
exon count per gene, average exon length, and average UTR length per gene.
|
|
298
|
+
|
|
299
|
+
Version 0.9.0 first selects one transcript per gene using the largest sum of
|
|
300
|
+
that transcript's exon lengths. All transcript-derived values (mature
|
|
301
|
+
transcript, CDS, exon, and UTR statistics) are calculated only from those
|
|
302
|
+
selected transcripts. Their per-gene averages use only genes with at least one
|
|
303
|
+
recognized transcript feature; genes without a transcript still contribute to
|
|
304
|
+
gene count and average gene span, but not to transcript-derived denominators.
|
|
305
|
+
Average exon length is calculated across selected exons. Mature-transcript
|
|
306
|
+
length is the sum of exon lengths, not the genomic `mRNA` span. Gene length
|
|
307
|
+
remains the GFF gene span (`end - start + 1`). Transcripts with equal exon sums
|
|
308
|
+
are resolved by keeping the one that appears first in the input GFF.
|
|
309
|
+
|
|
310
|
+
## Command overview
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
gffkit --help
|
|
314
|
+
gffkit detect-bridge --help
|
|
315
|
+
gffkit complement --help
|
|
316
|
+
gffkit add-utr --help
|
|
317
|
+
gffkit rename-sort --help
|
|
318
|
+
gffkit get_longest_transcript --help
|
|
319
|
+
gffkit stat --help
|
|
320
|
+
gffkit integrate --help
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## Parallel Processing
|
|
324
|
+
|
|
325
|
+
Use `-t/--threads` to select the number of worker processes. The option name is
|
|
326
|
+
kept for command-line compatibility, but version 0.5.0 and later uses processes for
|
|
327
|
+
CPU-bound work so that Python's GIL does not restrict execution to one core.
|
|
328
|
+
|
|
329
|
+
- `detect-bridge` analyzes genes with a process pool and batches tasks to reduce process communication overhead.
|
|
330
|
+
- `complement` parses the reference and supplementary files in parallel, then merges them in the original command-line order.
|
|
331
|
+
- `complement` uses a dynamic chromosome interval index to compare each supplementary gene only with nearby overlapping reference genes.
|
|
332
|
+
- `integrate` passes the worker count to the detect and complement steps. `add-utr` and `rename-sort` remain single-process.
|
|
333
|
+
|
|
334
|
+
Example:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
gffkit integrate --annotation-a EviAnn.gff3 --annotation-b ANNEVO.gff3 -t 16
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
During `detect-bridge`, multiple worker processes should be visible in `top` or
|
|
341
|
+
`htop`. CPU usage naturally drops during the single-process UTR and rename/sort
|
|
342
|
+
steps. More workers also increase memory use; start with `-t 4` or `-t 8` for
|
|
343
|
+
large annotations.
|
|
344
|
+
|
|
345
|
+
## Annotation integration strategy
|
|
346
|
+
|
|
347
|
+
- Annotation A, for example EviAnn GFF, is used as the global primary reference.
|
|
348
|
+
- Annotation B, for example ANNEVO/deep-learning GFF, replaces only the suspicious Annotation A gene IDs on the same strand; neighboring genes are protected.
|
|
349
|
+
- `--repair-over-split-genes` defaults to `--reconstruction-mode supported`: repeated compatible partial Iso-Seq bridges can join original transcript segments, with explicit endpoint provenance and bounded terminal CDS inference. Complete ORFs, per-gene coding/homology support, canonical splices and translation roundtrip remain required. Use `--reconstruction-mode strict` for v3 full-CDS-read rules. `--min-protein-identity` defaults to 0.8 (supported) or 0.9 (strict); bidirectional protein coverage remains 0.9. See `docs/gffkit_oversplit_repair_design.md` for all thresholds and review outputs.
|
|
350
|
+
- UTR features are reconstructed after merging using an exon-minus-CDS strategy.
|
|
351
|
+
- Version 0.4.0 and later run `rename-sort` as the final `integrate` step. The final GFF3 keeps chromosome-mounted records, removes unplaced/scaffold/contig records, sorts features, rewrites `ID`/`Parent`, and writes an ID map next to the output.
|
|
352
|
+
- Version 0.5.0 replaces CPU-bound threads with worker processes and adds a dynamic interval index for faster annotation overlap searches.
|
|
353
|
+
- Version 0.6.0 adds the independent `get_longest_transcript` and `stat` commands. Neither command is included in `integrate`.
|
|
354
|
+
- When multiple tools annotate the same gene locus, the GFF source column is combined with `|`, for example `EviAnn|ANNEVO`.
|
|
355
|
+
|
|
356
|
+
## Rename and Sort
|
|
357
|
+
|
|
358
|
+
Run this step independently when you already have a merged GFF3:
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
gffkit rename-sort \
|
|
362
|
+
-i merged.withUTR.gff3 \
|
|
363
|
+
-o sample.renamed.sorted.gff3 \
|
|
364
|
+
--prefix sample \
|
|
365
|
+
--digits 5 \
|
|
366
|
+
--keep-old-ids
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
This writes `sample.renamed.sorted.gff3` and `sample.renamed.sorted.gff3.id_map.tsv`.
|
|
370
|
+
|
|
371
|
+
## Version 1.0.0 changes
|
|
372
|
+
|
|
373
|
+
- Added supported-mode partial-read / annotation-guided reconstruction; retained strict observed-chain mode and explicit report-only decisions.
|
|
374
|
+
- Added `integrate --repair-over-split-genes` after A/B integration and before UTR reconstruction and renaming.
|
|
375
|
+
- Required primary unique Iso-Seq splice alignments with configurable read, sample, anchor, mapping-quality, and gap thresholds.
|
|
376
|
+
- Merged Iso-Seq-supported adjacent genes directly without reusing an Annotation B/Helixer replacement model.
|
|
377
|
+
- Preserved each original transcript/exon/CDS subtree and changed only its top-level gene parent.
|
|
378
|
+
- Added pre-repair GFF, candidate summary, and read-level evidence outputs.
|
|
379
|
+
- Preserved precise same-strand, gene-ID-based replacement for suspicious merged-gene regions.
|
|
380
|
+
- Included the mature-transcript statistics updates introduced in 0.9.0.
|
|
381
|
+
- Updated the package version to 1.0.0.
|
|
382
|
+
|
|
383
|
+
## Version 0.9.0 changes
|
|
384
|
+
|
|
385
|
+
- Changed `gffkit stat` to select the transcript with the largest summed exon
|
|
386
|
+
length for each gene.
|
|
387
|
+
- Changed average transcript length from the genomic mRNA span to the summed
|
|
388
|
+
exon length of each selected mature transcript.
|
|
389
|
+
- Restricted CDS, exon-count, exon-length, and UTR statistics to the same
|
|
390
|
+
selected transcript so all transcript-derived columns use one consistent
|
|
391
|
+
per-gene model.
|
|
392
|
+
- Preserved the existing TSV column names and command-line interface for
|
|
393
|
+
compatibility.
|
|
394
|
+
- Updated the package version to 0.9.0.
|
|
395
|
+
|
|
396
|
+
## Version 0.8.0 changes
|
|
397
|
+
|
|
398
|
+
- Added genome-wide Iso-Seq BAM discovery to `detect-bridge` and `integrate`.
|
|
399
|
+
- Added `--isoseq-bam` and Iso-Seq-specific threshold/report options.
|
|
400
|
+
- Removed short-read RNA-seq BAM parameters, filtering, boundary classification, and implementation code.
|
|
401
|
+
- Combined minimap2 `ts` with SAM alignment orientation for genomic strand assignment.
|
|
402
|
+
- Unioned and deduplicated Iso-Seq BAM candidates with GFF structural candidates.
|
|
403
|
+
- Updated the package version to 0.8.0.
|
|
404
|
+
|
|
405
|
+
## Version 0.7.0 changes
|
|
406
|
+
|
|
407
|
+
- Added `detect-bridge --threshold-mode auto`, which deduplicates introns, derives a per-annotation search range, and scans only thresholds that can change bridge classification.
|
|
408
|
+
- Added candidate threshold ranges, selected threshold, stability classification, and a JSON metadata sidecar to auto-mode output; sparse backgrounds are marked as fixed-threshold fallback.
|
|
409
|
+
- Changed bridge confirmation to require overlap with actual core exon/CDS blocks instead of broad cluster spans; transcripts without usable exon/CDS structure cannot support a bridge call.
|
|
410
|
+
- Made `integrate --threshold-mode auto` use only stable candidates for region replacement and aligned RNA boundary reconstruction to the selected threshold.
|
|
411
|
+
- Preserved fixed-threshold mode as the default and retained its original TSV columns.
|
|
412
|
+
- Updated the package version to 0.7.0.
|
|
413
|
+
|
|
414
|
+
## Version 0.6.0 changes
|
|
415
|
+
|
|
416
|
+
- Added `gffkit get_longest_transcript` using the longest-CDS/longest-exon selection logic from `get_longest_transcript.py`.
|
|
417
|
+
- Added mutually exclusive `-i/--input` single-file and `-f/--folder` directory input modes for longest-transcript extraction.
|
|
418
|
+
- Added `gffkit stat` using the GFF statistics implementation from `gffstat.py`.
|
|
419
|
+
- Added mutually exclusive `-i/--input` single-file and `-f/--folder` directory input modes for annotation statistics.
|
|
420
|
+
- Kept both new commands independent from the four-step `gffkit integrate` workflow.
|
|
421
|
+
- Updated the package version from 0.5.0 to 0.6.0.
|
|
422
|
+
- Updated package author and credits to `caijunhao`.
|
|
423
|
+
|
|
424
|
+
## Maintainer notes
|
|
425
|
+
|
|
426
|
+
When command-line options or behavior changes, update this `README.md` in the versioned package directory before building and uploading to PyPI.
|
|
427
|
+
|
|
428
|
+
## License
|
|
429
|
+
|
|
430
|
+
MIT License.
|
|
431
|
+
|
|
432
|
+
## Credits
|
|
433
|
+
|
|
434
|
+
Author: caijunhao
|
|
435
|
+
|
|
436
|
+
### Reconstruct across multiple gene fragments with local Iso-Seq paths
|
|
437
|
+
|
|
438
|
+
Add `--chain-reconstruction --reconstruction-mode supported` to
|
|
439
|
+
`repair-oversplit` or `integrate`. Optional limits:
|
|
440
|
+
`--max-chain-span 100000 --max-intermediate-gap 25000 --max-genes-per-chain 5`.
|
|
441
|
+
Compatible overlapping local reads can reconstruct missing internal exons
|
|
442
|
+
without one read spanning the full transcript. Each corridor still requires
|
|
443
|
+
replicated read/RG support and coding/homology validation. Weak, ambiguous or
|
|
444
|
+
complex paths remain review-only. Intermediate genes are not silently removed.
|
|
445
|
+
See `docs/gffkit_oversplit_repair_design.md` for evidence and provenance details.
|
|
446
|
+
|
|
447
|
+
`--reconstruction-mode supported` selects the reconstruction and acceptance
|
|
448
|
+
rules; `--chain-reconstruction` additionally enables local path assembly across
|
|
449
|
+
three or more gene fragments. Chain reconstruction is opt-in and is supported
|
|
450
|
+
only in `supported` mode. Candidate CDS models are reconstructed and validated
|
|
451
|
+
at candidate loci; this is not a genome-wide rerun of gene prediction.
|
|
452
|
+
|
|
453
|
+
For automatic coding-model acceptance, provide `--genome` and
|
|
454
|
+
`--protein-fasta`. `--diamond` is optional: it searches the supplied protein
|
|
455
|
+
FASTA against candidate ORFs and requires both `--genome` and
|
|
456
|
+
`--protein-fasta`. If DIAMOND is omitted, gffkit checks proteins linked through
|
|
457
|
+
the input annotation's `EvidenceProteinID`; it does not search the full FASTA
|
|
458
|
+
library. Without a genome or usable protein evidence, gffkit keeps the original
|
|
459
|
+
genes and reports candidates rather than accepting a reconstructed coding
|
|
460
|
+
model. Install the optional dependencies with `pip install 'gffkit[isoseq]'`.
|
|
461
|
+
|
|
462
|
+
Example without the optional full-library DIAMOND search:
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
gffkit integrate \
|
|
466
|
+
--annotation-a EviAnn.gff3 \
|
|
467
|
+
--annotation-b Helixer.gff3 \
|
|
468
|
+
--outdir gffkit_out --prefix B73 \
|
|
469
|
+
--isoseq-bam B73_isoseq_bams.txt \
|
|
470
|
+
--genome B73_v5.chr.fasta \
|
|
471
|
+
--protein-fasta proteins.fa \
|
|
472
|
+
--repair-over-split-genes \
|
|
473
|
+
--chain-reconstruction \
|
|
474
|
+
--reconstruction-mode supported \
|
|
475
|
+
--threads 16
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
### Overlapping over-split candidates (2026-11-24)
|
|
479
|
+
|
|
480
|
+
Candidate discovery includes all overlapping gene pairs on the same chromosome and strand, including nested and non-adjacent models. Negative intergenic gaps are retained in reports. Separated pairs retain the adjacent-pair maximum-gap rule. Candidate inclusion does not imply automatic merging: chain span limits, Iso-Seq support and reconstruction/ORF validation still apply. Opposite-strand genes are not combined.
|
|
481
|
+
|
|
482
|
+
## Version 1.1.0 changes
|
|
483
|
+
|
|
484
|
+
- Same-strand overlapping gene pairs, including nested and non-adjacent overlaps, are included in Iso-Seq candidate discovery.
|
|
485
|
+
- Supported pair components are grouped as graph connected components so interleaved edges cannot split or duplicate a gene across candidates.
|
|
486
|
+
- Overlapping Iso-Seq paths retain their full observed exon chain after both gene models are anchored; corridor clipping is no longer allowed to discard paths when its cuts cross.
|
|
487
|
+
- Candidate pairs above the reconstruction span limit remain in evidence/diagnostic reports and supported candidates are explicitly marked report-only instead of being silently filtered out.
|
|
488
|
+
- Added tests for overlapping, nested, interleaved, path-clipping, and over-span cases.
|