nf-core_modules/tools/trim_galore/main.nf
2019-12-06 11:24:07 +01:00

35 lines
1.1 KiB
Text

process trim_galore {
tag "$sample_id"
publishDir "${params.outdir}/trim_galore", mode: 'copy',
saveAs: {filename ->
if (filename.indexOf("_fastqc") > 0) "FastQC/$filename"
else if (filename.indexOf("trimming_report.txt") > 0) "logs/$filename"
else filename
}
container 'quay.io/biocontainers/trim-galore:0.6.5--0'
input:
tuple sample_id, path(reads)
output:
tuple name, path("*fq.gz")
path "*trimming_report.txt"
path "*_fastqc.{zip,html}"
script:
c_r1 = clip_r1 > 0 ? "--clip_r1 ${clip_r1}" : ''
c_r2 = clip_r2 > 0 ? "--clip_r2 ${clip_r2}" : ''
tpc_r1 = three_prime_clip_r1 > 0 ? "--three_prime_clip_r1 ${three_prime_clip_r1}" : ''
tpc_r2 = three_prime_clip_r2 > 0 ? "--three_prime_clip_r2 ${three_prime_clip_r2}" : ''
nextseq = params.trim_nextseq > 0 ? "--nextseq ${params.trim_nextseq}" : ''
if (params.singleEnd) {
"""
trim_galore --fastqc --gzip $c_r1 $tpc_r1 $nextseq $reads
"""
} else {
"""
trim_galore --paired --fastqc --gzip $c_r1 $c_r2 $tpc_r1 $tpc_r2 $nextseq $reads
"""
}
}