bcftools icon indicating copy to clipboard operation
bcftools copied to clipboard

bcftools view -R is excluding regions in bed file

Open AnnaMontaner opened this issue 2 years ago • 5 comments

Hi,

I am using bcftools view -R regions.bed input.vcf.gz to extract only those variants present in regions.bed. However, I get only those variants not present in regions.bed, so exactly the opposite. I really don't know what is going on... Any help?

Thanks!

Anna

AnnaMontaner avatar Jul 25 '23 13:07 AnnaMontaner

That sounds very odd indeed. This is such a basic functionality that most likely you are doing something wrong. I am unable to help without a small test case.

pd3 avatar Aug 15 '23 10:08 pd3

I noticed something similar. Some regions get lost, but when I use -R <(grep 'chr1' chr1.region.bed) or -R <(cat chr1.region.bed), the missed regions are considered.

I noticed the odd behavior when running bcftools mpileup.

Tried version 1.8 and 1.15.1. The behavior is similar.

robertzeibich avatar Aug 25 '23 08:08 robertzeibich

I want the opposite of -R, where all regions except those listed in file.txt are extracted.

What is the best option available in bcftools?

jaisonjseq avatar Aug 06 '24 19:08 jaisonjseq

This should work --targets-file ^file.txt, see the documentation here http://samtools.github.io/bcftools/bcftools.html

Please open a new issue next time, this is unrelated to the problem discussed here

pd3 avatar Aug 07 '24 17:08 pd3

Thank you for the swift response! Jaison Sequeira

Dept. of Applied Zoology Mangalore University

On Wed, 7 Aug, 2024, 23:05 Petr Danecek, @.***> wrote:

This should work --targets-file ^file.txt, see the documentation here http://samtools.github.io/bcftools/bcftools.html

Please open a new issue next time, this is unrelated to the problem discussed here

— Reply to this email directly, view it on GitHub https://github.com/samtools/bcftools/issues/1966#issuecomment-2273984382, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2H3GUDPHBJUWCFWHLBGPWDZQJLHLAVCNFSM6AAAAABMC6GOGWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZTHE4DIMZYGI . You are receiving this because you commented.Message ID: @.***>

jaisonjseq avatar Aug 08 '24 03:08 jaisonjseq