nf-core_modules/software/trim_galore/main.nf

101 lines
2.5 KiB
Text
Raw Normal View History

2020-03-16 17:49:39 +00:00
nextflow.preview.dsl=2
params.singlecell = ''
params.rrbs = ''
params.pbat = ''
params.single_end = false
params.trim_nextseq = 0
params.clip_r1 = 0
params.clip_r2 = 0
params.three_prime_clip_r1 = 0
params.three_prime_clip_r2 = 0
2020-07-11 11:42:13 +00:00
process TRIM_GALORE {
2020-03-16 17:49:39 +00:00
// container 'quay.io/biocontainers/trim-galore:0.6.5--0' // maybe later
// tag "$sample_id"
2019-12-05 14:53:38 +00:00
2020-07-11 11:42:13 +00:00
input:
tuple val (name), path (reads)
val (outdir)
val (trim_galore_args)
val (verbose)
output:
tuple val(name), path ("*fq.gz"), emit: reads
path "*trimming_report.txt", optional: true, emit: report
2019-12-05 14:53:38 +00:00
2020-03-16 17:49:39 +00:00
// Trimming reports are not generated for e.g. --hardtrim5, --clock etc
// saveAs: {filename ->
// else if (filename.indexOf("trimming_report.txt") > 0) "logs/$filename"
// else filename
// }
2019-12-05 14:53:38 +00:00
2020-07-11 11:42:13 +00:00
publishDir "${outdir}/trim_galore",
mode: "copy", overwrite: true
2019-12-05 14:53:38 +00:00
script:
2020-07-11 11:42:13 +00:00
if (verbose){
println ("[MODULE] TRIM GALORE ARGS: " + trim_galore_args)
}
2020-03-16 17:49:39 +00:00
trim_galore_args += " --gzip " // we like small files
2020-07-11 11:42:13 +00:00
pairedString = 0
if (reads instanceof List) {
pairedString = 1
2020-03-16 17:49:39 +00:00
trim_galore_args += " --paired "
2020-07-11 11:42:13 +00:00
}
2020-03-16 17:49:39 +00:00
if (params.clip_r1 > 0){
trim_galore_args += " --clip_r1 ${params.clip_r1} "
}
if (params.clip_r2 > 0){
trim_galore_args += " --clip_r2 ${params.clip_r2} "
}
if (params.three_prime_clip_r1> 0){
trim_galore_args += " --three_prime_clip_r1 ${params.three_prime_clip_r1} "
}
if (params.three_prime_clip_r2 > 0){
trim_galore_args += " --three_prime_clip_r2 ${params.three_prime_clip_r2} "
}
2020-07-11 11:42:13 +00:00
2020-03-16 17:49:39 +00:00
if (params.trim_nextseq > 0){
trim_galore_args += " --nextseq ${params.trim_nextseq} "
2020-07-11 11:42:13 +00:00
}
2020-03-16 17:49:39 +00:00
// Pre-set parameters for certain bisulfite-seq applications
if (params.singlecell){
trim_galore_args += " --clip_r1 6 "
if (pairedString == 1){
trim_galore_args += " --clip_r2 6 "
}
}
if (params.rrbs){
trim_galore_args += " --rrbs "
2020-07-11 11:42:13 +00:00
}
2020-03-16 17:49:39 +00:00
if (params.pbat){
trim_galore_args += " --clip_r1 $params.pbat "
if (pairedString == 1){
trim_galore_args += " --clip_r2 $params.pbat "
}
}
2020-07-11 11:42:13 +00:00
"""
module load trim_galore
trim_galore $trim_galore_args $reads
"""
2020-03-16 17:49:39 +00:00
2019-12-05 14:53:38 +00:00
}
2020-03-16 17:49:39 +00:00
2020-07-11 11:42:13 +00:00
2020-03-16 17:49:39 +00:00