From 1189b9250b70bb687592fce52bd25258d500de4e Mon Sep 17 00:00:00 2001 From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr> Date: Thu, 20 Sep 2018 17:05:17 +0200 Subject: [PATCH] src/nf_modules/Hisat2/test/bam_converter.nf : converting sam to bam --- src/nf_modules/Hisat2/test/bam_converter.nf | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/nf_modules/Hisat2/test/bam_converter.nf diff --git a/src/nf_modules/Hisat2/test/bam_converter.nf b/src/nf_modules/Hisat2/test/bam_converter.nf new file mode 100644 index 00000000..f9627eb0 --- /dev/null +++ b/src/nf_modules/Hisat2/test/bam_converter.nf @@ -0,0 +1,32 @@ +/* +* SAMtools : +* Imputs : sam files +* Output : bam files +*/ + +/* sam to bam */ +params.sam = "$baseDir/data/bam/*.sam" + +log.info "sam files : ${params.sam}" + +Channel + .fromPath( params.sam ) + .ifEmpty { error "Cannot find any sam files matching: ${params.sam}" } + .set { sam_files } + +process bam_converter { + tag "$sam" + cpus 4 + publishDir "results/mapping/bam/", mode: 'copy' + + input: + file sam from sam_files + + output: + file "*.bam" into bam_files + + script: +""" +samtools view -@ ${task.cpus} -bS ${sam} > ${sam.baseName}.bam +""" +} -- GitLab