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 0000000000000000000000000000000000000000..dbbb4a2ed8b9046c0ebabe881336873faf99d760 --- /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 7b30f7dbee82e1a94f532e76189dbbebc03f9d72..563a13c25200a2fbda98063fb9761631c17ee290 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 0000000000000000000000000000000000000000..6f3aa47b1d1d7fc417230c0807aefd4d30d7d234 --- /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 8350ebc02c806cc740fe004835caa03e76195644..d7bf969652d6ed3d5e1b8e030b7d78cae37ee3da 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 0000000000000000000000000000000000000000..6f3aa47b1d1d7fc417230c0807aefd4d30d7d234 --- /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 f6740b728ec081ec1a16f1f45ec6a67daba73e29..93506140eb05188566c17ad04d29fe909502c539 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