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?
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?
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.
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?
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.
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.
Log in to answer this question.