Skip to content

Adding tabix'd GFF3 support to NearestGene - #855

Open
jamie-m-a wants to merge 1 commit into
Ensembl:postreleasefix/116from
jamie-m-a:feature/NearestGene_gff_support
Open

Adding tabix'd GFF3 support to NearestGene#855
jamie-m-a wants to merge 1 commit into
Ensembl:postreleasefix/116from
jamie-m-a:feature/NearestGene_gff_support

Conversation

@jamie-m-a

Copy link
Copy Markdown
Contributor

Summary

This PR allows NearestGene to retrieve gene locations from a tabix-indexed GFF3 file, enabling offline use:
--plugin NearestGene,gff3=/path/to/genes.gff.gz

It also adds:

  • parent_only=1 to use gene-parent feature types supported by VEP’s GFF transcript construction, excluding artifact and readthrough-only genes
  • regulatory=0 to avoid automatically enabling regulatory annotation
  • Distance and forward-strand direction when using both_directions=1

Existing database-backed behaviour is unchanged.

Can test it by...

Using the release 116 GRCh38 GFF and FASTA, create an input VCF:

printf '%s\n' \
  '##fileformat=VCFv4.2' \
  '#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO' \
  '1	157422	.	G	C	.	.	.' > test.vcf

Check the plugin compiles:
perl -c NearestGene.pm

Run VEP:

vep \
  -i test.vcf --vcf --offline \
  --fasta Homo_sapiens.GRCh38.dna.toplevel.fa.gz \
  --gff Homo_sapiens.GRCh38.116.chr.gff.gz \
  --plugin NearestGene,gff3=Homo_sapiens.GRCh38.116.chr.gff.gz,regulatory=0,both_directions=1,parent_only=1 \
  --force_overwrite -o test.out.vcf

The NearestGene result should contain:
ENSG00000269981:19457:upstream&ENSG00000279928:25274:downstream

The distances correspond to the GFF coordinates:
ENSG00000269981 ends at 137965
157422 - 137965 = 19457

ENSG00000279928 starts at 182696
182696 - 157422 = 25274

Note that running the same variant using the database will not fetch nearest genes (the plugin only works for intergenic variants), and these are annotated as downstream/upstream in the DB as they around/in the transcripts of a lnRNA. This is a limitation of the transcript model building of GFF3 input, it has fallen out of sync and will be updated in future to account for more gene biotypes.

@likhitha-surapaneni
likhitha-surapaneni self-requested a review August 13, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant