This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BWA mem failing to locate index files

I've seen a million forum posts about this topic, however, I still cannot figure out the issue with my command line

I indexed my reference genome (hg38... Homo_sapiens_assembly38.fasta) with bwa and samtools to create files with the same name + .fai .pac .amb .ann .bwt .dict .sa

The index files and ref genome are in the same folder

I downloaded bwa in a gatk docker image (so apt-get install bwa). My fastq file is in the home directory

Here is my command line

bwa mem -M -p -t 12 /mydata/RefGenomes/hg38/Homo_sapiens_assembly38.fasta f797.fastq > f797.sam

Error message

[E::bwa_idx_load_from_disk] fail to locate the index files
bwa index

What command did you use to create the index? There was no error during that process?

bwa index -p Homo_sapiens_assembly38 -b 1000000000 -a bwtsw /path/to/Homo_sapiens_assembly38.fasta

I think this ran with no problem. It spit back out the 5 index types that I indicated above. I renamed each file to have the prefix "Homo_sapiens_assembly38.fasta." It also printed this..

Finished constructing BWT in 27 iterations.
[bwa_index] 2601.39 seconds elapse.
[bwa_index] Update BWT... 20.59 sec
[bwa_index] Pack forward-only FASTA... 20.92 sec
[bwa_index] Construct SA from BWT and Occ...
1083.39 sec
[main] Version: 0.7.12-r1039
[main] Real time: 3954.316 sec; CPU: 3753.260 sec

I renamed each file to have the prefix "Homo_sapiens_assembly38.fasta."

Why? You had provided a prefix name Homo_sapiens_assembly38 for your index. Just use that prefix name in your alignment. Do not change file names after running the indexing.

I originally didn't rename them when I ran my bwa mem command, and it still gave the same error. Should I make my .dict and .fai indices have the same name as the other 5 bwa index files?

You made the .dict and .fai files for GATK/some other software? Those should not be needed for bwa.

Yea, downloaded them from the GATK bundle FTP, I think.

I also tried inputting the path to the reference genome folder and indices instead of the fasta file itself. Still didn't work

After the index creation did you move any of the files around? Does the following work?

bwa mem -M -p -t 12 /full_path_to_folder_with_index_files/Homo_sapiens_assembly38  f797.fastq > f797.sam

I moved the index files from docker to the folder in my hard drive with the ref genome. I will try this command in a bit

0 answers

No answers yet.

Log in to answer this question.