gff-sort
Quick Start
- Command:
PATH=/home/vimalinx/miniforge3/envs/bio/bin:$PATH /home/vimalinx/miniforge3/envs/bio/bin/gff-sort < input.gff3 > sorted.gff3 - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/gff-sort - Full reference: See references/help.md for complete usage details
When To Use This Tool
- Sort unsorted GFF3 feature streams while keeping
gene/pseudogenebefore transcripts, thenCDS, thenexon/intron. - Clean up record order after concatenating annotations or generating GFF programmatically.
- Use inside EDirect pipelines when you already have companion helpers such as
tbl2xml,xtract,transmute, andsort-table.
Common Patterns
# 1) Sort an unsorted GFF3 body in EDirect's expected feature order
PATH=/home/vimalinx/miniforge3/envs/bio/bin:$PATH \
/home/vimalinx/miniforge3/envs/bio/bin/gff-sort \
< unsorted.gff3 \
> sorted.gff3
# 2) Re-sort merged annotation fragments before downstream use
cat part1.gff3 part2.gff3 part3.gff3 | \
PATH=/home/vimalinx/miniforge3/envs/bio/bin:$PATH \
/home/vimalinx/miniforge3/envs/bio/bin/gff-sort \
> merged.sorted.gff3
Recommended Workflow
- Put the EDirect bin directory on
PATH; this wrapper depends on sibling tools and cannot run standalone by absolute path alone. - Feed it a valid tab-delimited GFF3 stream on stdin.
- Spot-check that parent-child ordering is now
gene-> transcript/RNA ->CDS->exon/intron. - Reattach header or directive lines separately if downstream tools require them.
Guardrails
- This script has no real built-in help or version mode; with missing companion tools it can still exit after printing
command not founderrors. - It strips comment and directive lines such as
##gff-version 3, so preserve headers separately if you need them later. - Feature precedence is hard-coded:
gene/pseudogenefirst, RNA-like features second,CDSthird,exon/intronfourth, everything else last. - Sorting relies on sibling EDirect tools (
tbl2xml,xtract,transmute,sort-table) being discoverable onPATH.