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!
1 Answer
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.
bcftools view -H <file.vcf> | head -n 5
where<file.vcf>
is the actual VCF file? $\endgroup$