This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Snp Calling With Bcftools Using Pileup File Format Instead Of Bcf

Usually when I do SNP calling, I do this:

samtools mpileup -g -f Ref.fa File.bam | bcftools view -cv -

where samtools outputs a bcf file and bcftools does the SNP calling.

.

I can also get a pileup file by running (no bcf output):

samtools mpileup -f Ref.fa File.bam

which is basically a list of nucleotide positions and their bases and errors.

Now I'm playing around with SNP calling and I'd like to call bcftools on a modified pileup file.

Is it possible to call bcftools with a pileup file and not a bcf file? Or do I need to use another SNP caller?

bcftools snp calling

1 answer

Convert the pileup file to VCF using sam2vcf.pl, which is located in samtools bin folder:

Usage: sam2vcf.pl [OPTIONS] < in.pileup > out.vcf
    Options:
       -h, -?, --help                  This help message.
       -i, --indels-only               Ignore SNPs.
       -r, --refseq <file.fa>          The reference sequence, required when indels are present.
       -R, --keep-ref                  Print reference alleles as well.
       -s, --snps-only                 Ignore indels.
       -t, --column-title <string>     The column title.

You can then convert this to BCF using bcftools.

Log in to answer this question.