metagenomics / metagenomics-tk

GNU Affero General Public License v3.0
6 stars 1 forks source link

Metaspades fails with > 1 TB RAM because of task.memory format #363

Open nkleinbo opened 4 months ago

nkleinbo commented 4 months ago

RAM values for task.memory > 1000 GB get converted to TB, so for example 1300 GB gets converted to 1.3 TB. metaspades expects the memory parameter in GB and fails when given a non integer value.

metaspades.sh (and metaspades_hybrid.sh) could be fixed with the following code:

MEMORY=$(echo !{task.memory} | awk '{val=$1; unit=$2; if (unit == "TB") printf "%.0f\n", val*1000; else if (unit == "GB") printf "%.0f\n", val}')
spades.py -t !{task.cpus} --memory ${MEMORY} --meta -o ${METASPADES_OUTPUT_DIR} --12 interleaved.fq.gz !{params.steps.assembly.metaspades.additionalParams}