This is a test version of Biostars. For the public version, visit https://www.biostars.org.
mpileup format to vcf

I'm wondering if there's a simple way to convert directly from mpileup format to vcf without having to go through all the steps of creating a bam files to bcf to vcf etc. https://www.ebi.ac.uk/sites/ebi.ac.uk/files/content.ebi.ac.uk/materials/2014/140217_AgriOmics/dan_bolser_snp_calling.pdf

I just want the variable sites from the mpileup file in vcf format.

I tried this and didn't work (Generating Both Pileup And Vcf/Bcf Using Samtools Mpileup)

bcftools view -v -c file.mpileup > file.vcf

next-gen snp samtools

What's the problem ? Do you have an error ? How do you generated this vcf ? ....

Yes, I got an error, saying failed to open pathto/file.mpileup

1 answer

I think that you may need bcftools call. The typical way to call variants is to run bcftools mpileup and pipe the output into bcftools call

I tried this:

bcftools call -v -c file.mpileup > file.vcf

Note: none of --samples-file, --ploidy or --ploidy-file given, assuming all sites are diploid Failed to open file.mpileup: unknown file type

Can you pipe the pileup into bcftools call? In the description for call, it says:

About:   SNP/indel variant calling from VCF/BCF. To be used in conjunction with samtools mpileup.
         This command replaces the former "bcftools view" caller. Some of the original
         functionality has been temporarily lost in the process of transition to htslib,
         but will be added back on popular demand. The original calling model can be
         invoked with the -c option.

It worked with the pipe

bcftools mpileup -f genomic.fa file.bam | bcftools call -vm > file_var.vcf

Strange that it has to be piped, but glad that it worked.

Log in to answer this question.