jodyphelan / TBProfiler

Profiling tool for Mycobacterium tuberculosis to detect ressistance and strain type from WGS data
GNU General Public License v3.0
102 stars 42 forks source link

ERROR WHILE RUNNING TBPROFILER: Kindly help me solve this error #288

Open SandraBabirye opened 1 year ago

SandraBabirye commented 1 year ago

tb-profiler error report

jodyphelan commented 9 months ago

Can you give me some details about the system you are running tb-profiler on? It might be an issue of running out of RAM

aebordoy commented 2 months ago

I think I am facing a similar problem when I try to run one of my samples. However, running the test indicated in the manual did not result in such error:

Command: tb-profiler profile -1 44015MTL22_R1.fastq.gz -2 44015MTL22_R2.fastq.gz -t 4 -p 44015MTL22 --txt

Error: [14:26:19] ERROR [bam_sort_core] merging from 0 files and 4 in-memory blocks... utils.py:485 samtools sort: couldn't allocate memory for bam_mem
samtools markdup: error reading header

Traceback:
Traceback (most recent call last): File "/imppc/labs/emlab/aescalas/miniconda3/envs/TBProfiler/bin/tb-profiler", line 583, in args.func(args) File "/imppc/labs/emlab/aescalas/miniconda3/envs/TBProfiler/bin/tb-profiler", line 101, in main_profile variants_profile = pp.run_profiler(args) File "/imppc/labs/emlab/aescalas/miniconda3/envs/TBProfiler/lib/python3.10/site-packages/pathogenprofiler/cli.py", line 191, in run_profiler args.bam = get_bam_file(args) File "/imppc/labs/emlab/aescalas/miniconda3/envs/TBProfiler/lib/python3.10/site-packages/pathogenprofiler/cli.py", line 255, in get_bam_file bam_obj = fastq_obj.map_to_ref( File "/imppc/labs/emlab/aescalas/miniconda3/envs/TBProfiler/lib/python3.10/site-packages/pathogenprofiler/fastq.py", line 115, in map_to_ref run_cmd("samtools sort -m %(max_mem)s -n -@ %(threads)s %(bam_unsort_file)s | samtools fixmate -@ %(threads)s -m - - | samtools sort -m %(max_mem)s -@ %(threads)s - | samtools markdup -@ %(threads)s - %(bam_file)s" % vars(self)) File "/imppc/labs/emlab/aescalas/miniconda3/envs/TBProfiler/lib/python3.10/site-packages/pathogenprofiler/utils.py", line 486, in run_cmd raise ValueError("Command Failed:\n%s\nstderr:\n%s" % (cmd,result.stderr.decode())) ValueError: Command Failed: /bin/bash -c set -o pipefail; samtools sort -m 768M -n -@ 4 /imppc/labs/emlab/aescalas/TBSEQ/MTB2409/f4aaaead-7bda-4a9b-9ed8-a3dc8132eb70.unsort.bam | samtools fixmate -@ 4 -m - - | samtools sort -m 768M -@ 4 - | samtools markdup -@ 4 - /imppc/labs/emlab/aescalas/TBSEQ/MTB2409/f4aaaead-7bda-4a9b-9ed8-a3dc8132eb70.bam stderr: [bam_sort_core] merging from 0 files and 4 in-memory blocks... samtools sort: couldn't allocate memory for bam_mem samtools markdup: error reading header

Thank you

jodyphelan commented 2 months ago

How much memory do you have on your system? and how big are the fastq files?

aebordoy commented 2 months ago

I'm not sure about the memory available when I run it. I was running it on a server but on my own user space. Executing the same command through qsub solved the problem.

jodyphelan commented 2 months ago

Ok, somtimes with servers using job queues they limit what you can run on your own profile. If it worked when you used qsub then I think there might be a limitation on the resources given to your own user space.

aebordoy commented 2 months ago

Right, I think that was the problem, my bad. As an update, I have been able to run smoothly a batch of about 120 samples! Thanks a lot!