This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error [E::fai_build_core] in samtool faidx version 1.9

Hello, people.

I'm trying to convert a .sam file to a .vcf file.

Before, I mapped my reads using HISAT2. As a result, I generated a .sam file. Next, using SAMtools I converted my files to .bam file and after in a sorted.bam file.

Now, I'm trying to convert to .vcf using BCFtools1.9.

Before, I indexed I ref genome using SAMtools1.9

samtools-1.9/samtools faidx TriTrypDB-43_LbraziliensisMHOMBR75M2904_Genome.fa

Next, I trying to convert using this command:

bcftools-1.9/bcftools mpileup -Ou -f TriTrypDB-43_LbraziliensisMHOMBR75M2904_Genome.fa.fai MP_SRR1185719.sorted.bam | bcftools-1.9/bcftools call -Ov -m> MP_SRR1185719.vcf

As result:

[E :: fai_build_core] Format error, unexpected "L" at line 1

I searched here in Biostar more about this error, and I've tried a lot of sugestions, but I only failed.

At fisrt time, I thought that my reference genome was corrupted but I downloaded it again and insisted on the same error.

What else I can try to resolve that?

samtools

1 answer

I believe the -f flag needs to be the fasta file, not the fai.

The format fa.fai meaning that the file was indexed. If I use only file.fa, my terminal got unnormal like this.

Try setting the -o option rather than redirecting to a file.

Log in to answer this question.