Skip to content

Commit

Permalink
Reduce memory usage in RSEM quantification process
Browse files Browse the repository at this point in the history
  • Loading branch information
emi80 committed Jul 20, 2023
1 parent ae1ecc6 commit f187f8a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions grape-pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,8 @@ process quantification {
viewTx = "TranscriptQuantifications"
viewGn = "GeneQuantifications"
memory = (task.memory ?: 1.GB).toMega()
sortMemory = Math.max(1024, (memory / 2) as long)
ciMemory = Math.max(1024, (memory / 4) as long)
command = "${task.process}/${params.quantificationTool}"
if ( params.quantificationTool == 'RSEM') {
command += "-${pairedEnd ? 'Paired-End' : 'Single-End'}"
Expand Down
4 changes: 2 additions & 2 deletions templates/quantification/RSEM-Paired-End-MATE1_SENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
set -e
set -u

sambamba sort -t ${cpus} -m ${memory}MB -N -M -l 0 -o - ${bam} \
sambamba sort -t ${cpus} -m ${sortMemory}MB -N -M -l 0 -o - ${bam} \
| rsem-calculate-expression --bam \
--estimate-rspd \
--calc-ci \
--no-bam-output \
--seed 12345 \
-p ${cpus} \
--ci-memory ${memory} \
--ci-memory ${ciMemory} \
--paired-end \
--forward-prob 1 \
- \
Expand Down
4 changes: 2 additions & 2 deletions templates/quantification/RSEM-Paired-End-MATE2_SENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
set -e
set -u

sambamba sort -t ${cpus} -m ${memory}MB -N -M -l 0 -o - ${bam} \
sambamba sort -t ${cpus} -m ${sortMemory}MB -N -M -l 0 -o - ${bam} \
| rsem-calculate-expression --bam \
--estimate-rspd \
--calc-ci \
--no-bam-output \
--seed 12345 \
-p ${cpus} \
--ci-memory ${memory} \
--ci-memory ${ciMemory} \
--paired-end \
--forward-prob 0 \
- \
Expand Down
4 changes: 2 additions & 2 deletions templates/quantification/RSEM-Paired-End-NONE
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
set -e
set -u

sambamba sort -t ${cpus} -m ${memory}MB -N -M -l 0 -o - ${bam} \
sambamba sort -t ${cpus} -m ${sortMemory}MB -N -M -l 0 -o - ${bam} \
| rsem-calculate-expression --bam \
--estimate-rspd \
--calc-ci \
--no-bam-output \
--seed 12345 \
-p ${cpus} \
--ci-memory ${memory} \
--ci-memory ${ciMemory} \
--paired-end \
- \
${quantRef}/RSEMref \
Expand Down
4 changes: 2 additions & 2 deletions templates/quantification/RSEM-Single-End-ANTISENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
set -e
set -u

sambamba sort -t ${cpus} -m ${memory}MB -N -l 0 -o - ${bam} \
sambamba sort -t ${cpus} -m ${sortMemory}MB -N -l 0 -o - ${bam} \
| rsem-calculate-expression --bam \
--estimate-rspd \
--calc-ci \
--no-bam-output \
--seed 12345 \
-p ${cpus} \
--ci-memory ${memory} \
--ci-memory ${ciMemory} \
--forward-prob 0 \
- \
${quantRef}/RSEMref \
Expand Down
4 changes: 2 additions & 2 deletions templates/quantification/RSEM-Single-End-NONE
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
set -e
set -u

sambamba sort -t ${cpus} -m ${memory}MB -N -l 0 -o - ${bam} \
sambamba sort -t ${cpus} -m ${sortMemory}MB -N -l 0 -o - ${bam} \
| rsem-calculate-expression --bam \
--estimate-rspd \
--calc-ci \
--no-bam-output \
--seed 12345 \
-p ${cpus} \
--ci-memory ${memory} \
--ci-memory ${ciMemory} \
- \
${quantRef}/RSEMref \
${prefix}
Expand Down
4 changes: 2 additions & 2 deletions templates/quantification/RSEM-Single-End-SENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
set -e
set -u

sambamba sort -t ${cpus} -m ${memory}MB -N -l 0 -o - ${bam} \
sambamba sort -t ${cpus} -m ${sortMemory}MB -N -l 0 -o - ${bam} \
| rsem-calculate-expression --bam \
--estimate-rspd \
--calc-ci \
--no-bam-output \
--seed 12345 \
-p ${cpus} \
--ci-memory ${memory} \
--ci-memory ${ciMemory} \
--forward-prob 1 \
- \
${quantRef}/RSEMref \
Expand Down

0 comments on commit f187f8a

Please sign in to comment.