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"