From 97e66015caec35f7fd6d095b9fc797549fee9efc Mon Sep 17 00:00:00 2001 From: MaxUlysse Date: Fri, 3 Jun 2022 15:51:02 +0200 Subject: [PATCH] add test + fix issues --- modules/tiddit/sv/main.nf | 7 ++----- modules/tiddit/sv/meta.yml | 20 ++++++++++++-------- tests/modules/tiddit/sv/main.nf | 17 +++++++++++++++-- tests/modules/tiddit/sv/test.yml | 11 +++++++++++ 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/modules/tiddit/sv/main.nf b/modules/tiddit/sv/main.nf index 712f364b..ee2a8d75 100644 --- a/modules/tiddit/sv/main.nf +++ b/modules/tiddit/sv/main.nf @@ -10,7 +10,6 @@ process TIDDIT_SV { input: tuple val(meta), path(input), path(index) path fasta - path fai path bwa_index output: @@ -24,7 +23,6 @@ process TIDDIT_SV { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def reference = fasta ? "--ref $fasta" : "" """ [[ -d $bwa_index ]] && for i in `ls $bwa_index`; do [[ -f $fasta && ! "\$i" =~ .*"$fasta".* ]] && ln -s $bwa_index/\$i ${fasta}.\${i##*.} || ln -s $bwa_index/\$i \$i; done @@ -32,7 +30,7 @@ process TIDDIT_SV { --sv \\ $args \\ --bam $input \\ - $reference \\ + --ref $fasta \\ -o $prefix cat <<-END_VERSIONS > versions.yml @@ -45,8 +43,7 @@ process TIDDIT_SV { def prefix = task.ext.prefix ?: "${meta.id}" """ touch ${prefix}.vcf - touch ${prefix}.ploidy.tab - touch ${prefix}.signals.tab + touch ${prefix}.ploidies.tab cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/tiddit/sv/meta.yml b/modules/tiddit/sv/meta.yml index fc307081..8b41c69c 100644 --- a/modules/tiddit/sv/meta.yml +++ b/modules/tiddit/sv/meta.yml @@ -17,14 +17,22 @@ input: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] + - input: + type: file + description: BAM/CRAM file + pattern: "*.{bam,cram}" + - index: + type: file + description: BAM/CRAM index file + pattern: "*.{bai,crai}" - fasta: type: file description: Input FASTA file pattern: "*.{fasta,fa}" - - fai: + - bwa_index: type: file - description: FASTA index file - pattern: "*.{fai}" + description: BWA genome index files + pattern: "Directory containing BWA index *.{amb,ann,bwt,pac,sa}" output: - meta: type: map @@ -38,11 +46,7 @@ output: - ploidy: type: file description: tab - pattern: "*.{ploidy.tab}" - - signals: - type: file - description: tab - pattern: "*.{signals.tab}" + pattern: "*.{ploidies.tab}" - versions: type: file description: File containing software versions diff --git a/tests/modules/tiddit/sv/main.nf b/tests/modules/tiddit/sv/main.nf index 2c09404e..c9dbf4ea 100644 --- a/tests/modules/tiddit/sv/main.nf +++ b/tests/modules/tiddit/sv/main.nf @@ -13,9 +13,22 @@ workflow test_tiddit_sv_bam { ] fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - fai = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) BWA_INDEX( fasta ) - TIDDIT_SV ( input, fasta, fai , BWA_INDEX.out.index) + TIDDIT_SV ( input, fasta, BWA_INDEX.out.index) +} + +workflow test_tiddit_sv_cram { + input = [ + [ id:'test' ], // meta map + [ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true) ], + [ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], checkIfExists: true) ] + ] + + fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) + + BWA_INDEX( fasta ) + + TIDDIT_SV ( input, fasta, BWA_INDEX.out.index) } diff --git a/tests/modules/tiddit/sv/test.yml b/tests/modules/tiddit/sv/test.yml index 732b8434..557a0913 100644 --- a/tests/modules/tiddit/sv/test.yml +++ b/tests/modules/tiddit/sv/test.yml @@ -8,3 +8,14 @@ md5sum: 6319d3611f7b6b94425a184d274b3dfc - path: output/tiddit/test.vcf md5sum: 41d3f8746f0420f894104321b7e64f67 + +- name: tiddit sv test_tiddit_sv_cram + command: nextflow run ./tests/modules/tiddit/sv -entry test_tiddit_sv_cram -c ./tests/config/nextflow.config -c ./tests/modules/tiddit/sv/nextflow.config + tags: + - tiddit + - tiddit/sv + files: + - path: output/tiddit/test.ploidies.tab + md5sum: f1162a940ddc8b963f6e0e506bb5c136 + - path: output/tiddit/test.vcf + md5sum: 34db59578991285d6b62dc1500272fca