Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mem sort for HISAT2 output #158

Merged
merged 12 commits into from
Feb 28, 2019
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#### Bug fixes
* Fixing HISAT2 Index Building for large reference genomes [#153](https://github.com/nf-core/rnaseq/issues/153)
* Fixing HISAT2 BAM sorting using more memory than available on the system


#### Dependency Updates
Expand Down
5 changes: 3 additions & 2 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,12 @@ if(params.aligner == 'hisat2'){
file "where_are_my_files.txt"

script:
def avail_mem = task.memory ? "-m ${task.memory.toBytes() / task.cpus}" : ''
def suff_mem = ("${(task.memory.toBytes() - 6000000000) / task.cpus}" > 2000000000) ? 'true' : 'false'
def avail_mem = (task.memory && suff_mem) ? "-m" + "${(task.memory.toBytes() - 6000000000) / task.cpus}" : ''
"""
samtools sort \\
$hisat2_bam \\
-@ ${task.cpus} $avail_mem \\
-@ ${task.cpus} ${avail_mem} \\
-o ${hisat2_bam.baseName}.sorted.bam
samtools index ${hisat2_bam.baseName}.sorted.bam
"""
Expand Down