From 706ca6334fd0b73477e77222d24dc0e1c4eafd5f Mon Sep 17 00:00:00 2001 From: Alexander Peltzer Date: Fri, 12 Apr 2019 20:36:55 +0200 Subject: [PATCH 01/10] Indexing should be fine now --- main.nf | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/main.nf b/main.nf index f06dadc97..70b7160e8 100644 --- a/main.nf +++ b/main.nf @@ -486,13 +486,12 @@ process makeFastaIndex { file where_are_my_files output: - file "${base}.fasta.fai" into ch_fasta_faidx_index + file "*.fai" into ch_fasta_faidx_index file "where_are_my_files.txt" script: - base = "${fasta.baseName}" """ - samtools faidx "${base}.fasta" + samtools faidx $fasta """ } @@ -516,16 +515,13 @@ process makeSeqDict { file where_are_my_files output: - file "seq_dict/*.dict" into ch_seq_dict + file "*.dict" into ch_seq_dict file "where_are_my_files.txt" script: - base = "${fasta.baseName}.fasta" """ - mkdir -p seq_dict - mv $fasta "seq_dict/${base}" cd seq_dict - picard -Xmx${task.memory.toMega()}M -Xms${task.memory.toMega()}M CreateSequenceDictionary R=$base O="${fasta.baseName}.dict" + picard -Xmx${task.memory.toMega()}M -Xms${task.memory.toMega()}M CreateSequenceDictionary R=$fasta O="${fasta.baseName}.dict" """ } @@ -679,7 +675,7 @@ process adapter_removal { * STEP 2.1 - FastQC after clipping/merging (if applied!) */ process fastqc_after_clipping { - tag "${prefix}" + tag "${name}" publishDir "${params.outdir}/FastQC/after_clipping", mode: 'copy', saveAs: {filename -> filename.indexOf(".zip") > 0 ? "zips/$filename" : "$filename"} @@ -692,7 +688,6 @@ process fastqc_after_clipping { file "*_fastqc.{zip,html}" optional true into ch_fastqc_after_clipping script: - prefix = reads[0].toString().tokenize('.')[0] """ fastqc -q $reads """ @@ -703,7 +698,6 @@ Step 3: Mapping with BWA, SAM to BAM, Sort BAM */ process bwa { - tag "$prefix" publishDir "${params.outdir}/mapping/bwa", mode: 'copy' when: !params.circularmapper && !params.bwamem @@ -724,7 +718,8 @@ process bwa { //PE data without merging, PE data without any AR applied if (!params.singleEnd && (params.skip_collapse || params.skip_adapterremoval)){ - prefix = reads[0].toString().tokenize('.')[0] + lastPath = params.fasta.lastIndexOf(File.separator) + prefix = params.fasta.substring(lastPath+1) """ bwa aln -t ${task.cpus} $fasta ${reads[0]} -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f ${prefix}.r1.sai bwa aln -t ${task.cpus} $fasta ${reads[1]} -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f ${prefix}.r2.sai @@ -733,7 +728,8 @@ process bwa { """ } else { //PE collapsed, or SE data - prefix = reads[0].toString().tokenize('.')[0] + lastPath = params.fasta.lastIndexOf(File.separator) + prefix = params.fasta.substring(lastPath+1) """ bwa aln -t ${task.cpus} $fasta $reads -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f ${prefix}.sai bwa samse -r "@RG\\tID:ILLUMINA-${prefix}\\tSM:${prefix}\\tPL:illumina" $fasta ${prefix}.sai $reads | samtools sort -@ ${task.cpus} -O bam - > "${prefix}".sorted.bam From 76d2a68131248cc989304918f151cac19f50b222 Mon Sep 17 00:00:00 2001 From: Alexander Peltzer Date: Fri, 12 Apr 2019 20:54:11 +0200 Subject: [PATCH 02/10] Forgot seq-dict --- main.nf | 1 - 1 file changed, 1 deletion(-) diff --git a/main.nf b/main.nf index 70b7160e8..498c6546e 100644 --- a/main.nf +++ b/main.nf @@ -520,7 +520,6 @@ process makeSeqDict { script: """ - cd seq_dict picard -Xmx${task.memory.toMega()}M -Xms${task.memory.toMega()}M CreateSequenceDictionary R=$fasta O="${fasta.baseName}.dict" """ } From febad81b5039afa71f0abde3858584b3ca19f1ef Mon Sep 17 00:00:00 2001 From: Alexander Peltzer Date: Fri, 12 Apr 2019 21:39:05 +0200 Subject: [PATCH 03/10] File extension fix --- main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.nf b/main.nf index 498c6546e..6180fa73d 100644 --- a/main.nf +++ b/main.nf @@ -245,7 +245,7 @@ if("${params.fasta}".endsWith(".gz")){ file zipped_fasta output: - file "*.fasta" into fasta_for_indexing + file $rm_gz into fasta_for_indexing script: """ From 07bb5190601075e623c8226ca4328e95f61149d3 Mon Sep 17 00:00:00 2001 From: Alexander Peltzer Date: Fri, 12 Apr 2019 21:51:54 +0200 Subject: [PATCH 04/10] One more fix --- main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.nf b/main.nf index 6180fa73d..d4de68ac9 100644 --- a/main.nf +++ b/main.nf @@ -245,7 +245,7 @@ if("${params.fasta}".endsWith(".gz")){ file zipped_fasta output: - file $rm_gz into fasta_for_indexing + file "${rm_gz}" into fasta_for_indexing script: """ From b7bb5a867a74e83efa858d991dab9497725337cd Mon Sep 17 00:00:00 2001 From: Alexander Peltzer Date: Fri, 12 Apr 2019 22:12:06 +0200 Subject: [PATCH 05/10] Should do it --- main.nf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.nf b/main.nf index d4de68ac9..ae7404ffe 100644 --- a/main.nf +++ b/main.nf @@ -245,9 +245,10 @@ if("${params.fasta}".endsWith(".gz")){ file zipped_fasta output: - file "${rm_gz}" into fasta_for_indexing + file "${rm_zip}" into fasta_for_indexing script: + rm_zip = zipped_fasta - '.gz' """ pigz -f -d -p ${task.cpus} $zipped_fasta """ From 2fbbc0608fc87773804fe1600bd0221868982715 Mon Sep 17 00:00:00 2001 From: Alexander Peltzer Date: Sun, 14 Apr 2019 11:11:04 +0200 Subject: [PATCH 06/10] Fix for multiqc --- main.nf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.nf b/main.nf index ae7404ffe..7e1150a54 100644 --- a/main.nf +++ b/main.nf @@ -718,8 +718,8 @@ process bwa { //PE data without merging, PE data without any AR applied if (!params.singleEnd && (params.skip_collapse || params.skip_adapterremoval)){ - lastPath = params.fasta.lastIndexOf(File.separator) - prefix = params.fasta.substring(lastPath+1) + lastPath = "${reads[0]}".lastIndexOf(File.separator) + prefix = "${reads[0]}".substring(lastPath+1) """ bwa aln -t ${task.cpus} $fasta ${reads[0]} -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f ${prefix}.r1.sai bwa aln -t ${task.cpus} $fasta ${reads[1]} -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f ${prefix}.r2.sai @@ -728,8 +728,8 @@ process bwa { """ } else { //PE collapsed, or SE data - lastPath = params.fasta.lastIndexOf(File.separator) - prefix = params.fasta.substring(lastPath+1) + lastPath = "${reads}".lastIndexOf(File.separator) + prefix = "${reads}".substring(lastPath+1) """ bwa aln -t ${task.cpus} $fasta $reads -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f ${prefix}.sai bwa samse -r "@RG\\tID:ILLUMINA-${prefix}\\tSM:${prefix}\\tPL:illumina" $fasta ${prefix}.sai $reads | samtools sort -@ ${task.cpus} -O bam - > "${prefix}".sorted.bam From e182c0d585401cac4b01e21eba156f4327663ca2 Mon Sep 17 00:00:00 2001 From: Alexander Peltzer Date: Sun, 14 Apr 2019 11:26:43 +0200 Subject: [PATCH 07/10] Add name to bwa process --- main.nf | 1 + 1 file changed, 1 insertion(+) diff --git a/main.nf b/main.nf index 7e1150a54..1a786c2d7 100644 --- a/main.nf +++ b/main.nf @@ -698,6 +698,7 @@ Step 3: Mapping with BWA, SAM to BAM, Sort BAM */ process bwa { + tag "${name}" publishDir "${params.outdir}/mapping/bwa", mode: 'copy' when: !params.circularmapper && !params.bwamem From 334e24ea8453d6d9e56904c746c113c8a06e2b3d Mon Sep 17 00:00:00 2001 From: Alexander Peltzer Date: Sun, 14 Apr 2019 11:35:30 +0200 Subject: [PATCH 08/10] Add changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef7a2da3d..d2ab099ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * [#176](https://github.com/nf-core/eager/pull/176) - Increase runtime for DamageProfiler on [large reference genomes](https://github.com/nf-core/eager/issues/173) * [#172](https://github.com/nf-core/eager/pull/152) - DamageProfiler errors [won't crash entire pipeline anymore](https://github.com/nf-core/eager/issues/171) * [#174](https://github.com/nf-core/eager/pull/190) - Publish DeDup files [properly](https://github.com/nf-core/eager/issues/183) -* TBF - Fix reference [issues](https://github.com/nf-core/eager/issues/150) +* [#196](https://github.com/nf-core/eager/pull/190) - Fix reference [issues](https://github.com/nf-core/eager/issues/150) +* [#196](https://github.com/nf-core/eager/pull/190) - Fix issues with PE data being mapped incompletely ### `Dependencies` From f3552df00c21976c28fa1080a3fadfcd8aa83129 Mon Sep 17 00:00:00 2001 From: Alexander Peltzer Date: Sun, 14 Apr 2019 11:41:17 +0200 Subject: [PATCH 09/10] FIx prefix now --- main.nf | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/main.nf b/main.nf index 1a786c2d7..3e315959e 100644 --- a/main.nf +++ b/main.nf @@ -718,9 +718,8 @@ process bwa { fasta = "${index}/${bwa_base}" //PE data without merging, PE data without any AR applied - if (!params.singleEnd && (params.skip_collapse || params.skip_adapterremoval)){ - lastPath = "${reads[0]}".lastIndexOf(File.separator) - prefix = "${reads[0]}".substring(lastPath+1) + if (!params.singleEnd && (params.skip_collapse || params.skip_adapterremoval || params.skip_trim)){ + prefix = "${reads[0].baseName}" """ bwa aln -t ${task.cpus} $fasta ${reads[0]} -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f ${prefix}.r1.sai bwa aln -t ${task.cpus} $fasta ${reads[1]} -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f ${prefix}.r2.sai @@ -729,8 +728,7 @@ process bwa { """ } else { //PE collapsed, or SE data - lastPath = "${reads}".lastIndexOf(File.separator) - prefix = "${reads}".substring(lastPath+1) + prefix = "${reads}.baseName}" """ bwa aln -t ${task.cpus} $fasta $reads -n ${params.bwaalnn} -l ${params.bwaalnl} -k ${params.bwaalnk} -f ${prefix}.sai bwa samse -r "@RG\\tID:ILLUMINA-${prefix}\\tSM:${prefix}\\tPL:illumina" $fasta ${prefix}.sai $reads | samtools sort -@ ${task.cpus} -O bam - > "${prefix}".sorted.bam From 3d99bc8c8c15fcd217e05d04b97ef41e60395317 Mon Sep 17 00:00:00 2001 From: Alexander Peltzer Date: Sun, 14 Apr 2019 12:33:57 +0200 Subject: [PATCH 10/10] Fix for fasta output --- main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.nf b/main.nf index 3e315959e..406f3a8d5 100644 --- a/main.nf +++ b/main.nf @@ -245,7 +245,7 @@ if("${params.fasta}".endsWith(".gz")){ file zipped_fasta output: - file "${rm_zip}" into fasta_for_indexing + file "*.{fa,fn,fna,fasta}" into fasta_for_indexing script: rm_zip = zipped_fasta - '.gz'