diff --git a/CHANGELOG b/CHANGELOG index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..17639ffb2fc348d4c2747576f42ecad6ae6b0aca 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -0,0 +1,17 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.1.0] - 2018-08-22 + +### Added +- This fine changelog + +### Changed +- the structure of `src/nf_modules`: the `tests` folder was removed + +### Removed +- nothings + diff --git a/src/docker_modules/HTSeq/0.8.0/Dockerfile b/src/docker_modules/HTSeq/0.8.0/Dockerfile index c655738fea3d89292f9ef5a9068893aafb6f38a1..a786b8026f66e9538c543f79624325ccb75952c6 100644 --- a/src/docker_modules/HTSeq/0.8.0/Dockerfile +++ b/src/docker_modules/HTSeq/0.8.0/Dockerfile @@ -14,4 +14,5 @@ RUN apt-get update && \ apt-get clean RUN pip3 install numpy==1.14.3 +RUN pip3 install pysam==0.15.0 RUN pip3 install HTSeq==${HTSEQ_VERSION} diff --git a/src/docker_modules/RSEM/1.3.0/Dockerfile b/src/docker_modules/RSEM/1.3.0/Dockerfile index 1ccdaa74586943d175058c9c9c478e4c04bcdcec..337521c0496db33c93c20c8fd4d756efcba603a8 100644 --- a/src/docker_modules/RSEM/1.3.0/Dockerfile +++ b/src/docker_modules/RSEM/1.3.0/Dockerfile @@ -4,7 +4,7 @@ MAINTAINER Laurent Modolo ENV RSEM_VERSION=1.3.0 ENV BOWTIE2_VERSION=2.3.4.1 ENV SAMTOOLS_VERSION=1.7 -ENV PACKAGES git=1:2.17.0* \ +ENV PACKAGES git=1:2.17* \ build-essential=12.4* \ ca-certificates=20180409 \ zlib1g-dev=1:1.2.11* \ diff --git a/src/nf_modules/BEDtools/bedtools.config b/src/nf_modules/BEDtools/fasta_from_bed.config similarity index 100% rename from src/nf_modules/BEDtools/bedtools.config rename to src/nf_modules/BEDtools/fasta_from_bed.config diff --git a/src/nf_modules/BEDtools/bedtools.nf b/src/nf_modules/BEDtools/fasta_from_bed.nf similarity index 100% rename from src/nf_modules/BEDtools/bedtools.nf rename to src/nf_modules/BEDtools/fasta_from_bed.nf diff --git a/src/nf_modules/BEDtools/tests/tests.sh b/src/nf_modules/BEDtools/tests.sh similarity index 52% rename from src/nf_modules/BEDtools/tests/tests.sh rename to src/nf_modules/BEDtools/tests.sh index f27c274f45cdf0fab1003f81986d96b29f50fdc2..4d6bda0d6af5a39af1773b27f53018e509e18bf4 100755 --- a/src/nf_modules/BEDtools/tests/tests.sh +++ b/src/nf_modules/BEDtools/tests.sh @@ -1,5 +1,5 @@ -nextflow src/nf_modules/BEDtools/tests/fasta_from_bed.nf \ - -c src/nf_modules/BEDtools/bedtools.config \ +nextflow src/nf_modules/BEDtools/fasta_from_bed.nf \ + -c src/nf_modules/BEDtools/fasta_from_bed.config \ -profile docker \ --fasta "data/tiny_dataset/fasta/tiny_v2.fasta" \ --bed "data/tiny_dataset/annot/tiny.bed" \ diff --git a/src/nf_modules/BEDtools/tests/fasta_from_bed.nf b/src/nf_modules/BEDtools/tests/fasta_from_bed.nf deleted file mode 100644 index 372f89e958f5fcf9256c37000f86e6b552e31def..0000000000000000000000000000000000000000 --- a/src/nf_modules/BEDtools/tests/fasta_from_bed.nf +++ /dev/null @@ -1,33 +0,0 @@ -params.fastq = "$baseDir/data/fasta/*.fasta" -params.bed = "$baseDir/data/annot/*.bed" - -log.info "fasta file : ${params.fasta}" -log.info "bed file : ${params.bed}" - -Channel - .fromPath( params.fasta ) - .ifEmpty { error "Cannot find any fasta files matching: ${params.fasta}" } - .set { fasta_files } -Channel - .fromPath( params.bed ) - .ifEmpty { error "Cannot find any bed files matching: ${params.bed}" } - .set { bed_files } - -process fasta_from_bed { - tag "${bed.baseName}" - cpus 4 - publishDir "results/fasta/", mode: 'copy' - - input: - file fasta from fasta_files - file bed from bed_files - - output: - file "*_extracted.fasta" into fasta_files_extracted - - script: -""" -bedtools getfasta -name \ --fi ${fasta} -bed ${bed} -fo ${bed.baseName}_extracted.fasta -""" -} diff --git a/src/nf_modules/Bowtie/bowtie.nf b/src/nf_modules/Bowtie/bowtie.nf deleted file mode 100644 index 034476085d50e33aaede7777a20006b00efc7d65..0000000000000000000000000000000000000000 --- a/src/nf_modules/Bowtie/bowtie.nf +++ /dev/null @@ -1,138 +0,0 @@ -/* -* Bowtie : -* Imputs : fastq files -* Imputs : fasta files -* Output : bam files -*/ - -/* fasta indexing */ -params.fasta = "$baseDir/data/bam/*.fasta" - -log.info "fasta files : ${params.fasta}" - -Channel - .fromPath( params.fasta ) - .ifEmpty { error "Cannot find any bam files matching: ${params.fasta}" } - .set { fasta_file } - -process index_fasta { - tag "$fasta.baseName" - cpus 4 - publishDir "results/mapping/index/", mode: 'copy' - - input: - file fasta from fasta_file - - output: - file "*.index*" into index_files - file "*_report.txt" into indexing_report - - script: -""" -bowtie-build --threads ${task.cpus} -f ${fasta} ${fasta.baseName}.index &> ${fasta.baseName}_bowtie_report.txt - -if grep -q "Error" ${fasta.baseName}_bowtie_report.txt; then - exit 1 -fi -""" -} - - - -/* -* for paired-end data -*/ - -params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq" -params.index = "$baseDir/data/index/*.index.*" - -log.info "fastq files : ${params.fastq}" -log.info "index files : ${params.index}" - -Channel - .fromFilePairs( params.fastq ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } - .set { fastq_files } -Channel - .fromPath( params.index ) - .ifEmpty { error "Cannot find any index files matching: ${params.index}" } - .set { index_files } - -process mapping_fastq { - tag "$pair_id" - cpus 4 - publishDir "results/mapping/bams/", mode: 'copy' - - input: - set pair_id, file(reads) from fastq_files - file index from index_files.collect() - - output: - file "*.bam" into bam_files - file "*_report.txt" into mapping_report - - script: - index_id = index[0] - for (index_file in index) { - if (index_file =~ /.*\.1\.ebwt/ && !(index_file =~ /.*\.rev\.1\.ebwt/)) { - index_id = ( index_file =~ /(.*)\.1\.ebwt/)[0][1] - } - } -""" -# -v specify the max number of missmatch, -k the number of match reported per -# reads -bowtie --best -v 3 -k 1 --sam -p ${task.cpus} ${index_id} \ --1 ${reads[0]} -2 ${reads[1]} 2> \ -${pair_id}_bowtie_report.txt | \ -samtools view -Sb - > ${pair_id}.bam - -if grep -q "Error" ${pair_id}_bowtie_report.txt; then - exit 1 -fi -""" -} - - -/* -* for single-end data -*/ -params.mean = 200 -params.sd = 100 - -log.info "fastq files : ${params.fastq}" -log.info "index files : ${params.index}" -log.info "mean read size: ${params.mean}" -log.info "sd read size: ${params.sd}" - -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 ) - .ifEmpty { error "Cannot find any index files matching: ${params.index}" } - .set { index_files } - -process mapping_fastq { - tag "$file_id" - cpus 4 - publishDir "results/mapping/quantification/", mode: 'copy' - - input: - set file_id, file(reads) from fastq_files - file index from index_files.collect() - - output: - file "*" into count_files - - script: -""" -mkdir ${file_id} -kallisto quant -i ${index} -t ${task.cpus} --single \ ---bias --bootstrap-samples 100 -o ${file_id} \ --l ${params.mean} -s ${params.sd} \ -${reads} > ${file_id}_kallisto_report.txt -""" -} - diff --git a/src/nf_modules/Bowtie/indexing.config b/src/nf_modules/Bowtie/indexing.config new file mode 100644 index 0000000000000000000000000000000000000000..d5851003aa4c3c95b34eb78de95e20ff17aee390 --- /dev/null +++ b/src/nf_modules/Bowtie/indexing.config @@ -0,0 +1,18 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $index_fasta { + container = "bowtie:1.2.2" + } + } + } + sge { + process{ + $index_fasta { + beforeScript = "module purge; module load Bowtie/1.2.2" + } + } + } +} diff --git a/src/nf_modules/Bowtie/tests/index.nf b/src/nf_modules/Bowtie/indexing.nf similarity index 89% rename from src/nf_modules/Bowtie/tests/index.nf rename to src/nf_modules/Bowtie/indexing.nf index f9ee2ebae6d12a0b5233cdd7dbcdf25ae438e315..537d684b4bb39412eccfe31aec7c07d9312981d9 100644 --- a/src/nf_modules/Bowtie/tests/index.nf +++ b/src/nf_modules/Bowtie/indexing.nf @@ -1,3 +1,5 @@ +/* fasta indexing */ + params.fasta = "$baseDir/data/bam/*.fasta" log.info "fasta files : ${params.fasta}" diff --git a/src/nf_modules/Bowtie/bowtie.config b/src/nf_modules/Bowtie/mapping_paired.config similarity index 66% rename from src/nf_modules/Bowtie/bowtie.config rename to src/nf_modules/Bowtie/mapping_paired.config index 93fe4a452b094540aee8d76597779e2dd09c4bbf..86cc4bb7f3c6c553811f18ed64f03c003e4780ab 100644 --- a/src/nf_modules/Bowtie/bowtie.config +++ b/src/nf_modules/Bowtie/mapping_paired.config @@ -3,9 +3,6 @@ profiles { docker.temp = 'auto' docker.enabled = true process { - $index_fasta { - container = "bowtie:1.2.2" - } $mapping_fastq { container = "bowtie:1.2.2" } @@ -13,9 +10,6 @@ profiles { } sge { process{ - $index_fasta { - beforeScript = "module purge; module load Bowtie/1.2.2" - } $mapping_fastq { beforeScript = "module purge; module load SAMtools/1.7; module load Bowtie/1.2.2" } diff --git a/src/nf_modules/Bowtie/tests/mapping_paired.nf b/src/nf_modules/Bowtie/mapping_paired.nf similarity index 97% rename from src/nf_modules/Bowtie/tests/mapping_paired.nf rename to src/nf_modules/Bowtie/mapping_paired.nf index 600e295cc5be7935f88fdd72d4625e78afe1373a..cc9f40b265c61cf0609970fe7501d7267318cf9f 100644 --- a/src/nf_modules/Bowtie/tests/mapping_paired.nf +++ b/src/nf_modules/Bowtie/mapping_paired.nf @@ -1,3 +1,7 @@ +/* +* mapping paired fastq +*/ + params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq" params.index = "$baseDir/data/index/*.index.*" diff --git a/src/nf_modules/Bowtie/mapping_single.config b/src/nf_modules/Bowtie/mapping_single.config new file mode 100644 index 0000000000000000000000000000000000000000..86cc4bb7f3c6c553811f18ed64f03c003e4780ab --- /dev/null +++ b/src/nf_modules/Bowtie/mapping_single.config @@ -0,0 +1,18 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $mapping_fastq { + container = "bowtie:1.2.2" + } + } + } + sge { + process{ + $mapping_fastq { + beforeScript = "module purge; module load SAMtools/1.7; module load Bowtie/1.2.2" + } + } + } +} diff --git a/src/nf_modules/Bowtie/tests/mapping_single.nf b/src/nf_modules/Bowtie/mapping_single.nf similarity index 97% rename from src/nf_modules/Bowtie/tests/mapping_single.nf rename to src/nf_modules/Bowtie/mapping_single.nf index 6697681d0ac8922d96e3811daef3782fdb6002cd..ad9754d1545e1154e2fa9bf18bcfde065738723a 100644 --- a/src/nf_modules/Bowtie/tests/mapping_single.nf +++ b/src/nf_modules/Bowtie/mapping_single.nf @@ -1,3 +1,7 @@ +/* +* mapping single end fastq +*/ + params.fastq = "$baseDir/data/fastq/*.fastq" log.info "fastq files : ${params.fastq}" diff --git a/src/nf_modules/Bowtie/tests/tests.sh b/src/nf_modules/Bowtie/tests.sh similarity index 50% rename from src/nf_modules/Bowtie/tests/tests.sh rename to src/nf_modules/Bowtie/tests.sh index 3b67514975afe3eb7006952bce81cee992487a32..803f62814bc7d12e6b595b6a17ae9e96f684b6e2 100755 --- a/src/nf_modules/Bowtie/tests/tests.sh +++ b/src/nf_modules/Bowtie/tests.sh @@ -1,16 +1,16 @@ -./nextflow src/nf_modules/Bowtie/tests/index.nf \ - -c src/nf_modules/Bowtie/bowtie.config \ +./nextflow src/nf_modules/Bowtie/indexing.nf \ + -c src/nf_modules/Bowtie/indexing.config \ -profile docker \ --fasta "data/tiny_dataset/fasta/tiny_v2.fasta" -./nextflow src/nf_modules/Bowtie/tests/mapping_single.nf \ - -c src/nf_modules/Bowtie/bowtie.config \ +./nextflow src/nf_modules/Bowtie/mapping_single.nf \ + -c src/nf_modules/Bowtie/mapping_single.config \ -profile docker \ --index "results/mapping/index/*.ebwt" \ --fastq "data/tiny_dataset/fastq/tiny*_S.fastq" -./nextflow src/nf_modules/Bowtie/tests/mapping_paired.nf \ - -c src/nf_modules/Bowtie/bowtie.config \ +./nextflow src/nf_modules/Bowtie/mapping_paired.nf \ + -c src/nf_modules/Bowtie/mapping_paired.config \ -profile docker \ --index "results/mapping/index/*.ebwt" \ --fastq "data/tiny_dataset/fastq/tiny*_R{1,2}.fastq" diff --git a/src/nf_modules/Bowtie2/bowtie2.nf b/src/nf_modules/Bowtie2/bowtie2.nf deleted file mode 100644 index efee164247fb6fcfd9a983d8b70e84db6f271353..0000000000000000000000000000000000000000 --- a/src/nf_modules/Bowtie2/bowtie2.nf +++ /dev/null @@ -1,141 +0,0 @@ -/* -* Bowtie2 : -* Imputs : fastq files -* Imputs : fasta files -* Output : bam files -*/ - -/* fasta indexing */ -params.fasta = "$baseDir/data/bam/*.fasta" - -log.info "fasta files : ${params.fasta}" - -Channel - .fromPath( params.fasta ) - .ifEmpty { error "Cannot find any bam files matching: ${params.fasta}" } - .set { fasta_file } - -process index_fasta { - tag "$fasta.baseName" - cpus 4 - publishDir "results/mapping/index/", mode: 'copy' - - input: - file fasta from fasta_file - - output: - file "*.index*" into index_files - file "*_report.txt" into indexing_report - - script: -""" -bowtie2-build --threads ${task.cpus} ${fasta} ${fasta.baseName}.index &> ${fasta.baseName}_bowtie2_report.txt - -if grep -q "Error" ${fasta.baseName}_bowtie2_report.txt; then - exit 1 -fi -""" -} - - -/* -* for paired-end data -*/ - -params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq" -params.index = "$baseDir/data/index/*.index.*" - -log.info "fastq files : ${params.fastq}" -log.info "index files : ${params.index}" - -Channel - .fromFilePairs( params.fastq ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } - .set { fastq_files } -Channel - .fromPath( params.index ) - .ifEmpty { error "Cannot find any index files matching: ${params.index}" } - .set { index_files } - -process mapping_fastq { - tag "$pair_id" - cpus 4 - publishDir "results/mapping/bams/", mode: 'copy' - - input: - set pair_id, file(reads) from fastq_files - file index from index_files.collect() - - output: - set pair_id, "*.bam" into bam_files - file "*_report.txt" into mapping_report - - 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] - } - } -""" -bowtie2 --very-sensitive -p ${task.cpus} -x ${index_id} \ --1 ${reads[0]} -2 ${reads[1]} 2> \ -${pair_id}_bowtie2_report.txt | \ -samtools view -Sb - > ${pair_id}.bam - -if grep -q "Error" ${pair_id}_bowtie2_report.txt; then - exit 1 -fi -""" -} - -/* -* for single-end data -*/ - -params.fastq = "$baseDir/data/fastq/*.fastq" - -log.info "fastq files : ${params.fastq}" -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 ) - .ifEmpty { error "Cannot find any index files matching: ${params.index}" } - .set { index_files } - -process mapping_fastq { - tag "$file_id" - cpus 4 - publishDir "results/mapping/bams/", mode: 'copy' - - input: - set file_id, file(reads) from fastq_files - file index from index_files.collect() - - output: - set file_id, "*.bam" into bam_files - file "*_report.txt" into mapping_report - - 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] - } - } -""" -bowtie2 --very-sensitive -p ${task.cpus} -x ${index_id} \ --U ${reads} 2> \ -${file_id}_bowtie2_report.txt | \ -samtools view -Sb - > ${file_id}.bam - -if grep -q "Error" ${file_id}_bowtie2_report.txt; then - exit 1 -fi -""" -} diff --git a/src/nf_modules/Bowtie2/indexing.config b/src/nf_modules/Bowtie2/indexing.config new file mode 100644 index 0000000000000000000000000000000000000000..60f60547c31e5c6fea842e3c798940a2ba6b98c5 --- /dev/null +++ b/src/nf_modules/Bowtie2/indexing.config @@ -0,0 +1,18 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $index_fasta { + container = "bowtie2:2.3.4.1" + } + } + } + sge { + process{ + $index_fasta { + beforeScript = "module purge; module load Bowtie2/2.3.4.1" + } + } + } +} diff --git a/src/nf_modules/Bowtie2/tests/index.nf b/src/nf_modules/Bowtie2/indexing.nf similarity index 100% rename from src/nf_modules/Bowtie2/tests/index.nf rename to src/nf_modules/Bowtie2/indexing.nf diff --git a/src/nf_modules/Bowtie2/bowtie2.config b/src/nf_modules/Bowtie2/mapping_paired.config similarity index 66% rename from src/nf_modules/Bowtie2/bowtie2.config rename to src/nf_modules/Bowtie2/mapping_paired.config index e34b42f06980b9d1ac941fe184a899f2081f1ece..a8cd2991e8775c96045263645cf98079002275b1 100644 --- a/src/nf_modules/Bowtie2/bowtie2.config +++ b/src/nf_modules/Bowtie2/mapping_paired.config @@ -3,9 +3,6 @@ profiles { docker.temp = 'auto' docker.enabled = true process { - $index_fasta { - container = "bowtie2:2.3.4.1" - } $mapping_fastq { container = "bowtie2:2.3.4.1" } @@ -13,9 +10,6 @@ profiles { } sge { process{ - $index_fasta { - beforeScript = "module purge; module load Bowtie2/2.3.4.1" - } $mapping_fastq { beforeScript = "module purge; module load SAMtools/1.7; module load Bowtie2/2.3.4.1" } diff --git a/src/nf_modules/Bowtie2/tests/mapping_paired.nf b/src/nf_modules/Bowtie2/mapping_paired.nf similarity index 100% rename from src/nf_modules/Bowtie2/tests/mapping_paired.nf rename to src/nf_modules/Bowtie2/mapping_paired.nf diff --git a/src/nf_modules/Bowtie2/mapping_single.config b/src/nf_modules/Bowtie2/mapping_single.config new file mode 100644 index 0000000000000000000000000000000000000000..a8cd2991e8775c96045263645cf98079002275b1 --- /dev/null +++ b/src/nf_modules/Bowtie2/mapping_single.config @@ -0,0 +1,18 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $mapping_fastq { + container = "bowtie2:2.3.4.1" + } + } + } + sge { + process{ + $mapping_fastq { + beforeScript = "module purge; module load SAMtools/1.7; module load Bowtie2/2.3.4.1" + } + } + } +} diff --git a/src/nf_modules/Bowtie2/tests/mapping_single.nf b/src/nf_modules/Bowtie2/mapping_single.nf similarity index 100% rename from src/nf_modules/Bowtie2/tests/mapping_single.nf rename to src/nf_modules/Bowtie2/mapping_single.nf diff --git a/src/nf_modules/Bowtie2/tests/tests.sh b/src/nf_modules/Bowtie2/tests.sh similarity index 50% rename from src/nf_modules/Bowtie2/tests/tests.sh rename to src/nf_modules/Bowtie2/tests.sh index 1db702ab757feb73a097de828f9ca17a2006edfd..ab1483824cd1f9755d09495cd050c45cc4a82d30 100755 --- a/src/nf_modules/Bowtie2/tests/tests.sh +++ b/src/nf_modules/Bowtie2/tests.sh @@ -1,16 +1,16 @@ -./nextflow src/nf_modules/Bowtie2/tests/index.nf \ - -c src/nf_modules/Bowtie2/bowtie2.config \ +./nextflow src/nf_modules/Bowtie2/indexing.nf \ + -c src/nf_modules/Bowtie2/indexing.config \ -profile docker \ --fasta "data/tiny_dataset/fasta/tiny_v2.fasta" -./nextflow src/nf_modules/Bowtie2/tests/mapping_single.nf \ - -c src/nf_modules/Bowtie2/bowtie2.config \ +./nextflow src/nf_modules/Bowtie2/mapping_single.nf \ + -c src/nf_modules/Bowtie2/mapping_single.config \ -profile docker \ --index "data/tiny_dataset/fasta/*.bt2" \ --fastq "data/tiny_dataset/fastq/tiny*_S.fastq" -./nextflow src/nf_modules/Bowtie2/tests/mapping_paired.nf \ - -c src/nf_modules/Bowtie2/bowtie2.config \ +./nextflow src/nf_modules/Bowtie2/mapping_paired.nf \ + -c src/nf_modules/Bowtie2/mapping_paired.config \ -profile docker \ --index "data/tiny_dataset/fasta/*.bt2" \ --fastq "data/tiny_dataset/fastq/tiny*_R{1,2}.fastq" diff --git a/src/nf_modules/FastQC/fastqc.nf b/src/nf_modules/FastQC/fastqc.nf deleted file mode 100644 index 6e90d454d8b2da66882af7c5c99e537aca0cebd8..0000000000000000000000000000000000000000 --- a/src/nf_modules/FastQC/fastqc.nf +++ /dev/null @@ -1,71 +0,0 @@ -/* -* fastqc : -* Imputs : fastq files -* Output : pdf files -*/ - -/* fastQC */ - - -/* -* for single-end data -*/ - -params.fastq = "$baseDir/data/fastq/*.fastq" - -log.info "fastq files : ${params.fastq}" - -Channel - .fromPath( params.fastq ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } - .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]} - .set { fastq_files } - -process fastqc_fastq { - tag "$file_id" - publishDir "results/fastq/fastqc/", mode: 'copy' - cpus = 1 - - input: - set file_id, file(reads) from fastq_files - - output: - file "*.{zip,html}" into fastqc_report - - script: -""" -fastqc --quiet --threads ${task.cpus} --format fastq --outdir ./ ${reads} -""" -} - - -/* -* for paired-end data -*/ - -params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq" - -log.info "fastq files : ${params.fastq}" - -Channel - .fromFilePairs( params.fastq ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } - .set { fastq_files } - -process fastqc_fastq { - tag "$pair_id" - publishDir "results/fastq/fastqc/", mode: 'copy' - - input: - set pair_id, file(reads) from fastq_files - - output: - file "*.{zip,html}" into fastqc_report - - script: -""" -fastqc --quiet --threads ${task.cpus} --format fastq --outdir ./ \ -${reads[0]} ${reads[1]} -""" -} - diff --git a/src/nf_modules/FastQC/fastqc.config b/src/nf_modules/FastQC/fastqc_paired.config similarity index 100% rename from src/nf_modules/FastQC/fastqc.config rename to src/nf_modules/FastQC/fastqc_paired.config diff --git a/src/nf_modules/FastQC/tests/fastqc_paired.nf b/src/nf_modules/FastQC/fastqc_paired.nf similarity index 100% rename from src/nf_modules/FastQC/tests/fastqc_paired.nf rename to src/nf_modules/FastQC/fastqc_paired.nf diff --git a/src/nf_modules/FastQC/fastqc_single.config b/src/nf_modules/FastQC/fastqc_single.config new file mode 100644 index 0000000000000000000000000000000000000000..a6589845aa98db0b4f6eaa663246db2604eb210b --- /dev/null +++ b/src/nf_modules/FastQC/fastqc_single.config @@ -0,0 +1,25 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $fastqc_fastq { + container = "fastqc:0.11.5" + } + } + } + sge { + process{ + $fastqc_fastq { + beforeScript = "module purge; module load FastQC/0.11.5" + executor = "sge" + cpus = 1 + memory = "5GB" + time = "6h" + queueSize = 1000 + pollInterval = '60sec' + queue = 'monointeldeb128' + } + } + } +} diff --git a/src/nf_modules/FastQC/tests/fastqc_single.nf b/src/nf_modules/FastQC/fastqc_single.nf similarity index 100% rename from src/nf_modules/FastQC/tests/fastqc_single.nf rename to src/nf_modules/FastQC/fastqc_single.nf diff --git a/src/nf_modules/FastQC/tests.sh b/src/nf_modules/FastQC/tests.sh new file mode 100755 index 0000000000000000000000000000000000000000..b103ac74f468c5b65c398b784b9e66a0e7d669d4 --- /dev/null +++ b/src/nf_modules/FastQC/tests.sh @@ -0,0 +1,9 @@ +nextflow src/nf_modules/FastQC/fastqc_paired.nf \ + -c src/nf_modules/FastQC/fastqc_paired.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" + +nextflow src/nf_modules/FastQC/fastqc_single.nf \ + -c src/nf_modules/FastQC/fastqc_single.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny_S.fastq" diff --git a/src/nf_modules/FastQC/tests/tests.sh b/src/nf_modules/FastQC/tests/tests.sh deleted file mode 100755 index 147503b411bd0232f064c76fb75c1a45533a0e79..0000000000000000000000000000000000000000 --- a/src/nf_modules/FastQC/tests/tests.sh +++ /dev/null @@ -1,9 +0,0 @@ -nextflow src/nf_modules/FastQC/tests/fastqc_paired.nf \ - -c src/nf_modules/FastQC/fastqc.config \ - -profile docker \ - --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" - -nextflow src/nf_modules/FastQC/tests/fastqc_single.nf \ - -c src/nf_modules/FastQC/fastqc.config \ - -profile docker \ - --fastq "data/tiny_dataset/fastq/tiny_S.fastq" diff --git a/src/nf_modules/HTSeq/htseq.config b/src/nf_modules/HTSeq/htseq.config index ab3cc3a268f8c3d0f0233beb184c2ace5d9b7031..00f2fafb921828b21fe18d57240b9a943dcd2fb9 100644 --- a/src/nf_modules/HTSeq/htseq.config +++ b/src/nf_modules/HTSeq/htseq.config @@ -3,6 +3,9 @@ profiles { docker.temp = 'auto' docker.enabled = true process { + $sort_bam { + container = "samtools:1.7" + } $counting { container = "htseq:0.8.0" } @@ -10,6 +13,9 @@ profiles { } sge { process{ + $sort_bam { + beforeScript = "module purge; module load SAMtools/1.7" + } $trimming { beforeScript = "module purge; module load HTSeq/0.8.0" } diff --git a/src/nf_modules/HTSeq/htseq.nf b/src/nf_modules/HTSeq/htseq.nf index 5aa2f739bd64381724450640e9828a0b4fce1494..7cade9a55b17ced135f32a36ffd90dc5354b72af 100644 --- a/src/nf_modules/HTSeq/htseq.nf +++ b/src/nf_modules/HTSeq/htseq.nf @@ -1,11 +1,3 @@ -/* -* htseq : -* Imputs : sorted bams files -* Imputs : gtf -* Output : counts files -*/ -/* quality trimming */ - params.bam = "$baseDir/data/bam/*.bam" params.gtf = "$baseDir/data/annotation/*.gtf" @@ -15,18 +7,36 @@ log.info "gtf files : ${params.gtf}" Channel .fromPath( params.bam ) .ifEmpty { error "Cannot find any fastq files matching: ${params.bam}" } + .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]} .set { bam_files } Channel .fromPath( params.gtf ) .ifEmpty { error "Cannot find any gtf file matching: ${params.gtf}" } .set { gtf_file } +process sort_bam { + tag "$file_id" + cpus 4 + + input: + set file_id, file(bam) from bam_files + + output: + set file_id, "*_sorted.sam" into sorted_bam_files + + script: +""" +# sort bam by name +samtools sort -@ ${task.cpus} -n -O SAM -o ${file_id}_sorted.sam ${bam} +""" +} + process counting { - tag "$bam.baseName" + tag "$file_id" publishDir "results/quantification/", mode: 'copy' input: - file bam from bam_files + set file_id, file(bam) from sorted_bam_files file gtf from gtf_file output: @@ -34,7 +44,9 @@ process counting { script: """ -htseq-count -r pos --mode=intersection-nonempty -a 10 -s no -t exon -i gene_id \ ---format=bam ${bam} ${gtf} > ${bam.baseName}.count +htseq-count ${bam} ${gtf} \ +-r pos --mode=intersection-nonempty -a 10 -s no -t exon -i gene_id \ +> ${file_id}.count """ } + diff --git a/src/nf_modules/HTSeq/tests/tests.sh b/src/nf_modules/HTSeq/tests.sh similarity index 75% rename from src/nf_modules/HTSeq/tests/tests.sh rename to src/nf_modules/HTSeq/tests.sh index 7ccef1815eb2f2e430095f764230160b26be85a6..f7255c2384d1b84e1f301c9494834954f8daa621 100755 --- a/src/nf_modules/HTSeq/tests/tests.sh +++ b/src/nf_modules/HTSeq/tests.sh @@ -1,4 +1,4 @@ -nextflow src/nf_modules/HTSeq/tests/counting.nf \ +nextflow src/nf_modules/HTSeq/htseq.nf \ -c src/nf_modules/HTSeq/htseq.config \ -profile docker \ --gtf "data/tiny_dataset/annot/tiny.gff" \ diff --git a/src/nf_modules/HTSeq/tests/counting.nf b/src/nf_modules/HTSeq/tests/counting.nf deleted file mode 100644 index f11736b1443f36e13b1986518f5de1c9187ca62e..0000000000000000000000000000000000000000 --- a/src/nf_modules/HTSeq/tests/counting.nf +++ /dev/null @@ -1,33 +0,0 @@ -params.bam = "$baseDir/data/bam/*.bam" -params.gtf = "$baseDir/data/annotation/*.gtf" - -log.info "bam files : ${params.bam}" -log.info "gtf files : ${params.gtf}" - -Channel - .fromPath( params.bam ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.bam}" } - .set { bam_files } -Channel - .fromPath( params.gtf ) - .ifEmpty { error "Cannot find any gtf file matching: ${params.gtf}" } - .set { gtf_file } - -process counting { - tag "$bam.baseName" - publishDir "results/quantification/", mode: 'copy' - - input: - file bam from bam_files - file gtf from gtf_file - - output: - file "*.count" into count_files - - script: -""" -htseq-count -r pos --mode=intersection-nonempty -a 10 -s no -t exon -i gene_id \ ---format=bam ${bam} ${gtf} > ${bam.baseName}.count -""" -} - diff --git a/src/nf_modules/Kallisto/indexing.config b/src/nf_modules/Kallisto/indexing.config new file mode 100644 index 0000000000000000000000000000000000000000..94c14cd210981318ff555888b96f3c43796a9c66 --- /dev/null +++ b/src/nf_modules/Kallisto/indexing.config @@ -0,0 +1,26 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $index_fasta { + container = "kallisto:0.44.0" + } + } + } + sge { + process{ + $index_fasta { + beforeScript = "module purge; module load Kallisto/0.44.0" + executor = "sge" + cpus = 1 + memory = "5GB" + time = "6h" + queueSize = 1000 + pollInterval = '60sec' + queue = 'h6-E5-2667v4deb128' + penv = 'openmp8' + } + } + } +} diff --git a/src/nf_modules/Kallisto/tests/index.nf b/src/nf_modules/Kallisto/indexing.nf similarity index 83% rename from src/nf_modules/Kallisto/tests/index.nf rename to src/nf_modules/Kallisto/indexing.nf index cae4bb03384a919d998562aeefe98c9b1557fea3..9e38260f87e9bfa4384b69ef440c73acb6feba05 100644 --- a/src/nf_modules/Kallisto/tests/index.nf +++ b/src/nf_modules/Kallisto/indexing.nf @@ -17,11 +17,12 @@ process index_fasta { output: file "*.index*" into index_files + file "*_kallisto_report.txt" into index_files_report script: """ kallisto index -k 31 --make-unique -i ${fasta.baseName}.index ${fasta} \ -> ${fasta.baseName}_kallisto_report.txt +2> ${fasta.baseName}_kallisto_report.txt """ } diff --git a/src/nf_modules/Kallisto/kallisto.nf b/src/nf_modules/Kallisto/kallisto.nf deleted file mode 100644 index ae6b6b71a524d49bf4f9c1ff9db8517c4c80de01..0000000000000000000000000000000000000000 --- a/src/nf_modules/Kallisto/kallisto.nf +++ /dev/null @@ -1,123 +0,0 @@ -/* -* Kallisto : -* Imputs : fastq files -* Imputs : fasta files -* Output : bam files -*/ - -/* fasta indexing */ -params.fasta = "$baseDir/data/bam/*.fasta" - -log.info "fasta files : ${params.fasta}" - -Channel - .fromPath( params.fasta ) - .ifEmpty { error "Cannot find any fasta files matching: ${params.fasta}" } - .set { fasta_file } - -process index_fasta { - tag "$fasta.baseName" - publishDir "results/mapping/index/", mode: 'copy' - - input: - file fasta from fasta_file - - output: - file "*.index*" into index_files - - script: -""" -kallisto index -k 31 --make-unique -i ${fasta.baseName}.index ${fasta} \ -> ${fasta.baseName}_kallisto_report.txt -""" -} - - -/* -* for paired-end data -*/ - -params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq" -params.index = "$baseDir/data/index/*.index.*" - -log.info "fastq files : ${params.fastq}" -log.info "index files : ${params.index}" - -Channel - .fromFilePairs( params.fastq ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } - .set { fastq_files } -Channel - .fromPath( params.index ) - .ifEmpty { error "Cannot find any index files matching: ${params.index}" } - .set { index_files } - -process mapping_fastq { - tag "$reads" - cpus 4 - publishDir "results/mapping/quantification/", mode: 'copy' - - input: - set pair_id, file(reads) from fastq_files - file index from index_files.collect() - - output: - file "*" into counts_files - - script: -""" -mkdir ${reads[0].baseName} -kallisto quant -i ${index} -t ${task.cpus} \ ---bias --bootstrap-samples 100 -o ${pair_id} \ -${reads[0]} ${reads[1]} &> ${pair_id}_kallisto_report.txt -""" -} - - -/* -* for single-end data -*/ - -params.fastq = "$baseDir/data/fastq/*.fastq" -params.index = "$baseDir/data/index/*.index*" -params.mean = 200 -params.sd = 100 - -log.info "fastq files : ${params.fastq}" -log.info "index files : ${params.index}" -log.info "mean read size: ${params.mean}" -log.info "sd read size: ${params.sd}" - -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 ) - .ifEmpty { error "Cannot find any index files matching: ${params.index}" } - .set { index_files } - -process mapping_fastq { - tag "$file_id" - cpus 4 - publishDir "results/mapping/quantification/", mode: 'copy' - - input: - set file_id, file(reads) from fastq_files - file index from index_files.collect() - - output: - file "*" into count_files - - script: -""" -mkdir ${file_id} -kallisto quant -i ${index} -t ${task.cpus} --single \ ---bias --bootstrap-samples 100 -o ${file_id} \ --l ${params.mean} -s ${params.sd} \ -${reads} > ${file_id}_kallisto_report.txt -""" -} - - diff --git a/src/nf_modules/Kallisto/kallisto.config b/src/nf_modules/Kallisto/mapping_paired.config similarity index 57% rename from src/nf_modules/Kallisto/kallisto.config rename to src/nf_modules/Kallisto/mapping_paired.config index da7f54e0dfa345ef1b599ce328ceca40747dd9c6..de674527ae0735b3797dc69fe7ae90b6557e1fa1 100644 --- a/src/nf_modules/Kallisto/kallisto.config +++ b/src/nf_modules/Kallisto/mapping_paired.config @@ -3,9 +3,6 @@ profiles { docker.temp = 'auto' docker.enabled = true process { - $index_fasta { - container = "kallisto:0.44.0" - } $mapping_fastq { container = "kallisto:0.44.0" } @@ -13,17 +10,6 @@ profiles { } sge { process{ - $index_fasta { - beforeScript = "module purge; module load Kallisto/0.44.0" - executor = "sge" - cpus = 1 - memory = "5GB" - time = "6h" - queueSize = 1000 - pollInterval = '60sec' - queue = 'h6-E5-2667v4deb128' - penv = 'openmp8' - } $mapping_fastq { beforeScript = "module purge; module load Kallisto/0.44.0" executor = "sge" diff --git a/src/nf_modules/Kallisto/tests/mapping_paired.nf b/src/nf_modules/Kallisto/mapping_paired.nf similarity index 100% rename from src/nf_modules/Kallisto/tests/mapping_paired.nf rename to src/nf_modules/Kallisto/mapping_paired.nf diff --git a/src/nf_modules/Kallisto/mapping_single.config b/src/nf_modules/Kallisto/mapping_single.config new file mode 100644 index 0000000000000000000000000000000000000000..de674527ae0735b3797dc69fe7ae90b6557e1fa1 --- /dev/null +++ b/src/nf_modules/Kallisto/mapping_single.config @@ -0,0 +1,26 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $mapping_fastq { + container = "kallisto:0.44.0" + } + } + } + sge { + process{ + $mapping_fastq { + beforeScript = "module purge; module load Kallisto/0.44.0" + executor = "sge" + cpus = 4 + memory = "5GB" + time = "6h" + queueSize = 1000 + pollInterval = '60sec' + queue = 'h6-E5-2667v4deb128' + penv = 'openmp8' + } + } + } +} diff --git a/src/nf_modules/Kallisto/tests/mapping_single.nf b/src/nf_modules/Kallisto/mapping_single.nf similarity index 100% rename from src/nf_modules/Kallisto/tests/mapping_single.nf rename to src/nf_modules/Kallisto/mapping_single.nf diff --git a/src/nf_modules/Kallisto/tests/tests.sh b/src/nf_modules/Kallisto/tests.sh similarity index 50% rename from src/nf_modules/Kallisto/tests/tests.sh rename to src/nf_modules/Kallisto/tests.sh index f83a4cacb2caaa66490b00ba224205af13e92967..ec20292ef0260d8a311c4ba5c0058d28a2c476e4 100755 --- a/src/nf_modules/Kallisto/tests/tests.sh +++ b/src/nf_modules/Kallisto/tests.sh @@ -1,16 +1,16 @@ -nextflow src/nf_modules/Kallisto/tests/index.nf \ - -c src/nf_modules/Kallisto/kallisto.config \ +nextflow src/nf_modules/Kallisto/indexing.nf \ + -c src/nf_modules/Kallisto/indexing.config \ -profile docker \ --fasta "data/tiny_dataset/fasta/tiny_v2.fasta" -nextflow src/nf_modules/Kallisto/tests/mapping_single.nf \ - -c src/nf_modules/Kallisto/kallisto.config \ +nextflow src/nf_modules/Kallisto/mapping_single.nf \ + -c src/nf_modules/Kallisto/mapping_single.config \ -profile docker \ --index "results/mapping/index/tiny_v2.index" \ --fastq "data/tiny_dataset/fastq/tiny*_S.fastq" -nextflow src/nf_modules/Kallisto/tests/mapping_paired.nf \ - -c src/nf_modules/Kallisto/kallisto.config \ +nextflow src/nf_modules/Kallisto/mapping_paired.nf \ + -c src/nf_modules/Kallisto/mapping_paired.config \ -profile docker \ --index "results/mapping/index/tiny_v2.index" \ --fastq "data/tiny_dataset/fastq/tiny*_R{1,2}.fastq" diff --git a/src/nf_modules/MultiQC/multiqc.nf b/src/nf_modules/MultiQC/multiqc.nf deleted file mode 100644 index b64d7f6a20014893f6ad32bc47606e1cfb874f6f..0000000000000000000000000000000000000000 --- a/src/nf_modules/MultiQC/multiqc.nf +++ /dev/null @@ -1,25 +0,0 @@ -/* -* multiqc : -* Imputs : report files -* Output : multiqc report -*/ - -/* MultiQC */ - -process multiqc { - tag "$report.baseName" - publishDir "results/fastq/multiqc/", mode: 'copy' - cpus = 1 - - input: - file report from fastqc_report.collect() - - output: - file "*multiqc_*" into multiqc_report - - script: -""" -multiqc -f . -""" -} - diff --git a/src/nf_modules/MultiQC/multiqc.config b/src/nf_modules/MultiQC/multiqc_paired.config similarity index 100% rename from src/nf_modules/MultiQC/multiqc.config rename to src/nf_modules/MultiQC/multiqc_paired.config diff --git a/src/nf_modules/MultiQC/tests/multiqc_paired.nf b/src/nf_modules/MultiQC/multiqc_paired.nf similarity index 100% rename from src/nf_modules/MultiQC/tests/multiqc_paired.nf rename to src/nf_modules/MultiQC/multiqc_paired.nf diff --git a/src/nf_modules/MultiQC/multiqc_single.config b/src/nf_modules/MultiQC/multiqc_single.config new file mode 100644 index 0000000000000000000000000000000000000000..c1bda95e70a612c7caf4825930e740faedd1c62d --- /dev/null +++ b/src/nf_modules/MultiQC/multiqc_single.config @@ -0,0 +1,38 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $fastqc_fastq { + container = "fastqc:0.11.5" + } + $multiqc { + container = "multiqc:1.0" + } + } + } + sge { + process{ + $fastqc_fastq { + beforeScript = "module purge; module load FastQC/0.11.5" + executor = "sge" + cpus = 1 + memory = "5GB" + time = "6h" + queueSize = 1000 + pollInterval = '60sec' + queue = 'monointeldeb128' + } + $multiqc { + beforeScript = "module purge; module load FastQC/1.0" + executor = "sge" + cpus = 1 + memory = "5GB" + time = "6h" + queueSize = 1000 + pollInterval = '60sec' + queue = 'monointeldeb128' + } + } + } +} diff --git a/src/nf_modules/MultiQC/tests/multiqc_single.nf b/src/nf_modules/MultiQC/multiqc_single.nf similarity index 100% rename from src/nf_modules/MultiQC/tests/multiqc_single.nf rename to src/nf_modules/MultiQC/multiqc_single.nf diff --git a/src/nf_modules/MultiQC/tests.sh b/src/nf_modules/MultiQC/tests.sh new file mode 100755 index 0000000000000000000000000000000000000000..40b6522e2eb0f8abf2f6ea0be4b0903960beedcf --- /dev/null +++ b/src/nf_modules/MultiQC/tests.sh @@ -0,0 +1,9 @@ +nextflow src/nf_modules/MultiQC/multiqc_paired.nf \ + -c src/nf_modules/MultiQC/multiqc_paired.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" + +nextflow src/nf_modules/MultiQC/multiqc_single.nf \ + -c src/nf_modules/MultiQC/multiqc_single.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny_S.fastq" diff --git a/src/nf_modules/MultiQC/tests/tests.sh b/src/nf_modules/MultiQC/tests/tests.sh deleted file mode 100755 index 8aaa83c1e1eed5d173efd0b62fad37a5173734db..0000000000000000000000000000000000000000 --- a/src/nf_modules/MultiQC/tests/tests.sh +++ /dev/null @@ -1,9 +0,0 @@ -nextflow src/nf_modules/MultiQC/tests/multiqc_paired.nf \ - -c src/nf_modules/MultiQC/multiqc.config \ - -profile docker \ - --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" - -nextflow src/nf_modules/MultiQC/tests/multiqc_single.nf \ - -c src/nf_modules/MultiQC/multiqc.config \ - -profile docker \ - --fastq "data/tiny_dataset/fastq/tiny_S.fastq" diff --git a/src/nf_modules/RSEM/indexing.config b/src/nf_modules/RSEM/indexing.config new file mode 100644 index 0000000000000000000000000000000000000000..ddf93b6ec57c876681fc508a737b3287e20fdd61 --- /dev/null +++ b/src/nf_modules/RSEM/indexing.config @@ -0,0 +1,18 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $index_fasta { + container = "rsem:1.3.0" + } + } + } + sge { + process{ + $index_fasta { + beforeScript = "module purge; module load RSEM/1.3.0; module load SAMtools/1.7" + } + } + } +} diff --git a/src/nf_modules/RSEM/tests/index.nf b/src/nf_modules/RSEM/indexing.nf similarity index 100% rename from src/nf_modules/RSEM/tests/index.nf rename to src/nf_modules/RSEM/indexing.nf diff --git a/src/nf_modules/RSEM/rsem.config b/src/nf_modules/RSEM/quantification_paired.config similarity index 63% rename from src/nf_modules/RSEM/rsem.config rename to src/nf_modules/RSEM/quantification_paired.config index 3209b6bcd480b36b1f5e48a1055db2cc8fc93e93..344ab1e30497454826a5e45537f0e8182fb8dc63 100644 --- a/src/nf_modules/RSEM/rsem.config +++ b/src/nf_modules/RSEM/quantification_paired.config @@ -3,9 +3,6 @@ profiles { docker.temp = 'auto' docker.enabled = true process { - $index_fasta { - container = "rsem:1.3.0" - } $mapping_fastq { container = "rsem:1.3.0" } @@ -13,9 +10,6 @@ profiles { } sge { process{ - $index_fasta { - beforeScript = "module purge; module load RSEM/1.3.0; module load SAMtools/1.7" - } $mapping_fastq { beforeScript = "module purge; module load RSEM/1.3.0; module load SAMtools/1.7" } diff --git a/src/nf_modules/RSEM/tests/quantification_paired.nf b/src/nf_modules/RSEM/quantification_paired.nf similarity index 68% rename from src/nf_modules/RSEM/tests/quantification_paired.nf rename to src/nf_modules/RSEM/quantification_paired.nf index 0109500908f61159c5426b35c7dcb1a02fb60022..a22950fd2b4a0548ea7a45bc0a0965992246047f 100644 --- a/src/nf_modules/RSEM/tests/quantification_paired.nf +++ b/src/nf_modules/RSEM/quantification_paired.nf @@ -20,20 +20,29 @@ process mapping_fastq { input: set pair_id, file(reads) from fastq_files - file index from index_files.collect() + file index from index_files.toList() output: file "*" into counts_files script: -index_name = (index[0].baseName =~ /(.*)\.\d/)[0][1] + 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] + } + } """ rsem-calculate-expression --bowtie2 \ --bowtie2-path \$(which bowtie2 | sed 's/bowtie2\$//g') \ --bowtie2-sensitivity-level "very_sensitive" \ -output-genome-bam -p ${task.cpus} \ ---paired-end ${reads[0]} ${reads[1]} ${index_name} ${pair_id} \ -> ${pair_id}_rsem_bowtie2_report.txt +--paired-end ${reads[0]} ${reads[1]} ${index_id} ${pair_id} \ +2> ${pair_id}_rsem_bowtie2_report.txt + +if grep -q "Error" ${pair_id}_rsem_bowtie2_report.txt; then + exit 1 +fi """ } diff --git a/src/nf_modules/RSEM/quantification_single.config b/src/nf_modules/RSEM/quantification_single.config new file mode 100644 index 0000000000000000000000000000000000000000..344ab1e30497454826a5e45537f0e8182fb8dc63 --- /dev/null +++ b/src/nf_modules/RSEM/quantification_single.config @@ -0,0 +1,18 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $mapping_fastq { + container = "rsem:1.3.0" + } + } + } + sge { + process{ + $mapping_fastq { + beforeScript = "module purge; module load RSEM/1.3.0; module load SAMtools/1.7" + } + } + } +} diff --git a/src/nf_modules/RSEM/tests/quantification_single.nf b/src/nf_modules/RSEM/quantification_single.nf similarity index 72% rename from src/nf_modules/RSEM/tests/quantification_single.nf rename to src/nf_modules/RSEM/quantification_single.nf index 47e0047f7a1bbc53d629685ffe4166086cb14c35..d52b7f446049abac081b5a17f2202909f070e600 100644 --- a/src/nf_modules/RSEM/tests/quantification_single.nf +++ b/src/nf_modules/RSEM/quantification_single.nf @@ -1,6 +1,6 @@ params.fastq = "$baseDir/data/fastq/*.fastq" params.index = "$baseDir/data/index/*.index*" -params.mean = 125 +params.mean = 200 params.sd = 100 log.info "fastq files : ${params.fastq}" @@ -25,21 +25,31 @@ process mapping_fastq { input: set file_id, file(reads) from fastq_files - file index from index_files.collect() + file index from index_files.toList() output: file "*" into count_files script: -index_name = (index[0].baseName =~ /(.*)\.\d/)[0][1] + 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] + } + } """ +ls -l rsem-calculate-expression --bowtie2 \ --bowtie2-path \$(which bowtie2 | sed 's/bowtie2\$//g') \ --bowtie2-sensitivity-level "very_sensitive" \ --fragment-length-mean ${params.mean} --fragment-length-sd ${params.sd} \ --output-genome-bam -p ${task.cpus} \ -${reads} ${index_name} ${file_id} \ -> ${reads.baseName}_rsem_bowtie2_report.txt +${reads} ${index_id} ${file_id} \ +2> ${file_id}_rsem_bowtie2_report.txt + +if grep -q "Error" ${file_id}_rsem_bowtie2_report.txt; then + exit 1 +fi """ } diff --git a/src/nf_modules/RSEM/rsem.nf b/src/nf_modules/RSEM/rsem.nf deleted file mode 100644 index aa2fc957e8b547f23106b677692ea76501eeedc2..0000000000000000000000000000000000000000 --- a/src/nf_modules/RSEM/rsem.nf +++ /dev/null @@ -1,140 +0,0 @@ -/* -* RSEM : -* Imputs : fastq files -* Imputs : fasta files -* Output : bam files -*/ - -/* fasta indexing */ -params.fasta = "$baseDir/data/bam/*.fasta" -params.annotation = "$baseDir/data/bam/*.gff3" - -log.info "fasta files : ${params.fasta}" - -Channel - .fromPath( params.fasta ) - .ifEmpty { error "Cannot find any fasta files matching: ${params.fasta}" } - .set { fasta_file } -Channel - .fromPath( params.annotation ) - .ifEmpty { error "Cannot find any annotation files matching: ${params.annotation}" } - .set { annotation_file } - -process index_fasta { - tag "$fasta.baseName" - cpus 4 - publishDir "results/mapping/index/", mode: 'copy' - - input: - file fasta from fasta_file - file annotation from annotation_file - - output: - file "*.index*" into index_files - - script: - def cmd_annotation = "--gff3 ${annotation}" - if(annotation ==~ /.*\.gtf$/){ - cmd_annotation = "--gtf ${annotation}" - } -""" -rsem-prepare-reference -p ${task.cpus} --bowtie2 \ ---bowtie2-path \$(which bowtie2 | sed 's/bowtie2\$//g') \ -${cmd_annotation} ${fasta} ${fasta.baseName}.index > \ -${fasta.baseName}_rsem_bowtie2_report.txt -""" -} - - -/* -* for paired-end data -*/ -params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq" -params.index = "$baseDir/data/index/*.index.*" - -log.info "fastq files : ${params.fastq}" -log.info "index files : ${params.index}" - -Channel - .fromFilePairs( params.fastq ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } - .set { fastq_files } -Channel - .fromPath( params.index ) - .ifEmpty { error "Cannot find any index files matching: ${params.index}" } - .set { index_files } - -process mapping_fastq { - tag "$pair_id" - cpus 4 - publishDir "results/mapping/quantification/", mode: 'copy' - - input: - set pair_id, file(reads) from fastq_files - file index from index_files.collect() - - output: - file "*" into counts_files - - script: -index_name = (index[0].baseName =~ /(.*)\.\d/)[0][1] -""" -rsem-calculate-expression --bowtie2 \ ---bowtie2-path \$(which bowtie2 | sed 's/bowtie2\$//g') \ ---bowtie2-sensitivity-level "very_sensitive" \ --output-genome-bam -p ${task.cpus} \ ---paired-end ${reads[0]} ${reads[1]} ${index_name} ${pair_id} \ -> ${pair_id}_rsem_bowtie2_report.txt -""" -} - - - -/* -* for single-end data -*/ - -params.fastq = "$baseDir/data/fastq/*.fastq" -params.index = "$baseDir/data/index/*.index*" -params.mean = 125 -params.sd = 100 - -log.info "fastq files : ${params.fastq}" -log.info "index files : ${params.index}" -log.info "mean read size: ${params.mean}" -log.info "sd read size: ${params.sd}" - -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 ) - .ifEmpty { error "Cannot find any index files matching: ${params.index}" } - .set { index_files } - -process mapping_fastq { - tag "$file_id" - cpus 4 - publishDir "results/mapping/quantification/", mode: 'copy' - - input: - set file_id, file(reads) from fastq_files - file index from index_files.collect() - - output: - file "*" into count_files - - script: -index_name = (index[0].baseName =~ /(.*)\.\d/)[0][1] -""" -rsem-calculate-expression --bowtie2 \ ---bowtie2-path \$(which bowtie2 | sed 's/bowtie2\$//g') \ ---bowtie2-sensitivity-level "very_sensitive" \ ---fragment-length-mean ${params.mean} --fragment-length-sd ${params.sd} \ ---output-genome-bam -p ${task.cpus} \ -${reads} ${index_name} ${file_id} \ -> ${reads.baseName}_rsem_bowtie2_report.txt -""" -} diff --git a/src/nf_modules/RSEM/tests/tests.sh b/src/nf_modules/RSEM/tests.sh similarity index 54% rename from src/nf_modules/RSEM/tests/tests.sh rename to src/nf_modules/RSEM/tests.sh index f7fcd064b93430badd67899831561121580e4709..c57c8c4feff12d566cb2529651c23e90e7bbb919 100755 --- a/src/nf_modules/RSEM/tests/tests.sh +++ b/src/nf_modules/RSEM/tests.sh @@ -1,17 +1,17 @@ -nextflow src/nf_modules/RSEM/tests/index.nf \ - -c src/nf_modules/RSEM/rsem.config \ +nextflow src/nf_modules/RSEM/indexing.nf \ + -c src/nf_modules/RSEM/indexing.config \ -profile docker \ --fasta "data/tiny_dataset/fasta/tiny_v2.fasta" \ --annotation "data/tiny_dataset/annot/tiny.gff" -nextflow src/nf_modules/RSEM/tests/quantification_single.nf \ - -c src/nf_modules/RSEM/rsem.config \ +nextflow src/nf_modules/RSEM/quantification_single.nf \ + -c src/nf_modules/RSEM/quantification_single.config \ -profile docker \ --index "results/mapping/index/tiny_v2.index*" \ --fastq "data/tiny_dataset/fastq/tiny*_S.fastq" -nextflow src/nf_modules/RSEM/tests/quantification_paired.nf \ - -c src/nf_modules/RSEM/rsem.config \ +nextflow src/nf_modules/RSEM/quantification_paired.nf \ + -c src/nf_modules/RSEM/quantification_paired.config \ -profile docker \ --index "results/mapping/index/tiny_v2.index*" \ --fastq "data/tiny_dataset/fastq/tiny*_R{1,2}.fastq" diff --git a/src/nf_modules/SAMtools/filter_bams.config b/src/nf_modules/SAMtools/filter_bams.config new file mode 100644 index 0000000000000000000000000000000000000000..066684006e4a04daef5caf26e45ba74878bb4ebf --- /dev/null +++ b/src/nf_modules/SAMtools/filter_bams.config @@ -0,0 +1,18 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $filter_bam { + container = "samtools:1.7" + } + } + } + sge { + process{ + $filter_bam { + beforeScript = "module purge; module load SAMtools/1.7" + } + } + } +} diff --git a/src/nf_modules/SAMtools/tests/filter_bams.nf b/src/nf_modules/SAMtools/filter_bams.nf similarity index 67% rename from src/nf_modules/SAMtools/tests/filter_bams.nf rename to src/nf_modules/SAMtools/filter_bams.nf index 49021362d7bc97c950042ab163a5224a2eb28d02..0812a19b227049fd05b54f46cbc30b246da73127 100644 --- a/src/nf_modules/SAMtools/tests/filter_bams.nf +++ b/src/nf_modules/SAMtools/filter_bams.nf @@ -7,6 +7,7 @@ log.info "bed file : ${params.bed}" Channel .fromPath( params.bam ) .ifEmpty { error "Cannot find any bam files matching: ${params.bam}" } + .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]} .set { bam_files } Channel .fromPath( params.bed ) @@ -14,18 +15,18 @@ Channel .set { bed_files } process filter_bam { - tag "$bam.baseName" + tag "$file_id" cpus 4 input: - file bam from bam_files + set file_id, file(bam) from bam_files file bed from bed_files output: - file "*_filtered.bam*" into filtered_bam_files + set file_id, "*_filtered.bam*" into filtered_bam_files script: """ -samtools view -@ ${task.cpus} -hb ${bam} -L ${bed} > ${bam.baseName}_filtered.bam +samtools view -@ ${task.cpus} -hb ${bam} -L ${bed} > ${file_id}_filtered.bam """ } diff --git a/src/nf_modules/SAMtools/index_bams.config b/src/nf_modules/SAMtools/index_bams.config new file mode 100644 index 0000000000000000000000000000000000000000..3b23601d9566ee96f034d14a798c6c8e08a6870f --- /dev/null +++ b/src/nf_modules/SAMtools/index_bams.config @@ -0,0 +1,18 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $index_bam { + container = "samtools:1.7" + } + } + } + sge { + process{ + $index_bam { + beforeScript = "module purge; module load SAMtools/1.7" + } + } + } +} diff --git a/src/nf_modules/SAMtools/tests/index_bams.nf b/src/nf_modules/SAMtools/index_bams.nf similarity index 63% rename from src/nf_modules/SAMtools/tests/index_bams.nf rename to src/nf_modules/SAMtools/index_bams.nf index bea5441c2c5946a705117c4422581c3e3eea6f02..489b0f4f71f39d1fdc5b7870547e9fd18a29f9af 100644 --- a/src/nf_modules/SAMtools/tests/index_bams.nf +++ b/src/nf_modules/SAMtools/index_bams.nf @@ -5,14 +5,18 @@ log.info "bams files : ${params.bam}" Channel .fromPath( params.bam ) .ifEmpty { error "Cannot find any bam files matching: ${params.bam}" } + .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]} .set { bam_files } process index_bam { - tag "$bam.baseName" + tag "$file_id" + input: - file bam from bam_files + set file_id, file(bam) from bam_files + output: - file "*bam*" into indexed_bam_file + set file_id, "*.bam*" into indexed_bam_file + script: """ samtools index ${bam} diff --git a/src/nf_modules/SAMtools/samtools.config b/src/nf_modules/SAMtools/samtools.config deleted file mode 100644 index a10e3e578a16a66324e2c6989d054015af03e491..0000000000000000000000000000000000000000 --- a/src/nf_modules/SAMtools/samtools.config +++ /dev/null @@ -1,36 +0,0 @@ -profiles { - docker { - docker.temp = 'auto' - docker.enabled = true - process { - $sort_bam { - container = "samtools:1.7" - } - $index_bam { - container = "samtools:1.7" - } - $split_bam { - container = "samtools:1.7" - } - $filter_bam { - container = "samtools:1.7" - } - } - } - sge { - process{ - $trimming { - beforeScript = "module purge; module load SAMtools/1.7" - } - $index_bam { - beforeScript = "module purge; module load SAMtools/1.7" - } - $split_bam { - beforeScript = "module purge; module load SAMtools/1.7" - } - $filter_bam { - beforeScript = "module purge; module load SAMtools/1.7" - } - } - } -} diff --git a/src/nf_modules/SAMtools/samtools.nf b/src/nf_modules/SAMtools/samtools.nf deleted file mode 100644 index f178bb0d706a4b656bf40beca25bf4cea69e9103..0000000000000000000000000000000000000000 --- a/src/nf_modules/SAMtools/samtools.nf +++ /dev/null @@ -1,117 +0,0 @@ -/* -* SAMtools : -* Imputs : bam files -* Output : bam files -*/ - -/* bams sorting */ -params.bam = "$baseDir/data/bam/*.bam" - -log.info "bams files : ${params.bam}" - -Channel - .fromPath( params.bam ) - .ifEmpty { error "Cannot find any bam files matching: ${params.bam}" } - .set { bam_files } - -process sort_bam { - tag "$bam.baseName" - cpus 4 - - input: - file bam from bam_files - - output: - file "*_sorted.bam" into sorted_bam_files - - script: -""" -samtools sort -@ ${task.cpus} -O BAM -o ${bam.baseName}_sorted.bam ${bam} -""" -} - -/* bams indexing */ - -params.bam = "$baseDir/data/bam/*.bam" - -log.info "bams files : ${params.bam}" - -Channel - .fromPath( params.bam ) - .ifEmpty { error "Cannot find any bam files matching: ${params.bam}" } - .set { bam_files } - -process index_bam { - tag "$bam.baseName" - input: - file bam from bam_files - output: - file "*bam*" into indexed_bam_file - script: -""" -samtools index ${bam} -""" -} - - -/* bams spliting */ -params.bam = "$baseDir/data/bam/*.bam" - -log.info "bams files : ${params.bam}" - -Channel - .fromPath( params.bam ) - .ifEmpty { error "Cannot find any bam files matching: ${params.bam}" } - .set { bam_files } - -process split_bam { - tag "$bam.baseName" - cpus 2 - - input: - file bam from bam_files - - output: - file "*_forward.bam*" into forward_bam_files - file "*_reverse.bam*" into reverse_bam_files - script: -""" -samtools view -hb -F 0x10 ${bam} > ${bam}_forward.bam & -samtools view -hb -f 0x10 ${bam} > ${bam}_reverse.bam -""" -} - - -/* bams filtering */ -params.bam = "$baseDir/data/bam/*.bam" -params.bed = "$baseDir/data/bam/*.bed" - -log.info "bams files : ${params.bam}" -log.info "bed file : ${params.bed}" - -Channel - .fromPath( params.bam ) - .ifEmpty { error "Cannot find any bam files matching: ${params.bam}" } - .set { bam_files } -Channel - .fromPath( params.bed ) - .ifEmpty { error "Cannot find any bed file matching: ${params.bed}" } - .set { bed_files } - -process filter_bam { - tag "$bam.baseName" - cpus 4 - - input: - file bam from bam_files - file bed from bed_files - - output: - file "*_filtered.bam*" into filtered_bam_files - script: -""" -samtools view -@ ${task.cpus} -hb ${bam} -L ${bed} > ${bam.baseName}_filtered.bam -""" -} - - diff --git a/src/nf_modules/SAMtools/sort_bams.config b/src/nf_modules/SAMtools/sort_bams.config new file mode 100644 index 0000000000000000000000000000000000000000..d1a8c503ace81d53fa5ff9cd382a435ac710e0cf --- /dev/null +++ b/src/nf_modules/SAMtools/sort_bams.config @@ -0,0 +1,18 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $sort_bam { + container = "samtools:1.7" + } + } + } + sge { + process{ + $sort_bam { + beforeScript = "module purge; module load SAMtools/1.7" + } + } + } +} diff --git a/src/nf_modules/SAMtools/tests/sort_bams.nf b/src/nf_modules/SAMtools/sort_bams.nf similarity index 53% rename from src/nf_modules/SAMtools/tests/sort_bams.nf rename to src/nf_modules/SAMtools/sort_bams.nf index 79a7590519616f3949aeadb651228666c172d0df..ab5c7e5140989b83eebd25f7b4dbb206520416b6 100644 --- a/src/nf_modules/SAMtools/tests/sort_bams.nf +++ b/src/nf_modules/SAMtools/sort_bams.nf @@ -5,21 +5,22 @@ log.info "bams files : ${params.bam}" Channel .fromPath( params.bam ) .ifEmpty { error "Cannot find any bam files matching: ${params.bam}" } + .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]} .set { bam_files } process sort_bam { - tag "$bams.baseName" + tag "$file_id" cpus 4 input: - file bam from bam_files + set file_id, file(bam) from bam_files output: - file "*_sorted.bam" into sorted_bam_files + set file_id, "*_sorted.bam" into sorted_bam_files script: """ -samtools sort -@ ${task.cpus} -O BAM -o ${bam.baseName}_sorted.bam ${bam} +samtools sort -@ ${task.cpus} -O BAM -o ${file_id}_sorted.bam ${bam} """ } diff --git a/src/nf_modules/SAMtools/split_bams.config b/src/nf_modules/SAMtools/split_bams.config new file mode 100644 index 0000000000000000000000000000000000000000..28b548efd5177e7457bd642b0c78198f2b48acd9 --- /dev/null +++ b/src/nf_modules/SAMtools/split_bams.config @@ -0,0 +1,18 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $split_bam { + container = "samtools:1.7" + } + } + } + sge { + process{ + $split_bam { + beforeScript = "module purge; module load SAMtools/1.7" + } + } + } +} diff --git a/src/nf_modules/SAMtools/split_bams.nf b/src/nf_modules/SAMtools/split_bams.nf new file mode 100644 index 0000000000000000000000000000000000000000..f8ba6a50c7d7aecfb7c9c7b0fff8d4436cf055a4 --- /dev/null +++ b/src/nf_modules/SAMtools/split_bams.nf @@ -0,0 +1,27 @@ +params.bam = "$baseDir/data/bam/*.bam" + +log.info "bams files : ${params.bam}" + +Channel + .fromPath( params.bam ) + .ifEmpty { error "Cannot find any bam files matching: ${params.bam}" } + .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]} + .set { bam_files } + +process split_bam { + tag "$file_id" + cpus 2 + + input: + set file_id, file(bam) from bam_files + + output: + set file_id, "*_forward.bam*" into forward_bam_files + set file_id, "*_reverse.bam*" into reverse_bam_files + script: +""" +samtools view -hb -F 0x10 ${bam} > ${file_id}_forward.bam & +samtools view -hb -f 0x10 ${bam} > ${file_id}_reverse.bam +""" +} + diff --git a/src/nf_modules/SAMtools/tests.sh b/src/nf_modules/SAMtools/tests.sh new file mode 100755 index 0000000000000000000000000000000000000000..99a7ff3251ee4b7fdc5ef9567c81d128843e28c7 --- /dev/null +++ b/src/nf_modules/SAMtools/tests.sh @@ -0,0 +1,20 @@ +nextflow src/nf_modules/SAMtools/sort_bams.nf \ + -c src/nf_modules/SAMtools/sort_bams.config \ + -profile docker \ + --bam "data/tiny_dataset/map/tiny_v2.bam" + +nextflow src/nf_modules/SAMtools/index_bams.nf \ + -c src/nf_modules/SAMtools/index_bams.config \ + -profile docker \ + --bam "data/tiny_dataset/map/tiny_v2.sort.bam" + +nextflow src/nf_modules/SAMtools/split_bams.nf \ + -c src/nf_modules/SAMtools/split_bams.config \ + -profile docker \ + --bam "data/tiny_dataset/map/tiny_v2.bam" + +nextflow src/nf_modules/SAMtools/filter_bams.nf \ + -c src/nf_modules/SAMtools/filter_bams.config \ + -profile docker \ + --bam "data/tiny_dataset/map/tiny_v2.bam" \ + --bed "data/tiny_dataset/OLD/2genes.bed" diff --git a/src/nf_modules/SAMtools/tests/split_bams.nf b/src/nf_modules/SAMtools/tests/split_bams.nf deleted file mode 100644 index edc20864de3c81dd4fc371d4455a62b53ed8a8f9..0000000000000000000000000000000000000000 --- a/src/nf_modules/SAMtools/tests/split_bams.nf +++ /dev/null @@ -1,26 +0,0 @@ -params.bam = "$baseDir/data/bam/*.bam" - -log.info "bams files : ${params.bam}" - -Channel - .fromPath( params.bam ) - .ifEmpty { error "Cannot find any bam files matching: ${params.bam}" } - .set { bam_files } - -process split_bam { - tag "$bam.baseName" - cpus 2 - - input: - file bam from bam_files - - output: - file "*_forward.bam*" into forward_bam_files - file "*_reverse.bam*" into reverse_bam_files - script: -""" -samtools view -hb -F 0x10 ${bam} > ${bam}_forward.bam & -samtools view -hb -f 0x10 ${bam} > ${bam}_reverse.bam -""" -} - diff --git a/src/nf_modules/SAMtools/tests/tests.sh b/src/nf_modules/SAMtools/tests/tests.sh deleted file mode 100755 index e3e809982cdf68959603f5496e49f02f2493afd6..0000000000000000000000000000000000000000 --- a/src/nf_modules/SAMtools/tests/tests.sh +++ /dev/null @@ -1,20 +0,0 @@ -nextflow src/nf_modules/SAMtools/tests/sort_bams.nf \ - -c src/nf_modules/SAMtools/samtools.config \ - -profile docker \ - --bam "data/tiny_dataset/map/tiny_v2.bam" - -nextflow src/nf_modules/SAMtools/tests/index_bams.nf \ - -c src/nf_modules/SAMtools/samtools.config \ - -profile docker \ - --bam "data/tiny_dataset/map/tiny_v2.sort.bam" - -nextflow src/nf_modules/SAMtools/tests/split_bams.nf \ - -c src/nf_modules/SAMtools/samtools.config \ - -profile docker \ - --bam "data/tiny_dataset/map/tiny_v2.bam" - -nextflow src/nf_modules/SAMtools/tests/filter_bams.nf \ - -c src/nf_modules/SAMtools/samtools.config \ - -profile docker \ - --bam "data/tiny_dataset/map/tiny_v2.bam" \ - --bed "data/tiny_dataset/OLD/2genes.bed" diff --git a/src/nf_modules/SRAtoolkit/sratoolkit.config b/src/nf_modules/SRAtoolkit/fastqdump.config similarity index 100% rename from src/nf_modules/SRAtoolkit/sratoolkit.config rename to src/nf_modules/SRAtoolkit/fastqdump.config diff --git a/src/nf_modules/SRAtoolkit/tests/fastqdump.nf b/src/nf_modules/SRAtoolkit/fastqdump.nf similarity index 61% rename from src/nf_modules/SRAtoolkit/tests/fastqdump.nf rename to src/nf_modules/SRAtoolkit/fastqdump.nf index 32579e70faa704f5667646a797dfdcd85e0c1cd2..3dde59641dfa837398abb1e169704d42a57b9fff 100644 --- a/src/nf_modules/SRAtoolkit/tests/fastqdump.nf +++ b/src/nf_modules/SRAtoolkit/fastqdump.nf @@ -15,30 +15,33 @@ log.info "downloading list srr : ${params.list_srr}" Channel .fromPath( params.list_srr ) .ifEmpty { error "Cannot find any bam files matching: ${params.list_srr}" } - .splitCsv(header: true) + .splitCsv() + .map { it -> it[0]} .set { SRR } //run is the column name containing SRR ids process fastq_dump { - tag {"${x.run}"} - publishDir "results/download/fastq/${x.run}/", mode: 'copy' + tag "$file_id" + publishDir "results/download/fastq/${file_id}/", mode: 'copy' input: - val x from SRR + val file_id from SRR output: - file("*") into fastq + set file_id, "*.fastq" into fastq script: """ #for test only 10000 reads are downloading with the option -N 10000 -X 20000 -fastq-dump --split-files --defline-seq '@\$ac_\$si/\$ri' --defline-qual "+" -N 10000 -X 20000 ${x.run} -if [ -f ${x.run}_1.fastq ] +fastq-dump --split-files --defline-seq '@\$ac_\$si/\$ri' --defline-qual "+" -N 10000 -X 20000 ${file_id} +if [ -f ${file_id}_1.fastq ] then - true -else - touch ${x.run}.fastq + mv ${file_id}_1.fastq ${file_id}_R1.fastq +fi +if [ -f ${file_id}_2.fastq ] +then + mv ${file_id}_2.fastq ${file_id}_R2.fastq fi """ } diff --git a/src/nf_modules/SRAtoolkit/tests/list-srr.txt b/src/nf_modules/SRAtoolkit/list-srr.txt similarity index 93% rename from src/nf_modules/SRAtoolkit/tests/list-srr.txt rename to src/nf_modules/SRAtoolkit/list-srr.txt index a9cd1d0e97a6ed45f50b640d2fef3cbbe232e1f9..a58fc103ffe37a56f511aee117b26383b1e3f516 100644 --- a/src/nf_modules/SRAtoolkit/tests/list-srr.txt +++ b/src/nf_modules/SRAtoolkit/list-srr.txt @@ -1,4 +1,3 @@ -run ERR572281 ERR572146 ERR572201 diff --git a/src/nf_modules/SRAtoolkit/sratoolkit.nf b/src/nf_modules/SRAtoolkit/sratoolkit.nf deleted file mode 100644 index 9fce5e42ecd94f8534adb44fea892b7ee774dfa1..0000000000000000000000000000000000000000 --- a/src/nf_modules/SRAtoolkit/sratoolkit.nf +++ /dev/null @@ -1,43 +0,0 @@ -/* -* sra-tools : - -*/ - -/* fastq-dump -* Imputs : srr list -* Outputs : fastq files -*/ - -params.list_srr = "$baseDir/data/SRR/*.txt" - -log.info "downloading list srr : ${params.list_srr}" - -Channel - .fromPath( params.list_srr ) - .ifEmpty { error "Cannot find any bam files matching: ${params.list_srr}" } - .splitCsv(header: true) - .set { SRR } - -//run is the column name containing SRR ids - -process fastq_dump { - tag {"${x.run}"} - publishDir "results/download/fastq/${x.run}/", mode: 'copy' - - input: - val x from SRR - - output: - file("*") into fastq - - script: -""" -fastq-dump --split-files --defline-seq '@\$ac_\$si/\$ri' --defline-qual "+" ${x.run} -if [ -f ${x.run}_1.fastq ] -then - true -else - touch ${x.run}.fastq -fi -""" -} diff --git a/src/nf_modules/SRAtoolkit/tests.sh b/src/nf_modules/SRAtoolkit/tests.sh new file mode 100755 index 0000000000000000000000000000000000000000..526cc7c2cd2144f3d9c26dfcae0e01508cf87a13 --- /dev/null +++ b/src/nf_modules/SRAtoolkit/tests.sh @@ -0,0 +1,4 @@ +nextflow src/nf_modules/SRAtoolkit/fastqdump.nf \ + -c src/nf_modules/SRAtoolkit/fastqdump.config \ + -profile docker \ + --list_srr "src/nf_modules/SRAtoolkit/list-srr.txt" diff --git a/src/nf_modules/SRAtoolkit/tests/tests.sh b/src/nf_modules/SRAtoolkit/tests/tests.sh deleted file mode 100755 index c5efbcc70a27461c6ed8f7d9abd8a30d62700b2c..0000000000000000000000000000000000000000 --- a/src/nf_modules/SRAtoolkit/tests/tests.sh +++ /dev/null @@ -1,4 +0,0 @@ -nextflow src/nf_modules/SRAtoolkit/tests/fastqdump.nf \ - -c src/nf_modules/SRAtoolkit/sratoolkit.config \ - -profile docker \ - --list_srr "src/nf_modules/SRAtoolkit/tests/list-srr.txt" diff --git a/src/nf_modules/UrQt/tests.sh b/src/nf_modules/UrQt/tests.sh new file mode 100755 index 0000000000000000000000000000000000000000..436e9cbda84884edbe7d03bff3a2779c56a6595c --- /dev/null +++ b/src/nf_modules/UrQt/tests.sh @@ -0,0 +1,9 @@ +nextflow src/nf_modules/UrQt/trimming_paired.nf \ + -c src/nf_modules/UrQt/trimming_paired.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" + +nextflow src/nf_modules/UrQt/trimming_single.nf \ + -c src/nf_modules/UrQt/trimming_single.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" diff --git a/src/nf_modules/UrQt/tests/tests.sh b/src/nf_modules/UrQt/tests/tests.sh deleted file mode 100755 index ebad73150b861322459f118dd63c2e2fd81af1f3..0000000000000000000000000000000000000000 --- a/src/nf_modules/UrQt/tests/tests.sh +++ /dev/null @@ -1,9 +0,0 @@ -nextflow src/nf_modules/UrQt/tests/trimming_paired.nf \ - -c src/nf_modules/UrQt/urqt.config \ - -profile docker \ - --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" - -nextflow src/nf_modules/UrQt/tests/trimming_single.nf \ - -c src/nf_modules/UrQt/urqt.config \ - -profile docker \ - --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" diff --git a/src/nf_modules/UrQt/trimming_paired.config b/src/nf_modules/UrQt/trimming_paired.config new file mode 100644 index 0000000000000000000000000000000000000000..46a86729f1367966225fcb37c5ef7f11070c7255 --- /dev/null +++ b/src/nf_modules/UrQt/trimming_paired.config @@ -0,0 +1,26 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $trimming { + container = "urqt:d62c1f8" + } + } + } + sge { + process{ + $trimming { + beforeScript = "module purge; module load UrQt/d62c1f8" + executor = "sge" + cpus = 4 + memory = "5GB" + time = "6h" + queueSize = 1000 + pollInterval = '60sec' + queue = 'h6-E5-2667v4deb128' + penv = 'openmp8' + } + } + } +} diff --git a/src/nf_modules/UrQt/tests/trimming_paired.nf b/src/nf_modules/UrQt/trimming_paired.nf similarity index 100% rename from src/nf_modules/UrQt/tests/trimming_paired.nf rename to src/nf_modules/UrQt/trimming_paired.nf diff --git a/src/nf_modules/UrQt/trimming_single.config b/src/nf_modules/UrQt/trimming_single.config new file mode 100644 index 0000000000000000000000000000000000000000..46a86729f1367966225fcb37c5ef7f11070c7255 --- /dev/null +++ b/src/nf_modules/UrQt/trimming_single.config @@ -0,0 +1,26 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $trimming { + container = "urqt:d62c1f8" + } + } + } + sge { + process{ + $trimming { + beforeScript = "module purge; module load UrQt/d62c1f8" + executor = "sge" + cpus = 4 + memory = "5GB" + time = "6h" + queueSize = 1000 + pollInterval = '60sec' + queue = 'h6-E5-2667v4deb128' + penv = 'openmp8' + } + } + } +} diff --git a/src/nf_modules/UrQt/tests/trimming_single.nf b/src/nf_modules/UrQt/trimming_single.nf similarity index 100% rename from src/nf_modules/UrQt/tests/trimming_single.nf rename to src/nf_modules/UrQt/trimming_single.nf diff --git a/src/nf_modules/UrQt/urqt.nf b/src/nf_modules/UrQt/urqt.nf deleted file mode 100644 index 3a0e7d843896f7587a13c1bdfabd01c73f10a122..0000000000000000000000000000000000000000 --- a/src/nf_modules/UrQt/urqt.nf +++ /dev/null @@ -1,72 +0,0 @@ -/* -* urqt : -* Imputs : fastq files -* Output : fastq files -*/ -/* quality trimming */ - -/* -* for paired-end data -*/ - -params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq" - -log.info "fastq files : ${params.fastq}" - -Channel - .fromFilePairs( params.fastq ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } - .set { fastq_files } - -process trimming { - tag "${reads}" - cpus 4 - publishDir "results/fastq/trimming/", mode: 'copy' - - input: - set pair_id, file(reads) from fastq_files - - output: - set pair_id, "*_trim_R{1,2}.fastq.gz" into fastq_files_trim - - script: -""" -UrQt --t 20 --m ${task.cpus} --gz \ ---in ${reads[0]} --inpair ${reads[1]} \ ---out ${pair_id}_trim_R1.fastq.gz --outpair ${pair_id}_trim_R2.fastq.gz \ -> ${pair_id}_trimming_report.txt -""" -} - -/* -* for single-end data -*/ - -params.fastq = "$baseDir/data/fastq/*.fastq" - -log.info "fastq files : ${params.fastq}" - -Channel - .fromPath( params.fastq ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } - .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]} - .set { fastq_files } - -process trimming { - tag "$file_id" - cpus 4 - - input: - set file_id, file(reads) from fastq_files - - output: - set file_id, "*_trim.fastq.gz" into fastq_files_trim - - script: - """ - UrQt --t 20 --m ${task.cpus} --gz \ - --in ${reads} \ - --out ${file_id}_trim.fastq.gz \ - > ${file_id}_trimming_report.txt - """ -} diff --git a/src/nf_modules/cutadapt/cutadapt.config b/src/nf_modules/cutadapt/adaptor_removal_paired.config similarity index 50% rename from src/nf_modules/cutadapt/cutadapt.config rename to src/nf_modules/cutadapt/adaptor_removal_paired.config index 07efa9be0c8808c0cf730fb5d0dcb7ae8d351b3f..aa1a372b694db02c9d290a0dccf3c67e14f1c5f7 100644 --- a/src/nf_modules/cutadapt/cutadapt.config +++ b/src/nf_modules/cutadapt/adaptor_removal_paired.config @@ -24,30 +24,3 @@ profiles { } } } - -profiles { - docker { - docker.temp = 'auto' - docker.enabled = true - process { - $trimming { - container = "cutadapt:1.14" - } - } - } - sge { - process{ - $trimming { - beforeScript = "module purge; module load cutadapt/1.14" - executor = "sge" - cpus = 1 - memory = "5GB" - time = "6h" - queueSize = 1000 - pollInterval = '60sec' - queue = 'h6-E5-2667v4deb128' - penv = 'openmp8' - } - } - } -} diff --git a/src/nf_modules/cutadapt/tests/adaptor_removal_paired.nf b/src/nf_modules/cutadapt/adaptor_removal_paired.nf similarity index 100% rename from src/nf_modules/cutadapt/tests/adaptor_removal_paired.nf rename to src/nf_modules/cutadapt/adaptor_removal_paired.nf diff --git a/src/nf_modules/cutadapt/adaptor_removal_single.config b/src/nf_modules/cutadapt/adaptor_removal_single.config new file mode 100644 index 0000000000000000000000000000000000000000..aa1a372b694db02c9d290a0dccf3c67e14f1c5f7 --- /dev/null +++ b/src/nf_modules/cutadapt/adaptor_removal_single.config @@ -0,0 +1,26 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $adaptor_removal { + container = "cutadapt:1.14" + } + } + } + sge { + process{ + $adaptor_removal { + beforeScript = "module purge; module load cutadapt/1.14" + executor = "sge" + cpus = 1 + memory = "5GB" + time = "6h" + queueSize = 1000 + pollInterval = '60sec' + queue = 'h6-E5-2667v4deb128' + penv = 'openmp8' + } + } + } +} diff --git a/src/nf_modules/cutadapt/tests/adaptor_removal_single.nf b/src/nf_modules/cutadapt/adaptor_removal_single.nf similarity index 100% rename from src/nf_modules/cutadapt/tests/adaptor_removal_single.nf rename to src/nf_modules/cutadapt/adaptor_removal_single.nf diff --git a/src/nf_modules/cutadapt/cutadapt.nf b/src/nf_modules/cutadapt/cutadapt.nf deleted file mode 100644 index c7428637e75eb7bef584d6d42aba48e3006fe0fa..0000000000000000000000000000000000000000 --- a/src/nf_modules/cutadapt/cutadapt.nf +++ /dev/null @@ -1,131 +0,0 @@ -/* -* cutadapt : -* Imputs : fastq files -* Output : fastq files -*/ - -/* Illumina adaptor removal */ - -/* -* for paired-end data -*/ - -params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq" - -log.info "fastq files : ${params.fastq}" - -Channel - .fromFilePairs( params.fastq ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } - .set { fastq_files } - -process adaptor_removal { - tag "$pair_id" - publishDir "results/fastq/adaptor_removal/", mode: 'copy' - - input: - set pair_id, file(reads) from fastq_files - - output: - set pair_id, "*_cut_R{1,2}.fastq.gz" into fastq_files_cut - - script: - """ - cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT -A AGATCGGAAGAG -G CTCTTCCGATCT \ - -o ${pair_id}_cut_R1.fastq.gz -p ${pair_id}_cut_R2.fastq.gz \ - ${reads[0]} ${reads[1]} > ${pair_id}_report.txt - """ -} - -/* -* for single-end data -*/ - -log.info "fastq files : ${params.fastq}" - -Channel - .fromPath( params.fastq ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } - .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]} - .set { fastq_files } - -process adaptor_removal { - tag "$file_id" - - input: - set file_id, file(reads) from fastq_files - - output: - set file_id, "*_cut.fastq.gz" into fastq_files_cut - - script: - """ - cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT\ - -o ${file_id}_cut.fastq.gz \ - ${reads} > ${file_id}_report.txt - """ -} - - -/* quality trimming */ - -/* -* for paired-end data -*/ - -params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq" - -log.info "fastq files : ${params.fastq}" - -Channel - .fromFilePairs( params.fastq ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } - .set { fastq_files } - -process trimming { - tag "$pair_id" - publishDir "results/fastq/trimming/", mode: 'copy' - - input: - set pair_id, file(reads) from fastq_files - - output: - set pair_id, "*_trim_R{1,2}.fastq.gz" into fastq_files_trim - - script: - """ - cutadapt -q 20,20 \ - -o ${pair_id}_trim_R1.fastq.gz -p ${pair_id}_trim_R2.fastq.gz \ - ${reads[0]} ${reads[1]} > ${pair_id}_report.txt - """ -} - -/* -* for single-end data -*/ - -log.info "fastq files : ${params.fastq}" - -Channel - .fromPath( params.fastq ) - .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } - .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]} - .set { fastq_files } - -process trimming { - tag "$file_id" - - input: - set file_id, file(reads) from fastq_files - - output: - set file_id, "*_trim.fastq.gz" into fastq_files_cut - - script: - """ - cutadapt -q 20,20 \ - -o ${file_id}_trim.fastq.gz \ - ${reads} > ${file_id}_report.txt - """ -} - diff --git a/src/nf_modules/cutadapt/tests.sh b/src/nf_modules/cutadapt/tests.sh new file mode 100755 index 0000000000000000000000000000000000000000..cf2b529ea9b4a3f4f81c0d5b5ccbfaa403a40dda --- /dev/null +++ b/src/nf_modules/cutadapt/tests.sh @@ -0,0 +1,19 @@ +nextflow src/nf_modules/cutadapt/adaptor_removal_paired.nf \ + -c src/nf_modules/cutadapt/adaptor_removal_paired.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" + +nextflow src/nf_modules/cutadapt/adaptor_removal_single.nf \ + -c src/nf_modules/cutadapt/adaptor_removal_single.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny*_S.fastq" + +nextflow src/nf_modules/cutadapt/trimming_paired.nf \ + -c src/nf_modules/cutadapt/trimming_paired.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" + +nextflow src/nf_modules/cutadapt/trimming_single.nf \ + -c src/nf_modules/cutadapt/trimming_single.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny*_S.fastq" diff --git a/src/nf_modules/cutadapt/tests/tests.sh b/src/nf_modules/cutadapt/tests/tests.sh deleted file mode 100755 index 68623dbb2b54a87cc80bacefa28a25a7676acdae..0000000000000000000000000000000000000000 --- a/src/nf_modules/cutadapt/tests/tests.sh +++ /dev/null @@ -1,19 +0,0 @@ -nextflow src/nf_modules/cutadapt/tests/adaptor_removal_paired.nf \ - -c src/nf_modules/cutadapt/cutadapt.config \ - -profile docker \ - --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" - -nextflow src/nf_modules/cutadapt/tests/adaptor_removal_single.nf \ - -c src/nf_modules/cutadapt/cutadapt.config \ - -profile docker \ - --fastq "data/tiny_dataset/fastq/tiny*_S.fastq" - -nextflow src/nf_modules/cutadapt/tests/trimming_paired.nf \ - -c src/nf_modules/cutadapt/cutadapt.config \ - -profile docker \ - --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" - -nextflow src/nf_modules/cutadapt/tests/trimming_single.nf \ - -c src/nf_modules/cutadapt/cutadapt.config \ - -profile docker \ - --fastq "data/tiny_dataset/fastq/tiny*_S.fastq" diff --git a/src/nf_modules/cutadapt/trimming_paired.config b/src/nf_modules/cutadapt/trimming_paired.config new file mode 100644 index 0000000000000000000000000000000000000000..be03e9d728f08bf863f6909e4673f3c0bef810be --- /dev/null +++ b/src/nf_modules/cutadapt/trimming_paired.config @@ -0,0 +1,26 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $trimming { + container = "cutadapt:1.14" + } + } + } + sge { + process{ + $trimming { + beforeScript = "module purge; module load cutadapt/1.14" + executor = "sge" + cpus = 1 + memory = "5GB" + time = "6h" + queueSize = 1000 + pollInterval = '60sec' + queue = 'h6-E5-2667v4deb128' + penv = 'openmp8' + } + } + } +} diff --git a/src/nf_modules/cutadapt/tests/trimming_paired.nf b/src/nf_modules/cutadapt/trimming_paired.nf similarity index 100% rename from src/nf_modules/cutadapt/tests/trimming_paired.nf rename to src/nf_modules/cutadapt/trimming_paired.nf diff --git a/src/nf_modules/cutadapt/trimming_single.config b/src/nf_modules/cutadapt/trimming_single.config new file mode 100644 index 0000000000000000000000000000000000000000..be03e9d728f08bf863f6909e4673f3c0bef810be --- /dev/null +++ b/src/nf_modules/cutadapt/trimming_single.config @@ -0,0 +1,26 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $trimming { + container = "cutadapt:1.14" + } + } + } + sge { + process{ + $trimming { + beforeScript = "module purge; module load cutadapt/1.14" + executor = "sge" + cpus = 1 + memory = "5GB" + time = "6h" + queueSize = 1000 + pollInterval = '60sec' + queue = 'h6-E5-2667v4deb128' + penv = 'openmp8' + } + } + } +} diff --git a/src/nf_modules/cutadapt/tests/trimming_single.nf b/src/nf_modules/cutadapt/trimming_single.nf similarity index 100% rename from src/nf_modules/cutadapt/tests/trimming_single.nf rename to src/nf_modules/cutadapt/trimming_single.nf