samtools / bcftools

This is the official development repository for BCFtools. See installation instructions and other documentation here http://samtools.github.io/bcftools/howtos/install.html
http://samtools.github.io/bcftools/
Other
679 stars 239 forks source link

bcftools view -R is excluding regions in bed file #1966

Open AnnaMontaner opened 1 year ago

AnnaMontaner commented 1 year ago

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

pd3 commented 1 year ago

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.

robertzeibich commented 1 year ago

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.

jaisonjseq commented 3 months ago

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?

pd3 commented 3 months ago

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

jaisonjseq commented 3 months ago

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: @.***>