This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Mpileup Command Line

Hello,

I have a problem to use mpileup. I used this command:

samtools mpileup -f mi.fas sorted.bam > X.bcf &
bcftools view X.bcf > X.vcf &

it doesn't work "incorrect number of fields (0 != 5) at 0:0". I d like to optain vcf output from bam without using -u and -g in order to reach the result described in the manual http://samtools.sourceforge.net/samtools.shtml

If I try

samtools mpileup -f mi.fas sorted.bam > 2eccolo.bcf | bcftools view > 2eccolo.vcf&

It works but the results is an empty table...

P.S. using only the line below, it did not give me an output; I see only the results print on screen...

samtools mpileup -f mi.fas sorted.bam&
mpileup

1 answer

The command you're looking for is tee

samtools mpileup -f mi.fas sorted.bam  | tee X.bcf | bcftools view - > 2eccolo.vcf

or something like that.

Edit: I just realized that you're not outputting BCF in the first place, just mpileup, which is text! That won't ever work. You'll need to use the -g or -v or similar.

Unfortunately it doesn t work.. it gives me the same error incorrect number of fields (0 != 5) at 0:0 Anyway tee is a good idea! thanks!

Oh, I just noticed that you didn't use -g or -u or similar and updated my answer, since that won't work.

Log in to answer this question.