samtools sort: couldn't allocate memory for bam_mem
0
0
Entering edit mode
2.2 years ago
SushiRoll ▴ 140

Dear all,

I'm running Snippy 4.6.0 and I'm having the following problem:

samtools sort: couldn't allocate memory for bam_mem [bam_mating_core] ERROR: Couldn't read header samtools sort: failed to read header from "-"

samtools sort runs as default:

samtools sort -n -l 0 -T /tmp --threads 3 -m 2000M | samtools fixmate -m --threads 3 - - | samtools sort -l 0 -T /tmp --threads 3 -m 2000M | samtools markdup -T /tmp --threads 3 -r -s - - > snps.bam 2>> snps.log

So I'm guessing it has to do with the 2000M. Is that correct? These tools run automatically when running snippy, should I modify the script? If that is indeed the problem, which would you suggest would be a reasonable amount of memory? I currently have 8Gb.

Thanks a lot!

Snippy • 1.4k views
ADD COMMENT
0
Entering edit mode

I see no input file in the first sort command. Don't use /tmp as temporary directory, it's the physical memory, use any path on disk.

ADD REPLY
0
Entering edit mode

Hi ATpoint,

Thanks for your help, in the end it was a server error, I'm using a VM hosted at our main server and after some maintenance, each VM was assigned Mb instead of Gb. With that fixed, it seems to be running smoothly. I'm nevertheless interested in not using /tmp as a directory, should it be changed? aren't the tools downstream the pipeline going to look for the files in /tmp? I'm not really familiar with the more "technical computer" stuff so I might be talking nonsense.

Thanks a lot!

ADD REPLY
0
Entering edit mode

Temporary files are created when the actual process (here sort) runs out of allocated memory. It will then spill intermediate files to -T location, and later merge them into the final file which is then piped to stdout. I personally find it bad practice to use /tmp as this is the physical memory so you are kind of defeating the purpose of tmp files.

ADD REPLY

Login before adding your answer.

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