I'm currently trying to import a .fasta file into bwa to use a reference genome to map my reads to. However, i currently am getting this error:
[E::bwa_idx_load_from_disk] fail to locate the index files
Any help? Here is my code:
#!/bin/bash
source /opt/asn/etc/asn-bash-profiles-special/modules.sh
module load fastqc/0.10.1
module load fastx/0.0.13
source /opt/asn/etc/asn-bash-profiles-special/modules.sh
module load pear/0.9.10
source /opt/asn/etc/asn-bash-profiles-special/modules.sh
module load fastqc/0.10.1
module load fastx/0.0.13
module load bwa/0.7.12
module load samtools/1.2
source /opt/asn/etc/asn-bash-profiles-special/modules.sh
module load trimmomatic/0.35
r=20
####mapping
#Indexing reference library for BWA mapping:
bwa index -a is ~/gz_files/sample_things/fungiref.fa fungiref
bwa mem fungiref sample${r}_clipped_paired.assembled.fastq > sample${r}.sam
#sort and convert to bam
samtools view -bS sample${r}.sam | samtools sort - sample{r}_sorted
#counts and stats
samtools index sample${r}_sorted.bam
samtools idxstats sample${r}_sorted.bam > ${r}_counts.txt
The usage for bwa index
is
bwa index [-p prefix] [-a algoType] <in.db.fasta>
Your usage doesn’t match this; it’s a shame that bwa
silently accepts this instead of immediately throwing an error. Annoyingly, there is also simply no way to specify a path prefix for the index. You’re stuck with the location of your reference.
At any rate, the index filename is derived from the FASTA reference file. As a consequence you need to adjust your index filename in the subsequent command:
bwa mem ~/gz_files/sample_things/fungiref.fa sample${r}_clipped_paired.assembled.fastq > sample${r}.sam