I have a `VCF` file with `SNPs` and genes subset of `GFF` file (only genes are present). How to extract `SNPs` in `VCF` format located in genes from my data?
Use [bedtools][1]:

    $ bedtools intersect -a input.vcf -b genes.gff -header -wa > output.vcf

---
**EDIT:**

For (very) large `vcf` files it might be more efficient to `bgzip` and `tabix` index the `vcf` file, convert your `gff` to `bed` and use `tabix` to query the regions

**1. bgzip and index**

    $ bgzip -c input.vcf > input.vcf.gz
    $ tabix input.vcf.gz

**2. gff to bed**

E.g with [BEDOPS][2]:

    $ gff2bed < genes.gff > genes.bed

**3. Query the regions**

    $ tabix -R genes.bed -h input.vcf.gz > output.vcf


fin swimmer


  [1]: https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html?highlight=intersect
  [2]: https://bedops.readthedocs.io/en/latest/content/reference/file-management/conversion/gff2bed.html