English | 中文
Subset GFF3 and GTF annotation files by region, feature ID, attribute, or gene model. Pick longest isoforms, switch formats, write summaries.
git clone https://github.com/WWz33/gffsub.git
cd gffsub && make -jMinimal GFF3:
printf '%s\n' '##gff-version 3' \
$'chr1\t.\tgene\t1\t100\t.\t+\t.\tID=GeneA;Name=GeneA' \
$'chr1\t.\tmRNA\t1\t100\t.\t+\t.\tID=mRNA1;Parent=GeneA' \
$'chr1\t.\texon\t1\t100\t.\t+\t.\tID=exon1;Parent=mRNA1' > data/smoke.gff3
./gffsub data/smoke.gff3 -r chr1:1-100 -t gene
./gffsub data/smoke.gff3 -i GeneA -Cgffsub <input.gff3> [options]
gffsub query|window <input.gff3> [options]
See ./gffsub -h for the full flag list.
| Flag | Default | Description |
|---|---|---|
-r, --region |
— | 1-based inclusive CHR:START-END |
-b, --bed |
— | BED intervals (0-based half-open) |
-i, --id / --ids |
— | exact feature ID(s) |
-n, --name |
— | gene by common naming keys |
-w, --where KEY=VALUE |
— | exact column-9 attribute |
-C, --children |
off | include descendants of selector hits |
-p, --parents |
off | include ancestors |
-m, --model |
off | full gene model |
-N, --nearest REGION |
— | nearest gene on same seqid |
-u, --up / -D, --down |
0 | window (bp) around -i |
-a, --strand-aware |
off | window follows feature strand |
-t, --type |
— | type column filter; comma list, ^LIST excludes; repeatable |
-L, --longest |
off | one transcript/gene: CDS length if any CDS, else exon |
--longest-type |
auto | isoform type for -L; auto-detects transcript class |
-@, --threads |
1 | threads for -L |
--format |
gff3 | gff3|gtf|gtf2|gtf3|bed |
-o, --output |
stdout | output file |
-s, --summary |
off | TSV stats by seqid × type (like seqkit stats) |
-S, --seqid |
— | keep seqids; ^LIST excludes |
| Kind | Notes |
|---|---|
| Annotation | GFF3/GTF-style feature records |
GFF/GTF / -r |
1-based inclusive |
| BED | 0-based half-open |
Full guides in docs/:
- Getting Started
- Region and BED Filtering
- Feature ID and Gene Name Lookup
- Gene Model Expansion
- Attribute Filtering
- Expression Filtering
- Longest Isoform Selection
- Window Subcommand
- Output Formats
- Summary Output
- GTF Input Handling
- Library API
MIT License