This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BWA Index Referencing Failed. Possible Reason and Solutions?

Script:

echo "STEP 2: Map to reference using BWA-MEM"

#BWA index reference 

bwa index ${ref}              *#Path for ref variable has been defined*            


#BWA alignment

bwa mem -t 4 -R "@RG\tID:SRR062634\tPL:ILLUMINA\tSM:SRR062634" ${ref} ${reads}/SRR062634_1.filt.fastq.gz ${reads}/SRR062634_2.filt.fastq.gz > ${aligned_reads}/SRR062634.paired.sam


**Error:** 
.
.
.
.
[BWTIncConstructFromPacked] 690 iterations done. 6374612482 characters processed.
[BWTIncConstructFromPacked] 700 iterations done. 6398716386 characters processed.
[BWTIncConstructFromPacked] 710 iterations done. 6418572210 characters processed.
[bwt_gen] Finished constructing BWT in 710 iterations.
[bwa_index] 5659.83 seconds elapse.
[bwa_index] Update BWT... ./variant_calling.sh: line 69:  2591 Killed                  bwa index "/home/nanam/supporting_files/hg38/hg38.fa"
[E::bwa_idx_load_from_disk] fail to locate the index files

*What errors I am getting exactly? '2591 Killed' means system killed the process. System limitation?

The line 69 in script is: bwa index ${ref}

And for the error 'fail to locate the index files error', the path is correct and file exist there when I open file explorer.*

bwa

What is the output of echo $ref?

After execution of bwa index ${ref}, there should be five files generated viz

hg38.fa.bwt

hg38.fa.amb

hg38.fa.ann

hg38.fa.pac

hg38.fa.sa

The first four files have been generated. But the last one did not (hg38.fa.sa)

[bwa_index] Update BWT... ./variant_calling.sh: line 69: 2591 Killed bwa index "/home/nanam/supporting_files/hg38/hg38.fa"

This here suggests that something went wrong during the indexing. How much memory du you have on your machine?

My system specs: 1 TB storage and 16GB RAM, i7 12 gen processor and dedicated NIVIDIA GEFORCE GPU

Should be enough. My recommendation is to run the indexing manually outside of this script and see that it completes properly without errors. If that is true and the error still comes up we can see whatelse to do.

The error is repeated again.

Could you also check that you have enough disk space on your machine ?

I have enough disk space.

And for the error 'fail to locate the index files error', the path is correct and file exist there when I open file explorer.*

path to reference genome file and outputted files after indexing must be same

1 answer

Hi Tundup,

try to index your reference genome like :

bwa index -a bwtsw  <PahtToRef>

I suggest testing it manually after indexing the reference, rather than using the script. let us know how things go.

After that, it again shows the same error:

[BWTIncConstructFromPacked] 690 iterations done. 6374612482 characters processed. [BWTIncConstructFromPacked] 700 iterations done. 6398716386 characters processed. [BWTIncConstructFromPacked] 710 iterations done. 6418572210 characters processed.

[bwt_gen] Finished constructing BWT in 710 iterations.

[bwa_index] 4553.84 seconds elapse.

[bwa_index] Update BWT... Killed

16 GB of RAM should be more than sufficient for indexing the human genome. If the command syntax is correct and storage is not an issue, I recommend checking your installation of BWA. It might be worthwhile to re-install the latest version. Personally, I use BWA regularly and have not encountered any issues with it.

Alternatively, you could consider using a pre-indexed reference genome, although I prefer not to use this method myself."

Log in to answer this question.