This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BCFtools: filtering variants by position

Hello,

I'm trying to remove variants that are within 1000 bp of contig ends from by bcf file using BCFtools. I know how to remove those from the beggining:

bcftools filter -i 'POS>1000' my.bcf -o my_filtered.bcf

...but not ends. I thought about adding a column of contig lengths to my vcf when calling with BCFtools mpileup/call, and doing something like:

bcftools filter -i 'POS>1000 && POS<END-1000' my.bcf -o my_filtered.bcf

but I'm unable to produce the 'END' field. I'd appreciate any help.

bcftools snps

1 answer

bcftools view --regions-file keep-intervals.bed -O b -o my_filtered.bcf  my.bcf

Log in to answer this question.