Question: bwa-MEM fails to execute with reference sequence (hg19.fasta) from history
gravatar for skanwal
2.1 years ago by
skanwal0 wrote:

Hi, I have been trying to use custom reference genome hg19.fasta and choosing the option to build index as part of "Map with BWA" step but it fails to build the index. The process turns green showing completion but throws following error:

[bwa_index] Pack FASTA... 23.29 sec [bwa_index] Construct BWT for the packed sequence... * Error in `bwa': munmap_chunk(): invalid pointer: 0x00007f2e1a8b3010 * Aborted (core dumped) [bwt_restore_sa] fail to open file '' : No such file or directory

The machine (cloud instance) I am using has 32GB RAM so running out of memory does not seem a reason apparently as I can very well index the same fasta file on my local system with 8GB RAM.

I have tried everything to my knowledge but still no luck with the error.

Any help will be highly appreciated. Thank you.

ADD COMMENTlink modified 2.1 years ago by Jennifer Hillman Jackson24k • written 2.1 years ago by skanwal0
gravatar for Jennifer Hillman Jackson
2.1 years ago by
United States
Jennifer Hillman Jackson24k wrote:


Tools can fail for memory sometimes without the cleaner error message. It also can fail if the fastq input is labeled as "fastqsanger" but is not actually in the format. Help to double check.

A quick check to see if tool install or other technical set-up is a factor is to try using a smaller genome as a test. The help here is more content/input based (the most common reason for tool failures).

Using the older version of samtools indexes can also lead to issues when using CG on the fly. The Tool Shed has both. This could actually be root problem (is is required for a successful BWA/BWA-Mem index, even as a CG).

Using a highly fragmented CG can also trigger issue, but that doesn't sound like your issue, if using UCSC's hg19.

Since you are on your own cloud instance, I suggest using a data manager to install it the index. Be sure to use the newer version to match the tool.

But if you really want to use a custom reference genome, check format and clean it up. It could lead to this problem not necessarily with this tool (unless the description is unsually long). Note that removing any description line content in the title line (">") is a very good idea. Even if BWA-MEM can use it, downstream tools can have problems, which unfortunately means that the analysis has to be started over from the mapping step! Related with highlights that apply to all CGs: Fasta Format, Custom Genomes, and GATK Chromosome ordering

Thanks, Jen, Galaxy team

ADD COMMENTlink written 2.1 years ago by Jennifer Hillman Jackson24k

Hi Jen,

I actually solved this issue by using the latest version of bwa with -a bwtsw argument. Thanks for your reply.

ADD REPLYlink written 2.1 years ago by skanwal0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 71 users visited in the last hour