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 4a885e3 commit 78fd890
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/quantification/rsem/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ process quantify {
viewTx = "TranscriptQuantifications"
viewGn = "GeneQuantifications"
def memory = (task.memory ?: 1.GB).toMega()
def sortMemFrac = params.rsemSkipCi ? 0.75 : 0.5
def sortMemory = Math.max(1024, (memory * sortMemFrac) as long)
def forwardProb = null

switch (readStrand) {
Expand All @@ -73,7 +75,7 @@ process quantify {
}

def cmd = []
cmd << "sambamba sort -t ${task.cpus} -m ${memory}MB -N -M -l 0 -o - ${bam} \\"
cmd << "sambamba sort -t ${task.cpus} -m ${sortMemory}MB -N -M -l 0 -o - ${bam} \\"
cmd << """\
| rsem-calculate-expression -p ${task.cpus} \\
--bam \\
Expand All @@ -89,9 +91,10 @@ process quantify {
--forward-prob ${forwardProb} \\"""
}
if ( ! params.rsemSkipCi ) {
def ciMemory = Math.max(1024, (memory / 4) as long)
cmd << """\
--calc-ci \\
--ci-memory ${memory} \\"""
--ci-memory ${ciMemory} \\"""
}
cmd << """\
- \\
Expand Down

0 comments on commit 78fd890

Please sign in to comment.