2019-12-05 14:35:51 +00:00
|
|
|
process samtools_index {
|
|
|
|
tag "${bam.baseName}"
|
|
|
|
|
2019-12-05 21:11:12 +00:00
|
|
|
container 'quay.io/biocontainers/samtools:1.9--h10a08f8_12'
|
2019-12-05 14:35:51 +00:00
|
|
|
|
|
|
|
input:
|
2019-12-05 21:11:12 +00:00
|
|
|
path(bam)
|
2019-12-05 14:35:51 +00:00
|
|
|
|
|
|
|
output:
|
2019-12-05 21:11:12 +00:00
|
|
|
path "*.sorted.bam"
|
2019-12-05 14:35:51 +00:00
|
|
|
|
|
|
|
script:
|
|
|
|
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 $bam \\
|
|
|
|
-@ ${task.cpus} ${avail_mem} \\
|
|
|
|
-o ${bam.baseName}.sorted.bam
|
|
|
|
|
|
|
|
samtools --version &> v_samtools.txt
|
|
|
|
"""
|
|
|
|
}
|