Question: Samtools mpileup fasta index problem
0
gravatar for JW
3.9 years ago by
JW10
Munich, Germany
JW10 wrote:

Hi,

I have a directory of .fasta files and .fasta.fai files. I am trying to use those as a reference sequence to the samtools mpileup command for reads in a different directory (BAM-Format): 

for i in *
do
../../../../../../samtools-1.2/samtools mpileup ../Sorted_bam/Sorted_Aligned_$i.bam.bam -f $i -d 16847 -g -P flat > $i.bcf
done

But when I run it I get the error:

[mpileup] 1 samples in 1 input files
[fai_load] build FASTA index.
[fai_load] fail to open FASTA index.


​14 times (there are 14 files). What am I be doing wrong?

Thanks in advance.

samtools next-gen fasta • 3.6k views
ADD COMMENTlink modified 3.9 years ago by Jorge Amigo11k • written 3.9 years ago by JW10

To to run samtools faidx $i by itself and see if you get the same error.

ADD REPLYlink written 3.9 years ago by Devon Ryan90k
1
gravatar for Jorge Amigo
3.9 years ago by
Jorge Amigo11k
Santiago de Compostela, Spain
Jorge Amigo11k wrote:

if your directory has both .fasta and .fasta.fai files, the for loop needs to avoid the .fasta.fai ones:

for i in *.fasta
ADD COMMENTlink modified 3.9 years ago • written 3.9 years ago by Jorge Amigo11k

Yup it worked. Thanks!

ADD REPLYlink written 3.9 years ago by JW10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 503 users visited in the last hour