Only output SNPs in bcftools
1
0
Entering edit mode
3.5 years ago

Hi, I have called SNPs using bcftools v1.8 using the following code

$ bcftools mpileup --threads 4 --output-type b -f reference.fa -o AS.merged.bcf AS.merged.bam
$ bcftools call --threads 4 -v -m -O z -o AS.variants.vcf.gz AS.merged.bcf

I got the following using rtg vcfstats

Location                     : AS.variants.vcf.gz
Failed Filters               : 0
Passed Filters               : 62280442
SNPs                         : 60581916
MNPs                         : 0
Insertions                   : 789867
Deletions                    : 908517
Indels                       : 142
Same as reference            : 0
SNP Transitions/Transversions: 1.74 (68137348/39175931)
Total Het/Hom ratio          : 0.31 (14805670/47474772)
SNP Het/Hom ratio            : 0.30 (13998666/46583250)
MNP Het/Hom ratio            : - (0/0)
Insertion Het/Hom ratio      : 0.91 (376478/413389)
Deletion Het/Hom ratio       : 0.90 (430384/478133)
Indel Het/Hom ratio          : - (142/0)
Insertion/Deletion ratio     : 0.87 (789867/908517)
Indel/SNP+MNP ratio          : 0.03 (1698526/60581916)

Now I'm trying to get a file with only the SNPs. I've tried both of the following:

$ bcftools call -t 4 -v -m -V indels -O z -o filtered.SNPs.vcf.gz AS.merged.bcf 
$ bcftools view -t 4 -V indels -O z -o filtered.SNPs.vcf.gz AS.merged.bcf

but both only output a file with a header and no variants at all

...
##bcftools_callCommand=call -t 4 -v -m -V indels -O z -o filtered.SNPs.vcf.gz AS.merged.bcf; Date=Sat May 22 18:32:35 2021                                  
#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  AS.merged.bam

I'm not sure what has gone wrong here. Do I have to run the mpileup again with the --skip-variants indels flag?

bcftools SNPs • 1.4k views
ADD COMMENT
1
Entering edit mode
3.5 years ago
4galaxy77 2.9k

If you only want SNPs then why not just bcftools view -v snps?

ADD COMMENT
0
Entering edit mode

because I'm a fool. Thanks...that worked.

ADD REPLY

Login before adding your answer.

Traffic: 1838 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6