process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } withName: BIOBAMBAM_BAMMERGE { ext.args = {[ "md5=1", "md5filename=${meta.id}.md5", "index=1", "indexfilename=${meta.id}.bam.bai" ].join(" ").trim()} } }