<p>Vcftools allows you to filter to include or not include a list of sites.</p>
<p><a href="https://vcftools.github.io/man_latest.html#SITE%20FILTERING%20OPTIONS" rel="nofollow noreferrer">https://vcftools.github.io/man_latest.html#SITE%20FILTERING%20OPTIONS</a></p>
<p>If you can first grab the locations of indels of this size (for example you could write a python script  that goes through your vcf and grabs the location of anything with ref or alt of a length of at least 50 characters), then you can provide vcftools with a list of variants to filter on.</p>
<p>If you are not comfortable writing your own script to look through the file, you could delete the vcf header lines, change the file extension to tsv, then open it in excel. Then you could use excel to filter for those sites and get their positions.</p>

CC BY-SA 4.0
2024-03-27T17:47:57.917Z
2024-03-27T17:47:57.917Z
Sarah
<p>I have a filtered VCF file with indels (no SNPs). Does anyone know of a easy way to use bcftools/vcftools to filter out small or large indels (I'm interested in indels between 50-100bp in size)? Thanks!</p>

CC BY-SA 4.0
2024-03-25T20:09:04.657Z
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Community
CC BY-SA 4.0
2024-03-25T20:58:44.707Z
What is the output to `bcftools view -H <file.vcf> | head -n 5` where `<file.vcf>` is the actual VCF file?
Ram RS
<vcf><genome><bcftools><vcftools>
How can I filter variants in a VCF file based on size?
# How can I filter variants in a VCF file based on size?

(Asked by: username_0 on 2024-03-25)

I have a filtered VCF file with indels (no SNPs). Does anyone know of a easy way to use bcftools/vcftools to filter out small or large indels (I'm interested in indels between 50-100bp in size)? Thanks!

**Tags:** vcf, genome, bcftools, vcftools
> **Comments:**
> **username_1**: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.  
> **username_2**: What is the output to `bcftools view -H <file.vcf> | head -n 5` where `<file.vcf>` is the actual VCF file?  

---

## 1 answers

### Answer by username_3 on 2024-03-27. Score: 3

Vcftools allows you to filter to include or not include a list of sites.

<https://vcftools.github.io/man_latest.html#SITE%20FILTERING%20OPTIONS>

If you can first grab the locations of indels of this size (for example you could write a python script that goes through your vcf and grabs the location of anything with ref or alt of a length of at least 50 characters), then you can provide vcftools with a list of variants to filter on.

If you are not comfortable writing your own script to look through the file, you could delete the vcf header lines, change the file extension to tsv, then open it in excel. Then you could use excel to filter for those sites and get their positions.


---

