Question: bcftools view gives empty file when trying to subset it
0
gravatar for nikitavlassenko
5 weeks ago by
nikitavlassenko50 wrote:

I need to subset a vcf file, so I ran the following commands:

bgzip BATCH1.vcf
bcftools index BATCH1.vcf.gz
bcftools view BATCH1.vcf.gz -r 1:3494620,1:3826786 -o batch1_subset.vcf

And got an empty batch1_subset.vcf. I know well that there is 3494620 position at chr1, and there is 3826786, I verified that, but see no output generated. Why?

bcftools • 81 views
ADD COMMENTlink written 5 weeks ago by nikitavlassenko50
2
gravatar for Pierre Lindenbaum
5 weeks ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum127k wrote:

try with '1:3494620-3494620,1:3826786-3826786' or 'chr1:3494620-3494620,chr1:3826786-3826786' ?

ADD COMMENTlink written 5 weeks ago by Pierre Lindenbaum127k

Ok, this is the answer. Could you explain why it is like that? I would expect specifying only one region if I need only one region. I will accept the answer if you post.

ADD REPLYlink written 5 weeks ago by nikitavlassenko50

Could you explain why it is like that?

that's the only syntax. https://github.com/samtools/htslib/blob/ba95c897358c9896a993ebc3336e680d15c96082/synced_bcf_reader.c#L895

ADD REPLYlink written 5 weeks ago by Pierre Lindenbaum127k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1248 users visited in the last hour