Taiji-pipeline / Taiji

All-in-one analysis pipeline
https://taiji-pipeline.github.io/
BSD 3-Clause "New" or "Revised" License
34 stars 9 forks source link

Error: samtools sort: couldn't allocate memory for bam_mem #12

Closed cong-003 closed 4 years ago

cong-003 commented 4 years ago

I got the following error message when running Taiji. It's related to memory allocation of samtools sort. The default -m is 4G, so should I increase -m to solve this? How can I do that? Thanks!


[ERROR][10-02 12:42] ATAC_Filter_Bam(6920..) Failed:
Ran commands:
bash -c 'set -o pipefail; samtools view -f 2 -F 0x70c -q 30 -u /home/cong/Taiji/human_immune/human_reactome/output/ATACSeq/Bam/pHSC_ATAC_rep18.bam | samtools sort - -n -m 4G -l 0 -T /tmp/tmpdir-059a025aaa10c37a/nsrt | samtools fixmate -r -m - - | samtools view -F 1804 -f 2 -u - | samtools sort - -T /tmp/tmpdir-059a025aaa10c37a/csrt -m 4G -l 9 -o /home/cong/Taiji/human_immune/human_reactome/output/ATACSeq/Bam/pHSC_ATAC_rep18_filt.bam' Exception: error running: bash -c 'set -o pipefail; samtools view -f 2 -F 0x70c -q 30 -u /home/cong/Taiji/human_immune/human_reactome/output/ATACSeq/Bam/pHSC_ATAC_rep18.bam | samtools sort - -n -m 4G -l 0 -T /tmp/tmpdir-059a025aaa10c37a/nsrt | samtools fixmate -r -m - - | samtools view -F 1804 -f 2 -u - | samtools sort - -T /tmp/tmpdir-059a025aaa10c37a/csrt -m 4G -l 9 -o /home/cong/Taiji/human_immune/human_reactome/output/ATACSeq/Bam/pHSC_ATAC_rep18_filt.bam' exit status: 1
stderr: /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) [bam_sort_core] merging from 2 files and 1 in-memory blocks... samtools sort: couldn't allocate memory for bam_mem CallStack (from HasCallStack):
error, called at src/Control/Workflow/Interpreter/Exec.hs:134:37 in SciFlow-0.7.2-Jc8TJcu7aUL61DWlZpDMFY:Control.Workflow.Interpreter.Exec

kaizhang commented 4 years ago

The problem is that you do not have enough memory to run samtools sort. I think for this particular step you need at least 8G memory. If you are running jobs on clusters, you can following these steps to make sure ATAC_Filter_Bam get enough memory: https://taiji-pipeline.github.io/documentation/options.html#distributed-computing

cong-003 commented 4 years ago

Thanks a lot, it worked!