From 2a4e46b89c643da03e2c13ca6684249a7b61dc15 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 19 Oct 2023 11:36:40 -0400 Subject: [PATCH 1/6] fix: write index from samtools sort resolves #8 --- modules/CCBR/bwa/mem/main.nf | 7 ++++--- tests/modules/CCBR/bwa/mem/test.yml | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/CCBR/bwa/mem/main.nf b/modules/CCBR/bwa/mem/main.nf index d4bee76..af7f0bb 100644 --- a/modules/CCBR/bwa/mem/main.nf +++ b/modules/CCBR/bwa/mem/main.nf @@ -9,8 +9,8 @@ process BWA_MEM { tuple val(meta_idx), path(index_files) output: - tuple val(meta), path("*.bam"), emit: bam - path "versions.yml" , emit: versions + tuple val(meta), path("*.bam"), path("*.bai"), emit: bam + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -31,7 +31,8 @@ process BWA_MEM { -@ ${task.cpus} \\ -m 2G \\ -T \$TMP \\ - \$TMP/align.bam > ${prefix}.bam + --write-index \\ + \$TMP/align.bam > ${prefix}.bam##idx##${prefix}.bam.bai cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/tests/modules/CCBR/bwa/mem/test.yml b/tests/modules/CCBR/bwa/mem/test.yml index 60b56c3..a264bba 100644 --- a/tests/modules/CCBR/bwa/mem/test.yml +++ b/tests/modules/CCBR/bwa/mem/test.yml @@ -16,6 +16,7 @@ md5sum: ab3952cabf026b48cd3eb5bccbb636d1 - path: output/bwa/test.bam md5sum: fe5a30103b245d81a8d37d6144794f56 + - path: output/bwa/test.bam.bai - path: output/bwa/versions.yml - name: bwa mem test_bwa_mem_paired_end @@ -36,4 +37,5 @@ md5sum: ab3952cabf026b48cd3eb5bccbb636d1 - path: output/bwa/test.bam md5sum: 06b8e7424d97add946ddb07e55f12962 + - path: output/bwa/test.bam.bai - path: output/bwa/versions.yml From 8eb67941c85485de9973dc7d39c14656b947ac85 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 19 Oct 2023 13:43:47 -0400 Subject: [PATCH 2/6] fix: samtools hash format syntax --- modules/CCBR/bwa/mem/main.nf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/CCBR/bwa/mem/main.nf b/modules/CCBR/bwa/mem/main.nf index af7f0bb..6597b86 100644 --- a/modules/CCBR/bwa/mem/main.nf +++ b/modules/CCBR/bwa/mem/main.nf @@ -32,7 +32,8 @@ process BWA_MEM { -m 2G \\ -T \$TMP \\ --write-index \\ - \$TMP/align.bam > ${prefix}.bam##idx##${prefix}.bam.bai + -o ${prefix}.bam##idx##${prefix}.bam.bai \\ + \$TMP/align.bam cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -43,6 +44,6 @@ process BWA_MEM { stub: """ - touch ${meta.id}.bam versions.yml + touch ${meta.id}.bam ${prefix}.bam.bai versions.yml """ } From 4a0755f11d6b087da59eea57188172a50ecc4e55 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 19 Oct 2023 13:44:00 -0400 Subject: [PATCH 3/6] test: bwa mem stub --- tests/modules/CCBR/bwa/mem/test.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/modules/CCBR/bwa/mem/test.yml b/tests/modules/CCBR/bwa/mem/test.yml index a264bba..b0be3ac 100644 --- a/tests/modules/CCBR/bwa/mem/test.yml +++ b/tests/modules/CCBR/bwa/mem/test.yml @@ -19,6 +19,16 @@ - path: output/bwa/test.bam.bai - path: output/bwa/versions.yml +- name: bwa mem test_bwa_mem_single_end stub + command: nextflow run ./tests/modules/CCBR/bwa/mem -entry test_bwa_mem_single_end -c ./tests/config/nextflow.config -stub + tags: + - bwa/mem + - bwa + files: + - path: output/bwa/test.bam + - path: output/bwa/test.bam.bai + - path: output/bwa/versions.yml + - name: bwa mem test_bwa_mem_paired_end command: nextflow run ./tests/modules/CCBR/bwa/mem -entry test_bwa_mem_paired_end -c ./tests/config/nextflow.config tags: From 020ae04a91851c41dade43329b6b30581040bced Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 19 Oct 2023 13:46:42 -0400 Subject: [PATCH 4/6] docs: describe bai output --- CHANGELOG.md | 1 + modules/CCBR/bwa/mem/meta.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b94fd13..d01dc3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,5 +3,6 @@ - new modules: - bwa/index - bwa/mem + - also runs samtools sort & outputs index in bai format. - cutadapt - khmer/uniquekmers diff --git a/modules/CCBR/bwa/mem/meta.yml b/modules/CCBR/bwa/mem/meta.yml index 14feefe..a6dfccd 100644 --- a/modules/CCBR/bwa/mem/meta.yml +++ b/modules/CCBR/bwa/mem/meta.yml @@ -37,6 +37,10 @@ output: type: file description: Output BAM file containing read alignments pattern: "*.{bam}" + - bai: + type: file + description: Output BAI index file + pattern: "*.{bai}" - versions: type: file description: File containing software versions From 68b9b5df0b652f8dec90e3cd3b3a55eef31c5548 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 19 Oct 2023 13:49:49 -0400 Subject: [PATCH 5/6] fix: use meta.id in stub --- modules/CCBR/bwa/mem/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/CCBR/bwa/mem/main.nf b/modules/CCBR/bwa/mem/main.nf index 6597b86..f6eb0ee 100644 --- a/modules/CCBR/bwa/mem/main.nf +++ b/modules/CCBR/bwa/mem/main.nf @@ -44,6 +44,6 @@ process BWA_MEM { stub: """ - touch ${meta.id}.bam ${prefix}.bam.bai versions.yml + touch ${meta.id}.bam ${meta.id}.bam.bai versions.yml """ } From 48ad268fc9bb5c80acca57fffd5371e6fb4ee351 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 19 Oct 2023 13:50:55 -0400 Subject: [PATCH 6/6] fix: md5sums for gha --- tests/modules/CCBR/bwa/mem/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/modules/CCBR/bwa/mem/test.yml b/tests/modules/CCBR/bwa/mem/test.yml index b0be3ac..6299257 100644 --- a/tests/modules/CCBR/bwa/mem/test.yml +++ b/tests/modules/CCBR/bwa/mem/test.yml @@ -15,7 +15,7 @@ - path: output/bwa/bwa/genome.sa md5sum: ab3952cabf026b48cd3eb5bccbb636d1 - path: output/bwa/test.bam - md5sum: fe5a30103b245d81a8d37d6144794f56 + md5sum: 0f7b7413436295bcd839fec262eabb18 - path: output/bwa/test.bam.bai - path: output/bwa/versions.yml @@ -46,6 +46,6 @@ - path: output/bwa/bwa/genome.sa md5sum: ab3952cabf026b48cd3eb5bccbb636d1 - path: output/bwa/test.bam - md5sum: 06b8e7424d97add946ddb07e55f12962 + md5sum: ae4a49f2dd6a487d75f99c9d3b42858b - path: output/bwa/test.bam.bai - path: output/bwa/versions.yml