From 0bfa5ba95d545bd097152ab505d10bcb4ca9da5c Mon Sep 17 00:00:00 2001 From: "Gervaise H. Henry" <gervaise.henry@utsouthwestern.edu> Date: Mon, 18 Jan 2021 21:28:20 -0600 Subject: [PATCH] Copy samtools mem param fix to align sample --- workflow/rna-seq.nf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/workflow/rna-seq.nf b/workflow/rna-seq.nf index f4d54eb..23d59c8 100644 --- a/workflow/rna-seq.nf +++ b/workflow/rna-seq.nf @@ -757,10 +757,12 @@ process alignSampleData { # convert the output sam file to a sorted bam file using Samtools echo -e "LOG: converting from sam to bam" >> ${repRID}.${ref}.alignSampleData.log - samtools view -1 -@ `nproc` -F 4 -F 8 -F 256 -o ${ref}.sampled.bam ${ref}.sampled.sam + samtools view -1 -@ `nproc` -m \${mem}K -F 4 -F 8 -F 256 -o ${ref}.sampled.bam ${ref}.sampled.sam # sort the bam file using Samtools echo -e "LOG: sorting the bam file" >> ${repRID}.${ref}.alignSampleData.log + mem=\$(vmstat -s -S K | grep 'total memory' | grep -o '[0-9]*') + mem=\$(expr \${mem} / `nproc` \\* 85 / 100) samtools sort -@ `nproc` -O BAM -o ${ref}.sampled.sorted.bam ${ref}.sampled.bam # index the sorted bam using Samtools -- GitLab