bwa-mem keeps failing to locate the index files
1
0
Entering edit mode
1 day ago
pairedttest ▴ 30

Okay, so I am at my wits end here. I just want to run bwa-mem on some fastq files but bwa-mem does not seem to want to run despite everything being in the proper place. Here is what I have done so far. I have a few fastq files that I am trying to align to the hg38 genome. I ran bwa-index with the following script

#SBATCH --mem-per-cpu=200G

bwa index hg38.fa hg38

And it generated 6 files, all with the hg38 prefix. hg38.fa.amb, hg38.fa.ann, hg38.fa.bwt, hg38.fa.fai, hg38.fa.pac, hg38.fa.sa.

All of these files are in the same working directory as my fastq files. Then I tried to run bwa-mem with the following script

bwa mem hg38 4810_R1.fastq.gz 4810_R2.fastq.gz > 4810_aln.sam 
bwa mem hg38 4811_R1.fastq.gz 4811_R2.fastq.gz > 4811_aln.sam
bwa mem hg38 4812_R1_fastq.gz 4812_R2.fastq.gz > 4812_aln.sam
bwa mem hg38 4813_R1.fastq.gz 4813_R2.fastq.gz > 4813_aln.sam
bwa mem hg38 4814_R1.fastq.gz 4814_R2.fastq.gz > 4814_aln.sam
bwa mem hg38 4815_R1.fastq.gz 4815_R2.fastq.gz > 4815_aln.sam
bwa mem hg38 4816_R1.fastq.gz 4816_R2.fastq.gz > 4816_aln.sam
bwa mem hg38 4817_R1.fastq.gz 4817_R2.fastq.gz > 4817_aln.sam

But it keeps returning the error [E::bwa_idx_load_from_disk] fail to locate the index files

So I have no idea what to do. I've tried multiple times with multiple different prefixes but it returns the same error. all of the files are in the same working directory.

bwa bwa-mem • 143 views
ADD COMMENT
0
Entering edit mode

in my code the reference is .fasta, not .fa, i don't this could be the issue

ADD REPLY
0
Entering edit mode
1 day ago

The proper invocation of the indexing is:

bwa index hg38.fa

that creates an index under the name of hg38.fa or

bwa index -p hg38 hg38.fa

which will create an index as hg38. Both would work fine.

In your case you are using the indexing command incorrectly, and the actually index name is hg38.fa

ADD COMMENT
0
Entering edit mode

The indexing should still run with OPs code, but result in index files hg38.fa.* so bwa mem hg38.fa 4810_R1.fastq.gz 4810_R2.fastq.gz > 4810_aln.sam should do. Essentially, the trailing hg38 in OPs command line is simply ignored due to missing -p. Side-note @OP, don't store sam files, do at least bwa mem (...) | samtools view -o out.bam.

ADD REPLY

Login before adding your answer.

Traffic: 2244 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