BWA index - What will be produced
1
2
Entering edit mode
2.4 years ago
Marko ▴ 20

I was running /opt/bioinf/bwa/bwa index hg19_nc_012920_1.fa the result of the command is several files. THe list below shows the reference file along as well.

hg19_nc_012920_1.fa

hg19_nc_012920_1.fa.amb

hg19_nc_012920_1.fa.ann

hg19_nc_012920_1.fa.bwt

hg19_nc_012920_1.fa.pac

hg19_nc_012920_1.fa.sa

I expected to see hg19_nc_012920_1.fa.fai So to test I've ran bwa alignment on one interleaved fastq and command ran successfully.

Do we need fai to run bwa mem?

bwa alignment • 3.0k views
ADD COMMENT
2
Entering edit mode
2.4 years ago
antmantras ▴ 80

No, the .fai file is obtained indexing the reference with samtools faidx. It is not necessary to run bwa, but if you use a genome browser like IGV, the fai file index is required.

ADD COMMENT
0
Entering edit mode

Hi, thanks for taking time to answer.

So If I do bwa mem on the input file without .fai bwa will still work but result won't be viewable in IGV?

But if I do have a .fai file BWA will use it out of the box?

ADD REPLY
1
Entering edit mode

Hi. No, both files are different. Bwa index will produce the files you listed earlier and the mem algorithm only needs them to work. Usually, you pipe the output of bwa mem with samtools to make a bam file and then sort it.

To view your results in IGV you will need to index both, the reference genome and your bam file. To index the reference just type:

samtools faidx $ref_file --> Produces .fai file

To index your bam file type:

samtools index $bam_file --> Produces .bai file

Then you can proceed and visualize it on IGV.

ADD REPLY
0
Entering edit mode

Interesting. There must be multiple ways then to use the tools.

I am from devops side and trying to understand single step tools we use. We don't use faidx as far as I know. But I will check.

I have ran bwa mem sucessfully without fai using only files I wrote in the first post.

Thanks for taking time.

ADD REPLY

Login before adding your answer.

Traffic: 1861 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6