samtools mpileup fail to create bcf

samtools mpileup fail to create bcf


I have indexed my reference.fasta using bowtie2:

bowtie2-build reference.fasta reference.fasta

created the bam file form the sam file using samtools, sorted and indexed the bam file:

samtools view -S -b Sample1_mapped.sam > Sample1_mapped.bam
samtools sort Sample1_mapped.bam -o Sample1_sorted > Sample1_sorted.bam
samtools index Sample1_sorted.bam

and now am trying to create the bcf from the bam file using the reference:

samtools mpileup -u Sample1_sorted.bam reference.fasta > Sample1.bcf

the error is

[bam_header_read] EOF marker is absent. The input is probably truncated.
[bam_header_read] invalid BAM binary header (this is not a BAM file).
[mpileup] fail to read the header of reference.fasta

list of files created:

enter image description here

where am I wrong?





Read more here: Source link