samtools sorts allocate memory for bam_mem issues
1
0
Entering edit mode
2.9 years ago
iamsmor • 0

Hello everyone

I am trying to convert sam to bam

samtools sort -@ 8 -o UHR_Rep1.bam UHR_Rep1.sam

and I got this error

samtools sort: couldn't allocate memory for bam_mem

I check my disk memory and I see have enough space in my disk.How I can achieve this problem?

samtools RNA-seq • 4.3k views
ADD COMMENT
0
Entering edit mode

Output of free -mh? Disk space != memory fyi

ADD REPLY
0
Entering edit mode
free -hw

              total        used        free      shared     buffers       cache   available
Mem:      3,7Gi       2,0Gi       277Mi       387Mi        99Mi       1,4Gi       1,2Gi

Swap:      2,0Gi   381Mi      1,6Gi

do you asked for it ? ı dont know how much it is need.

ADD REPLY
0
Entering edit mode

How ı can allocate mem properly for convert to sam to bam file via samtools

ADD REPLY
2
Entering edit mode
2.9 years ago
GenoMax 147k

Depending on the size of the BAM file you have you may not be able to do this on your machine. You have only 3.7 G of RAM out of which 1.2 G seems to be available when you ran the above command. Generally samtools will use temporary files to do the sort (and writes them to the directory you ran this from, I assume that is the disk where you have space).

I suggest that you try this sort with just one thread (i.e remove -@ 8) and see if following works. It may take a while to sort the file so be patient if the following starts running without the memory error.

samtools sort -o UHR_Rep1.bam UHR_Rep1.sam
ADD COMMENT
0
Entering edit mode

yay it works.thank you very much GenoMax.

ADD REPLY
1
Entering edit mode

Yes, because each additional thread needs about 800MB of memory by default so that exceeded what you had when using 8 threads.

ADD REPLY

Login before adding your answer.

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