Question: BWA mem failing to locate index files
1
gravatar for aalith
10 months ago by
aalith10
aalith10 wrote:

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
index bwa • 995 views
ADD COMMENTlink written 10 months ago by aalith10

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

ADD REPLYlink written 10 months ago by genomax84k
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
ADD REPLYlink modified 10 months ago by genomax84k • written 10 months ago by aalith10

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.

ADD REPLYlink modified 10 months ago • written 10 months ago by genomax84k

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?

ADD REPLYlink written 10 months ago by aalith10

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

ADD REPLYlink written 10 months ago by genomax84k

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

ADD REPLYlink modified 10 months ago • written 10 months ago by aalith10

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
ADD REPLYlink modified 10 months ago • written 10 months ago by genomax84k

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

ADD REPLYlink written 10 months ago by aalith10
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: 817 users visited in the last hour