Skip to main content

Region-aware GFF annotation integration toolkit

Project description

gffkit

gffkit is a lightweight toolkit for region-aware GFF/GTF annotation integration. It combines four utilities:

  1. detect-bridge: detect suspicious merged-gene artifacts caused by bridge transcripts.
  2. complement: complement/merge annotations, with optional region-swap mode.
  3. add-utr: reconstruct five_prime_UTR and three_prime_UTR features from exon/CDS coordinates.
  4. rename-sort: rename gene/transcript/child IDs with a prefix and sort the final GFF3.

Installation

pip install gffkit

Quick start

Full integration pipeline

gffkit integrate \
  --annotation-a EviAnn.gff3 \
  --annotation-b ANNEVO.gff3 \
  --outdir gffkit_out \
  --prefix sample \
  -t 8

Outputs:

  • gffkit_out/sample.suspicious.tsv
  • gffkit_out/sample.merged.gff3
  • gffkit_out/sample.final.withUTR.gff3.pre_rename.gff3
  • gffkit_out/sample.final.withUTR.gff3
  • gffkit_out/sample.final.withUTR.gff3.id_map.tsv

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.

Step-by-step usage

# 1. Detect suspicious merged genes in Annotation A
gffkit detect-bridge -i EviAnn.gff3 -o suspicious.tsv -t 8

# 2. Use A as the global reference, but switch to B in suspicious regions
gffkit complement \
  --ref EviAnn.gff3 \
  --add ANNEVO.gff3 \
  --swap_region_tsv suspicious.tsv \
  --swap_region_flank 100 \
  --output merged.gff3 \
  -t 8

# 3. Add UTR features
gffkit add-utr -i merged.gff3 -o final.annotation.withUTR.pre_rename.gff3

# 4. Rename IDs, drop unplaced seqids, and sort the final GFF3
gffkit rename-sort \
  -i final.annotation.withUTR.pre_rename.gff3 \
  -o final.annotation.withUTR.gff3 \
  --prefix sample

Merge three or more annotations

Use repeated --add arguments. Files are merged in the order provided.

gffkit complement \
  --ref EviAnn.gff3 \
  --add ANNEVO.gff3 \
  --add Helixer.gff3 \
  --add PASA.gff3 \
  --output merged.multi.gff3 \
  -t 8

Command overview

gffkit --help
gffkit detect-bridge --help
gffkit complement --help
gffkit add-utr --help
gffkit rename-sort --help
gffkit integrate --help

Threads

Version 0.3 and later add -t/--threads.

  • detect-bridge analyzes genes in parallel.
  • complement pre-parses multiple --add files in parallel, then merges them in the original command-line order.
  • integrate passes the thread count to the detect and complement steps.

Example:

gffkit integrate --annotation-a EviAnn.gff3 --annotation-b ANNEVO.gff3 -t 16

Annotation integration strategy

  • Annotation A, for example EviAnn/RNA-seq-supported GFF, is used as the global primary reference.
  • Annotation B, for example ANNEVO/deep-learning GFF, is used as the local primary reference only in suspicious merged-gene regions.
  • UTR features are reconstructed after merging using an exon-minus-CDS strategy.
  • 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.
  • When multiple tools annotate the same gene locus, the GFF source column is combined with |, for example EviAnn|ANNEVO.

Rename and Sort

Run this step independently when you already have a merged GFF3:

gffkit rename-sort \
  -i merged.withUTR.gff3 \
  -o sample.renamed.sorted.gff3 \
  --prefix sample \
  --digits 5 \
  --keep-old-ids

This writes sample.renamed.sorted.gff3 and sample.renamed.sorted.gff3.id_map.tsv.

Maintainer notes

When command-line options or behavior changes, update this README.md in the versioned package directory before building and uploading to PyPI.

License

MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gffkit-0.4.0.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gffkit-0.4.0-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

Details for the file gffkit-0.4.0.tar.gz.

File metadata

  • Download URL: gffkit-0.4.0.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.12

File hashes

Hashes for gffkit-0.4.0.tar.gz
Algorithm Hash digest
SHA256 3ca5969110c429396df123ea94f7b24327e189e8e40c600bde38a45db9a6cb7d
MD5 752c68ad14a989360f0eb56455211f1b
BLAKE2b-256 38fe2a0104c840a44ec6cf03c1e458e209477a0e1a69ddccc47256442f2aa92f

See more details on using hashes here.

File details

Details for the file gffkit-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: gffkit-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 33.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.12

File hashes

Hashes for gffkit-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dcd580a1a03989089f49f15b111e1ecab23186c3ab09e0ad28bb07653ce974b8
MD5 74ef03f70933379fcc9231b9bc36c71f
BLAKE2b-256 eb48ae800e12259a691ffa05132d48d38db24636148e0d5b92185a48608b0c39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page