From 58d2e60a79a3bec18a771c8031ab98967afedf59 Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent.modolo@ens-lyon.fr> Date: Fri, 29 Mar 2019 11:02:01 +0100 Subject: [PATCH] hisat2: update process and config to match new format --- .../hisat2/{test => }/bam_converter.nf | 0 src/nf_modules/hisat2/indexing.config | 36 +++++++++++++++++++ .../hisat2/{test/index.nf => indexing.nf} | 2 +- src/nf_modules/hisat2/mapping_paired.config | 36 +++++++++++++++++++ .../hisat2/{test => }/mapping_paired.nf | 14 +++++--- src/nf_modules/hisat2/mapping_single.config | 36 +++++++++++++++++++ .../hisat2/{test => }/mapping_single.nf | 16 ++++++--- src/nf_modules/hisat2/{test => }/tests.sh | 0 8 files changed, 129 insertions(+), 11 deletions(-) rename src/nf_modules/hisat2/{test => }/bam_converter.nf (100%) create mode 100644 src/nf_modules/hisat2/indexing.config rename src/nf_modules/hisat2/{test/index.nf => indexing.nf} (90%) create mode 100644 src/nf_modules/hisat2/mapping_paired.config rename src/nf_modules/hisat2/{test => }/mapping_paired.nf (65%) create mode 100644 src/nf_modules/hisat2/mapping_single.config rename src/nf_modules/hisat2/{test => }/mapping_single.nf (59%) rename src/nf_modules/hisat2/{test => }/tests.sh (100%) diff --git a/src/nf_modules/hisat2/test/bam_converter.nf b/src/nf_modules/hisat2/bam_converter.nf similarity index 100% rename from src/nf_modules/hisat2/test/bam_converter.nf rename to src/nf_modules/hisat2/bam_converter.nf diff --git a/src/nf_modules/hisat2/indexing.config b/src/nf_modules/hisat2/indexing.config new file mode 100644 index 00000000..dbbb4a2e --- /dev/null +++ b/src/nf_modules/hisat2/indexing.config @@ -0,0 +1,36 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + withName: index_fasta { + cpus = 4 + container = "hisat2:2.0.0" + } + } + } + singularity { + singularity.enabled = true + process { + withName: index_fasta { + cpus = 4 + container = "file://bin/hisat2:2.0.0.sif" + } + } + } + sge { + process{ + withName: index_fasta { + beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules" + module = "hisat2/2.0.0" + executor = "sge" + clusterOptions = "-cwd -V" + memory = "20GB" + cpus = 16 + time = "12h" + queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F' + penv = 'openmp16' + } + } + } +} diff --git a/src/nf_modules/hisat2/test/index.nf b/src/nf_modules/hisat2/indexing.nf similarity index 90% rename from src/nf_modules/hisat2/test/index.nf rename to src/nf_modules/hisat2/indexing.nf index 7b30f7db..563a13c2 100644 --- a/src/nf_modules/hisat2/test/index.nf +++ b/src/nf_modules/hisat2/indexing.nf @@ -27,6 +27,6 @@ process index_fasta { script: """ -hisat2-build ${fasta} ${fasta.baseName}.index +hisat2-build -p {task.cpus} ${fasta} ${fasta.baseName}.index """ } diff --git a/src/nf_modules/hisat2/mapping_paired.config b/src/nf_modules/hisat2/mapping_paired.config new file mode 100644 index 00000000..6f3aa47b --- /dev/null +++ b/src/nf_modules/hisat2/mapping_paired.config @@ -0,0 +1,36 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + withName: mapping_fastq { + cpus = 4 + container = "hisat2:2.0.0" + } + } + } + singularity { + singularity.enabled = true + process { + withName: mapping_fastq { + cpus = 4 + container = "file://bin/hisat2:2.0.0.sif" + } + } + } + sge { + process{ + withName: mapping_fastq { + beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules" + module = "hisat2/2.0.0" + executor = "sge" + clusterOptions = "-cwd -V" + memory = "20GB" + cpus = 16 + time = "12h" + queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F' + penv = 'openmp16' + } + } + } +} diff --git a/src/nf_modules/hisat2/test/mapping_paired.nf b/src/nf_modules/hisat2/mapping_paired.nf similarity index 65% rename from src/nf_modules/hisat2/test/mapping_paired.nf rename to src/nf_modules/hisat2/mapping_paired.nf index 8350ebc0..d7bf9696 100644 --- a/src/nf_modules/hisat2/test/mapping_paired.nf +++ b/src/nf_modules/hisat2/mapping_paired.nf @@ -14,20 +14,24 @@ Channel .set { index_files } process mapping_fastq { - tag "$reads" - //tag "$index.baseName" - cpus 4 + tag "$pair_id" publishDir "results/mapping/", mode: 'copy' input: set pair_id, file(reads) from fastq_files - file index from index_files.toList() + file index from index_files.collect() output: file "*" into counts_files script: + index_id = index[0] + for (index_file in index) { + if (index_file =~ /.*\.1\.bt2/ && !(index_file =~ /.*\.rev\.1\.bt2/)) { + index_id = ( index_file =~ /(.*)\.1\.bt2/)[0][1] + } + } """ -hisat2 -x ${file(file(index[0]).baseName).baseName} -1 ${reads[0]} -2 ${reads[1]} -S ${pair_id}.sam -p ${task.cpus} +hisat2 -x ${index_id} -1 ${reads[0]} -2 ${reads[1]} -S ${pair_id}.sam -p ${task.cpus} """ } diff --git a/src/nf_modules/hisat2/mapping_single.config b/src/nf_modules/hisat2/mapping_single.config new file mode 100644 index 00000000..6f3aa47b --- /dev/null +++ b/src/nf_modules/hisat2/mapping_single.config @@ -0,0 +1,36 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + withName: mapping_fastq { + cpus = 4 + container = "hisat2:2.0.0" + } + } + } + singularity { + singularity.enabled = true + process { + withName: mapping_fastq { + cpus = 4 + container = "file://bin/hisat2:2.0.0.sif" + } + } + } + sge { + process{ + withName: mapping_fastq { + beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules" + module = "hisat2/2.0.0" + executor = "sge" + clusterOptions = "-cwd -V" + memory = "20GB" + cpus = 16 + time = "12h" + queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F' + penv = 'openmp16' + } + } + } +} diff --git a/src/nf_modules/hisat2/test/mapping_single.nf b/src/nf_modules/hisat2/mapping_single.nf similarity index 59% rename from src/nf_modules/hisat2/test/mapping_single.nf rename to src/nf_modules/hisat2/mapping_single.nf index f6740b72..93506140 100644 --- a/src/nf_modules/hisat2/test/mapping_single.nf +++ b/src/nf_modules/hisat2/mapping_single.nf @@ -11,6 +11,7 @@ log.info "index files : ${params.index}" Channel .fromPath( params.fastq ) .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } + .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]} .set { fastq_files } Channel .fromPath( params.index ) @@ -18,19 +19,24 @@ Channel .set { index_files } process mapping_fastq { - tag "$reads.baseName" - cpus 4 + tag "$file_id" publishDir "results/mapping/", mode: 'copy' input: - file reads from fastq_files - file index from index_files.toList() + set file_id, file(reads) from fastq_files + file index from index_files.collect() output: file "*" into count_files script: + index_id = index[0] + for (index_file in index) { + if (index_file =~ /.*\.1\.bt2/ && !(index_file =~ /.*\.rev\.1\.bt2/)) { + index_id = ( index_file =~ /(.*)\.1\.bt2/)[0][1] + } + } """ -hisat2 -x ${file(file(index[0]).baseName).baseName} -U ${reads} -S ${reads.baseName}.sam -p ${task.cpus} +hisat2 -x ${index_id} -U ${reads} -S ${file_id}.sam -p ${task.cpus} """ } diff --git a/src/nf_modules/hisat2/test/tests.sh b/src/nf_modules/hisat2/tests.sh similarity index 100% rename from src/nf_modules/hisat2/test/tests.sh rename to src/nf_modules/hisat2/tests.sh -- GitLab