This is a test version of Biostars. For the public version, visit https://www.biostars.org.
problem converting indexed fasta file to SAM format using bowtie2

Hi,

1)I downloaded asi_ref_ASM45574v1_chrMT.fa file from NCBI. 2)I created reads using wgsim using the following command: wgsim -N1000 -S1 asi_ref_ASM45574v1_chrMT.fa sim_reads.fq /dev/null

3)Then I created index file of the .fa file mentioned above by using the following command samtools faidx asi_ref_ASM45574v1_chrMT.fa

I got a asi_ref_ASM45574v1_chrMT.fa.fai

4)After this I tried to convert the .fai file to sam for further analysis but received an error. Here is the command bowtie2 -x asi_ref_ASM45574v1_chrMT.fa.fai -U sim_reads.fq -S sim_reads_aligned.sam

and here is the error: Could not locate a Bowtie index corresponding to basename "asi_ref_ASM45574v1_chrMT.fa.fai" Error: Encountered internal Bowtie 2 exception (#1) Command: /usr/bin/bowtie2-align-s --wrapper basic-0 -x asi_ref_ASM45574v1_chrMT.fa.fai -S sim_reads_aligned.sam -U sim_reads.fq (ERR): bowtie2-align exited with value 1

I am not understanding why the error.Where am I wrong?

fasta index sam bowtie2 snp

You need to index the fasta file using bowtie2-build:

bowtie2-build asi_ref_ASM45574v1_chrMT.fa asi_ref_ASM45574v1_chrMT

Then align using:

bowtie2 -x asi_ref_ASM45574v1_chrMT -U sim_reads.fq -S sim_reads_aligned.sam

Thanks.It works.But may I know why didn't samtols faidx not work?

1 answer

The two types of index are different.

Log in to answer this question.