diff --git a/CHANGELOG.md b/CHANGELOG.md index bbc71090..7c3d7d49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ Initial release of nf-core/phaseimpute, created with the [nf-core](https://nf-co - [#148](https://github.com/nf-core/phaseimpute/pull/148) - Fix awsfulltest github action for manual dispatch - [#149](https://github.com/nf-core/phaseimpute/pull/149) - Remove the map file from the awsfulltest - [#152](https://github.com/nf-core/phaseimpute/pull/152) - Fix URLs in the documentation and remove tools citation in the README, use a white background for all images in the documentation. +- [#153](https://github.com/nf-core/phaseimpute/pull/153) - Update and simplify subworkflows snapshot and check only for files names (no md5sum for bam and vcf files due to timestamp). - [#157](https://github.com/nf-core/phaseimpute/pull/157) - Add `chunk_model` as parameter for better control over `GLIMPSE2_CHUNK` and set window size in `GLIMPSE1_CHUNK` and `GLIMPSE2_chunk` to 4mb to reduce number of chunks (empirical). ### `Fixed` @@ -74,6 +75,7 @@ Initial release of nf-core/phaseimpute, created with the [nf-core](https://nf-co - [#75](https://github.com/nf-core/phaseimpute/pull/75) - Set frequency computation with VCFFIXUP process as optional with `--compute_freq`. Use Glimpse_chunk on panel vcf to compute the chunk and not makewindows on fasta. - [#117](https://github.com/nf-core/phaseimpute/pull/117) - Fix directories in CSV. - [#151](https://github.com/nf-core/phaseimpute/pull/151) - Fix `Type not supported: class org.codehaus.groovy.runtime.GStringImpl` error due to `String` test in `getFileExtension()`. +- [#153](https://github.com/nf-core/phaseimpute/pull/153) - Fix getFileExtension function. Fix image in `usage.md`. Fix small warnings and errors with updated language server. `def` has been added when necesary, `:` use instead of `,` in assertions, `_` added to variables not used in closures, `for` loop replaced by `.each{}`, remove unused code / input. ### `Dependencies` diff --git a/main.nf b/main.nf index f5303872..0c3f01ec 100644 --- a/main.nf +++ b/main.nf @@ -126,8 +126,7 @@ workflow { params.validate_params, params.monochrome_logs, args, - params.outdir, - params.input + params.outdir ) // diff --git a/modules/local/add_columns/tests/main.nf.test.snap b/modules/local/add_columns/tests/main.nf.test.snap index aff8a268..5cf5457e 100644 --- a/modules/local/add_columns/tests/main.nf.test.snap +++ b/modules/local/add_columns/tests/main.nf.test.snap @@ -43,7 +43,7 @@ ] ], "1": [ - "versions.yml:md5,b25787d2ba80184a94de82cf5cfe8e7a" + "versions.yml:md5,ab0afe509bddeef28fcf8d00db1cec81" ], "txt": [ [ @@ -58,7 +58,7 @@ ] ], "versions": [ - "versions.yml:md5,b25787d2ba80184a94de82cf5cfe8e7a" + "versions.yml:md5,ab0afe509bddeef28fcf8d00db1cec81" ] } ], @@ -66,7 +66,7 @@ "nf-test": "0.8.4", "nextflow": "24.04.3" }, - "timestamp": "2024-07-17T14:43:39.390342082" + "timestamp": "2024-11-06T13:32:32.608346737" }, "Add columns to txt file with missing fields": { "content": [ @@ -81,7 +81,7 @@ ] ], "1": [ - "versions.yml:md5,b25787d2ba80184a94de82cf5cfe8e7a" + "versions.yml:md5,ab0afe509bddeef28fcf8d00db1cec81" ], "txt": [ [ @@ -93,7 +93,7 @@ ] ], "versions": [ - "versions.yml:md5,b25787d2ba80184a94de82cf5cfe8e7a" + "versions.yml:md5,ab0afe509bddeef28fcf8d00db1cec81" ] } ], @@ -101,6 +101,6 @@ "nf-test": "0.8.4", "nextflow": "24.04.3" }, - "timestamp": "2024-07-17T14:44:39.317216249" + "timestamp": "2024-11-06T13:32:39.650698807" } } \ No newline at end of file diff --git a/modules/local/bam_chr_extract/main.nf b/modules/local/bam_chr_extract/main.nf index 4a83b579..b82f59b8 100644 --- a/modules/local/bam_chr_extract/main.nf +++ b/modules/local/bam_chr_extract/main.nf @@ -35,7 +35,6 @@ process BAM_CHR_EXTRACT { """ stub: - def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ touch ${prefix}.txt diff --git a/modules/local/bam_chr_extract/tests/main.nf.test b/modules/local/bam_chr_extract/tests/main.nf.test index c8f13223..9c182d15 100644 --- a/modules/local/bam_chr_extract/tests/main.nf.test +++ b/modules/local/bam_chr_extract/tests/main.nf.test @@ -15,15 +15,15 @@ nextflow_process { input[0] = Channel.fromList([ [ [ id:'test_single_end_bam' ], // meta map - file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.single_end.bam', checkIfExists: true) ], [ [id: 'test2_paired_end_sorted_bam'], // meta map - file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_sorted_bam'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.sorted.bam', checkIfExists: true) ], [ [id: 'test_paired_end_sorted_cram'], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true) ] ]) """ diff --git a/modules/local/list_to_file/tests/main.nf.test.snap b/modules/local/list_to_file/tests/main.nf.test.snap index 1906937d..5e8195f9 100644 --- a/modules/local/list_to_file/tests/main.nf.test.snap +++ b/modules/local/list_to_file/tests/main.nf.test.snap @@ -7,8 +7,8 @@ { "id": "all" }, - "all_id.txt:md5,6ffc4e703a69bb652dc666a8dcae1863", - "all_noid.txt:md5,045a6e673d95a6e8152a1d06959db93a" + "all.id.txt:md5,6ffc4e703a69bb652dc666a8dcae1863", + "all.noid.txt:md5,045a6e673d95a6e8152a1d06959db93a" ] ], "1": [ @@ -19,8 +19,8 @@ { "id": "all" }, - "all_id.txt:md5,6ffc4e703a69bb652dc666a8dcae1863", - "all_noid.txt:md5,045a6e673d95a6e8152a1d06959db93a" + "all.id.txt:md5,6ffc4e703a69bb652dc666a8dcae1863", + "all.noid.txt:md5,045a6e673d95a6e8152a1d06959db93a" ] ], "versions": [ @@ -30,9 +30,9 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nextflow": "24.04.3" }, - "timestamp": "2024-10-16T16:15:18.4568228" + "timestamp": "2024-11-06T13:55:57.105169612" }, "Content_withid": { "content": [ diff --git a/modules/local/vcf_chr_extract/main.nf b/modules/local/vcf_chr_extract/main.nf index 0c50cb25..56d796d1 100644 --- a/modules/local/vcf_chr_extract/main.nf +++ b/modules/local/vcf_chr_extract/main.nf @@ -36,7 +36,6 @@ process VCF_CHR_EXTRACT { """ stub: - def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ touch ${prefix}.txt diff --git a/modules/local/vcf_chr_extract/tests/main.nf.test b/modules/local/vcf_chr_extract/tests/main.nf.test index 8306d3a6..f8a61005 100644 --- a/modules/local/vcf_chr_extract/tests/main.nf.test +++ b/modules/local/vcf_chr_extract/tests/main.nf.test @@ -15,15 +15,15 @@ nextflow_process { input[0] = Channel.fromList([ [ [id:'test_bcf'], // meta map - file(params.test_data['sarscov2']['illumina']['test_bcf'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.bcf', checkIfExists: true) ], [ [id: 'test2_vcf'], // meta map - file(params.test_data['sarscov2']['illumina']['test2_vcf'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf', checkIfExists: true) ], [ [id: 'test2_haplotc_vcf_gz'], // meta map - file(params.test_data['homo_sapiens']['illumina']['test2_haplotc_vcf_gz'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz', checkIfExists: true) ] ]) """ diff --git a/subworkflows/local/bam_chr_rename_samtools/main.nf b/subworkflows/local/bam_chr_rename_samtools/main.nf index 45435904..dbf1d6a3 100644 --- a/subworkflows/local/bam_chr_rename_samtools/main.nf +++ b/subworkflows/local/bam_chr_rename_samtools/main.nf @@ -13,6 +13,7 @@ workflow BAM_CHR_RENAME_SAMTOOLS { SAMTOOLS_REHEADER( ch_bam.map{ meta, bam, index, prefix -> + def cmd = "" if (prefix == "nochr") { cmd = 'sed -E "s/^(@SQ.*\\tSN:)chr/\\1/"' } else if (prefix == "chr") { diff --git a/subworkflows/local/bam_chr_rename_samtools/tests/main.nf.test b/subworkflows/local/bam_chr_rename_samtools/tests/main.nf.test index 63971f5c..0e3dda5b 100644 --- a/subworkflows/local/bam_chr_rename_samtools/tests/main.nf.test +++ b/subworkflows/local/bam_chr_rename_samtools/tests/main.nf.test @@ -24,14 +24,14 @@ nextflow_workflow { input[0] = Channel.fromList([ [ [id: "test_paired"], - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExist:true), - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExist:true), "nochr" ], [ [id: "test_MT"], - file(params.test_data['homo_sapiens']['illumina']['test_illumina_mt_bam'], checkIfExist:true), - file(params.test_data['homo_sapiens']['illumina']['test_illumina_mt_bam_bai'], checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test_illumina_mt.bam', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test_illumina_mt.bam.bai', checkIfExist:true), "nochr" ], ]) @@ -42,11 +42,17 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.bam_renamed.collect{ - bam(it[1]).getHeader().findAll { it.startsWith ("@SQ") } - }).match("headernochr") - } + { assert snapshot( + workflow.out.versions, + workflow.out.bam_renamed.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.bam_renamed.collect{ + bam(it[1]).getHeader().findAll { it.startsWith ("@SQ") } + } + ).match() } ) } } @@ -60,14 +66,14 @@ nextflow_workflow { input[0] = Channel.fromList([ [ [id: "test_paired"], - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExist:true), - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExist:true), "nochr" ], [ [id: "test_MT"], - file(params.test_data['homo_sapiens']['illumina']['test_illumina_mt_bam'], checkIfExist:true), - file(params.test_data['homo_sapiens']['illumina']['test_illumina_mt_bam_bai'], checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test_illumina_mt.bam', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test_illumina_mt.bam.bai', checkIfExist:true), "nochr" ], ]) @@ -87,11 +93,17 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.bam_renamed.collect{ - bam(it[1]).getHeader().findAll { it.startsWith ("@SQ") } - }).match("headerwithchr") - } + { assert snapshot( + workflow.out.versions, + workflow.out.bam_renamed.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.bam_renamed.collect{ + bam(it[1]).getHeader().findAll { it.startsWith ("@SQ") } + } + ).match() } ) } } diff --git a/subworkflows/local/bam_chr_rename_samtools/tests/main.nf.test.snap b/subworkflows/local/bam_chr_rename_samtools/tests/main.nf.test.snap index 367d8277..6f077931 100644 --- a/subworkflows/local/bam_chr_rename_samtools/tests/main.nf.test.snap +++ b/subworkflows/local/bam_chr_rename_samtools/tests/main.nf.test.snap @@ -1,138 +1,76 @@ { "Should remove chr prefix": { "content": [ - { - "0": [ - [ - { - "id": "test_MT" - }, - "test_MT_withchr.bam:md5,33f16cad4bdac734717255f29d98e9b6", - "test_MT_withchr.bam.bai:md5,dbd8f1a5df58115b6f64a9312133d79d" - ], - [ - { - "id": "test_paired" - }, - "test_paired_withchr.bam:md5,c6908df90282cc95e846eee31476bb47", - "test_paired_withchr.bam.bai:md5,77524c609a3001cdca9c7d10dcc14b6a" - ] - ], - "1": [ - "versions.yml:md5,42dd37f7dc7e85848f3bb65119dae337", - "versions.yml:md5,790a460c300d89aacfc941946b06b61d" - ], - "bam_renamed": [ - [ - { - "id": "test_MT" - }, - "test_MT_withchr.bam:md5,33f16cad4bdac734717255f29d98e9b6", - "test_MT_withchr.bam.bai:md5,dbd8f1a5df58115b6f64a9312133d79d" - ], - [ - { - "id": "test_paired" - }, - "test_paired_withchr.bam:md5,c6908df90282cc95e846eee31476bb47", - "test_paired_withchr.bam.bai:md5,77524c609a3001cdca9c7d10dcc14b6a" - ] + [ + "versions.yml:md5,3777f4a1f04f5087333fbe98eee09df9", + "versions.yml:md5,fc2d8252e26e8b681f2dd73d8b08fdde" + ], + [ + [ + { + "id": "test_MT" + }, + "test_MT_withchr.bam", + "test_MT_withchr.bam.bai" ], - "versions": [ - "versions.yml:md5,42dd37f7dc7e85848f3bb65119dae337", - "versions.yml:md5,790a460c300d89aacfc941946b06b61d" + [ + { + "id": "test_paired" + }, + "test_paired_withchr.bam", + "test_paired_withchr.bam.bai" ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" - }, - "timestamp": "2024-07-17T15:22:44.813965855" - }, - "headernochr": { - "content": [ + ], [ [ "@SQ\tSN:M\tLN:16569" ], [ - "@SQ\tSN:22\tLN:40001" + "@SQ\tSN:MT192765.1\tLN:29829" ] ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-06-19T12:32:09.649153266" + "timestamp": "2024-11-07T13:27:45.777831517" }, "Should add chr prefix": { "content": [ - { - "0": [ - [ - { - "id": "test_MT" - }, - "test_MT_withchr.bam:md5,07e733c5bdb64f2f48ceb1eafbb0d120", - "test_MT_withchr.bam.bai:md5,33b4ed892348364beceb9a2bfba07448" - ], - [ - { - "id": "test_paired" - }, - "test_paired_withchr.bam:md5,a4d6b2b5a077ec1d7bdd459c15fe49d0", - "test_paired_withchr.bam.bai:md5,592b3771c867dfb0b31b14e4a578e795" - ] - ], - "1": [ - "versions.yml:md5,42dd37f7dc7e85848f3bb65119dae337", - "versions.yml:md5,790a460c300d89aacfc941946b06b61d" - ], - "bam_renamed": [ - [ - { - "id": "test_MT" - }, - "test_MT_withchr.bam:md5,07e733c5bdb64f2f48ceb1eafbb0d120", - "test_MT_withchr.bam.bai:md5,33b4ed892348364beceb9a2bfba07448" - ], - [ - { - "id": "test_paired" - }, - "test_paired_withchr.bam:md5,a4d6b2b5a077ec1d7bdd459c15fe49d0", - "test_paired_withchr.bam.bai:md5,592b3771c867dfb0b31b14e4a578e795" - ] + [ + "versions.yml:md5,3777f4a1f04f5087333fbe98eee09df9", + "versions.yml:md5,fc2d8252e26e8b681f2dd73d8b08fdde" + ], + [ + [ + { + "id": "test_MT" + }, + "test_MT_withchr.bam", + "test_MT_withchr.bam.bai" ], - "versions": [ - "versions.yml:md5,42dd37f7dc7e85848f3bb65119dae337", - "versions.yml:md5,790a460c300d89aacfc941946b06b61d" + [ + { + "id": "test_paired" + }, + "test_paired_withchr.bam", + "test_paired_withchr.bam.bai" ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" - }, - "timestamp": "2024-07-17T15:22:55.966994758" - }, - "headerwithchr": { - "content": [ + ], [ [ "@SQ\tSN:chrM\tLN:16569" ], [ - "@SQ\tSN:chr22\tLN:40001" + "@SQ\tSN:chrMT192765.1\tLN:29829" ] ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-06-19T12:34:52.016067829" + "timestamp": "2024-11-07T13:28:15.125413039" } } \ No newline at end of file diff --git a/subworkflows/local/bam_downsample_samtools/main.nf b/subworkflows/local/bam_downsample_samtools/main.nf index 9aaa0f65..304a5a92 100644 --- a/subworkflows/local/bam_downsample_samtools/main.nf +++ b/subworkflows/local/bam_downsample_samtools/main.nf @@ -35,7 +35,7 @@ workflow BAM_DOWNSAMPLE_SAMTOOLS { // Add all necessary channel for downsampling ch_input_downsample = ch_bam .combine(ch_depth_factor, by : 0) - .map{ metaICR, bam, index, metaICRD, depth -> + .map{ _metaICR, bam, index, metaICRD, depth -> [ metaICRD, bam, index, [], depth ] } diff --git a/subworkflows/local/bam_downsample_samtools/tests/main.nf.test b/subworkflows/local/bam_downsample_samtools/tests/main.nf.test index 1ff32b6b..05ab92e2 100644 --- a/subworkflows/local/bam_downsample_samtools/tests/main.nf.test +++ b/subworkflows/local/bam_downsample_samtools/tests/main.nf.test @@ -50,8 +50,17 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.bam_emul.collect{ bam(it[1]).getReads().size() }).match("Reads2X") } + { assert snapshot( + workflow.out.versions, + workflow.out.bam_emul.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.bam_emul.collect{ + bam(it[1]).getReads().size() + } + ).match() } ) } } @@ -89,8 +98,17 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.bam_emul.collect{ bam(it[1]).getReads().size() }).match("Reads4X") } + { assert snapshot( + workflow.out.versions, + workflow.out.bam_emul.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.bam_emul.collect{ + bam(it[1]).getReads().size() + } + ).match() } ) } } diff --git a/subworkflows/local/bam_downsample_samtools/tests/main.nf.test.snap b/subworkflows/local/bam_downsample_samtools/tests/main.nf.test.snap index 26c8d0ca..5eacd50a 100644 --- a/subworkflows/local/bam_downsample_samtools/tests/main.nf.test.snap +++ b/subworkflows/local/bam_downsample_samtools/tests/main.nf.test.snap @@ -1,142 +1,74 @@ { "Downsample to 2X": { "content": [ - { - "0": [ - [ - { - "id": "NA12878", - "depth": 2 - }, - "NA12878.bam:md5,c998482010b83365a4889c3fa75ac578", - "NA12878.bam.csi:md5,0b4abd161cdcc2b51571c9cc651df354" - ], - [ - { - "id": "NA19401", - "depth": 2 - }, - "NA19401.bam:md5,6b144e7adc1f9e6711aea0e4772c5937", - "NA19401.bam.csi:md5,36c29896003f2de5306ff427a969058c" - ] - ], - "1": [ - "versions.yml:md5,88f1d64445acc1f44531d7897b0f2684", - "versions.yml:md5,9eef568f4fc903d70199abf5a48bd08f", - "versions.yml:md5,de64e28f766e3c91df1b353fd0a92e71" - ], - "bam_emul": [ - [ - { - "id": "NA12878", - "depth": 2 - }, - "NA12878.bam:md5,c998482010b83365a4889c3fa75ac578", - "NA12878.bam.csi:md5,0b4abd161cdcc2b51571c9cc651df354" - ], - [ - { - "id": "NA19401", - "depth": 2 - }, - "NA19401.bam:md5,6b144e7adc1f9e6711aea0e4772c5937", - "NA19401.bam.csi:md5,36c29896003f2de5306ff427a969058c" - ] - ], - "versions": [ - "versions.yml:md5,88f1d64445acc1f44531d7897b0f2684", - "versions.yml:md5,9eef568f4fc903d70199abf5a48bd08f", - "versions.yml:md5,de64e28f766e3c91df1b353fd0a92e71" - ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" - }, - "timestamp": "2024-07-17T15:34:43.478151313" - }, - "Downsample to 4X": { - "content": [ - { - "0": [ - [ - { - "id": "NA12878", - "depth": 4 - }, - "NA12878.bam:md5,d6045df32f7c77d5c863b2068739faa9", - "NA12878.bam.csi:md5,3f8f9a17463b6c2391c632681d3f253a" - ], - [ - { - "id": "NA19401", - "depth": 4 - }, - "NA19401.bam:md5,3b0d20e5f44952135a547c6230117460", - "NA19401.bam.csi:md5,b44701d7d4de827cc1b83aaeb397deaf" - ] - ], - "1": [ - "versions.yml:md5,88f1d64445acc1f44531d7897b0f2684", - "versions.yml:md5,9eef568f4fc903d70199abf5a48bd08f", - "versions.yml:md5,de64e28f766e3c91df1b353fd0a92e71" - ], - "bam_emul": [ - [ - { - "id": "NA12878", - "depth": 4 - }, - "NA12878.bam:md5,d6045df32f7c77d5c863b2068739faa9", - "NA12878.bam.csi:md5,3f8f9a17463b6c2391c632681d3f253a" - ], - [ - { - "id": "NA19401", - "depth": 4 - }, - "NA19401.bam:md5,3b0d20e5f44952135a547c6230117460", - "NA19401.bam.csi:md5,b44701d7d4de827cc1b83aaeb397deaf" - ] + [ + "versions.yml:md5,43ed2e6d85cac7ccd2fb22a733f585dc", + "versions.yml:md5,9eef568f4fc903d70199abf5a48bd08f", + "versions.yml:md5,a61d007b27e86103db8d68a8c79a98fb" + ], + [ + [ + { + "id": "NA12878", + "depth": 2 + }, + "NA12878.bam", + "NA12878.bam.csi" ], - "versions": [ - "versions.yml:md5,88f1d64445acc1f44531d7897b0f2684", - "versions.yml:md5,9eef568f4fc903d70199abf5a48bd08f", - "versions.yml:md5,de64e28f766e3c91df1b353fd0a92e71" + [ + { + "id": "NA19401", + "depth": 2 + }, + "NA19401.bam", + "NA19401.bam.csi" ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" - }, - "timestamp": "2024-07-17T15:34:15.168143808" - }, - "Reads2X": { - "content": [ + ], [ 1164, 1196 ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-17T15:34:43.895894693" + "timestamp": "2024-11-07T13:28:49.191579339" }, - "Reads4X": { + "Downsample to 4X": { "content": [ + [ + "versions.yml:md5,43ed2e6d85cac7ccd2fb22a733f585dc", + "versions.yml:md5,9eef568f4fc903d70199abf5a48bd08f", + "versions.yml:md5,a61d007b27e86103db8d68a8c79a98fb" + ], + [ + [ + { + "id": "NA12878", + "depth": 4 + }, + "NA12878.bam", + "NA12878.bam.csi" + ], + [ + { + "id": "NA19401", + "depth": 4 + }, + "NA19401.bam", + "NA19401.bam.csi" + ] + ], [ 2402, 2321 ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-17T15:34:15.646735174" + "timestamp": "2024-11-07T13:29:24.179563513" } } \ No newline at end of file diff --git a/subworkflows/local/bam_gl_bcftools/main.nf b/subworkflows/local/bam_gl_bcftools/main.nf index 4fd140bb..5b0d9b0d 100644 --- a/subworkflows/local/bam_gl_bcftools/main.nf +++ b/subworkflows/local/bam_gl_bcftools/main.nf @@ -26,7 +26,7 @@ workflow BAM_GL_BCFTOOLS { ch_mpileup = ch_bam .combine(TABIX_BGZIP.out.output) - .map{metaI, bam, bai, metaPC, tsv -> + .map{metaI, bam, _bai, metaPC, tsv -> [metaI + ["panel": metaPC.id, "chr": metaPC.chr], bam, tsv] } diff --git a/subworkflows/local/bam_gl_bcftools/tests/main.nf.test b/subworkflows/local/bam_gl_bcftools/tests/main.nf.test index da716dd9..027a5969 100644 --- a/subworkflows/local/bam_gl_bcftools/tests/main.nf.test +++ b/subworkflows/local/bam_gl_bcftools/tests/main.nf.test @@ -50,8 +50,17 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }).match("Summary_merge") } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ + path(it[1]).vcf.summary + } + ).match() } ) } } @@ -83,8 +92,17 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }).match("Summary_one") } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ + path(it[1]).vcf.summary + } + ).match() } ) } } diff --git a/subworkflows/local/bam_gl_bcftools/tests/main.nf.test.snap b/subworkflows/local/bam_gl_bcftools/tests/main.nf.test.snap index 7203e479..71b76e85 100644 --- a/subworkflows/local/bam_gl_bcftools/tests/main.nf.test.snap +++ b/subworkflows/local/bam_gl_bcftools/tests/main.nf.test.snap @@ -1,162 +1,76 @@ { "Compute genotype likelihood with merging": { "content": [ - { - "0": [ - [ - { - "panel": "1000GP", - "chr": "22", - "id": "all", - "metas": [ - { - "id": "NA12878", - "panel": "1000GP", - "chr": "22" - }, - { - "id": "NA19401", - "panel": "1000GP", - "chr": "22" - } - ], - "variantcaller": "bcftools" - }, - "all.annotate.vcf.gz:md5,fd2e606f302c569d276011254a95a728", - "all.annotate.vcf.gz.tbi:md5,e22a83a66d796dca37eab6d75e76f9c3" - ] - ], - "1": [ - "versions.yml:md5,3779c6b3c000bc757d3d6109010518b0", - "versions.yml:md5,4739962c934731254db8b31083aa0df5", - "versions.yml:md5,544ff5e39aa23f18c41587a739beaf34", - "versions.yml:md5,74118beefc19065bed2de5d60277be55", - "versions.yml:md5,c9d32dd20061f19422ff4d4b6f3fb24d", - "versions.yml:md5,c9d32dd20061f19422ff4d4b6f3fb24d" - ], - "2": [ - "NA12878.bcftools_stats.txt:md5,4cacbe4d6dfba4a8035e37611c91923c", - "NA19401.bcftools_stats.txt:md5,f91fd586acfdf3845d111a062fbb263f" - ], - "multiqc_files": [ - "NA12878.bcftools_stats.txt:md5,4cacbe4d6dfba4a8035e37611c91923c", - "NA19401.bcftools_stats.txt:md5,f91fd586acfdf3845d111a062fbb263f" - ], - "vcf_tbi": [ - [ - { - "panel": "1000GP", - "chr": "22", - "id": "all", - "metas": [ - { - "id": "NA12878", - "panel": "1000GP", - "chr": "22" - }, - { - "id": "NA19401", - "panel": "1000GP", - "chr": "22" - } - ], - "variantcaller": "bcftools" - }, - "all.annotate.vcf.gz:md5,fd2e606f302c569d276011254a95a728", - "all.annotate.vcf.gz.tbi:md5,e22a83a66d796dca37eab6d75e76f9c3" - ] - ], - "versions": [ - "versions.yml:md5,3779c6b3c000bc757d3d6109010518b0", - "versions.yml:md5,4739962c934731254db8b31083aa0df5", - "versions.yml:md5,544ff5e39aa23f18c41587a739beaf34", - "versions.yml:md5,74118beefc19065bed2de5d60277be55", - "versions.yml:md5,c9d32dd20061f19422ff4d4b6f3fb24d", - "versions.yml:md5,c9d32dd20061f19422ff4d4b6f3fb24d" + [ + "versions.yml:md5,0980a298fde671494f5b4e9cb3a6ebc2", + "versions.yml:md5,4739962c934731254db8b31083aa0df5", + "versions.yml:md5,544ff5e39aa23f18c41587a739beaf34", + "versions.yml:md5,74118beefc19065bed2de5d60277be55", + "versions.yml:md5,c9d32dd20061f19422ff4d4b6f3fb24d", + "versions.yml:md5,c9d32dd20061f19422ff4d4b6f3fb24d" + ], + [ + [ + { + "panel": "1000GP", + "chr": "22", + "id": "all", + "metas": [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "22" + }, + { + "id": "NA19401", + "panel": "1000GP", + "chr": "22" + } + ], + "variantcaller": "bcftools" + }, + "all.annotate.vcf.gz", + "all.annotate.vcf.gz.tbi" ] - } + ], + [ + "VcfFile [chromosomes=[chr22], sampleCount=2, variantCount=903, phased=false, phasedAutodetect=false]" + ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-16T09:20:35.609695151" + "timestamp": "2024-11-07T13:49:19.689761982" }, "Compute genotype likelihood with only one input": { "content": [ - { - "0": [ - [ - { - "id": "NA12878", - "panel": "1000GP", - "chr": "22", - "variantcaller": "bcftools" - }, - "NA12878.annotate.vcf.gz:md5,147ae3772f40a430036c7fabd10bb977", - "NA12878.annotate.vcf.gz.tbi:md5,a31b4a912de0ab6e1c7a13ed18ccc153" - ] - ], - "1": [ - "versions.yml:md5,3779c6b3c000bc757d3d6109010518b0", - "versions.yml:md5,4739962c934731254db8b31083aa0df5", - "versions.yml:md5,544ff5e39aa23f18c41587a739beaf34", - "versions.yml:md5,c9d32dd20061f19422ff4d4b6f3fb24d" - ], - "2": [ - "NA12878.bcftools_stats.txt:md5,4cacbe4d6dfba4a8035e37611c91923c" - ], - "multiqc_files": [ - "NA12878.bcftools_stats.txt:md5,4cacbe4d6dfba4a8035e37611c91923c" - ], - "vcf_tbi": [ - [ - { - "id": "NA12878", - "panel": "1000GP", - "chr": "22", - "variantcaller": "bcftools" - }, - "NA12878.annotate.vcf.gz:md5,147ae3772f40a430036c7fabd10bb977", - "NA12878.annotate.vcf.gz.tbi:md5,a31b4a912de0ab6e1c7a13ed18ccc153" - ] - ], - "versions": [ - "versions.yml:md5,3779c6b3c000bc757d3d6109010518b0", - "versions.yml:md5,4739962c934731254db8b31083aa0df5", - "versions.yml:md5,544ff5e39aa23f18c41587a739beaf34", - "versions.yml:md5,c9d32dd20061f19422ff4d4b6f3fb24d" + [ + "versions.yml:md5,0980a298fde671494f5b4e9cb3a6ebc2", + "versions.yml:md5,4739962c934731254db8b31083aa0df5", + "versions.yml:md5,544ff5e39aa23f18c41587a739beaf34", + "versions.yml:md5,c9d32dd20061f19422ff4d4b6f3fb24d" + ], + [ + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "22", + "variantcaller": "bcftools" + }, + "NA12878.annotate.vcf.gz", + "NA12878.annotate.vcf.gz.tbi" ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-16T09:21:00.8044734" - }, - "Summary_one": { - "content": [ + ], [ "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=false, phasedAutodetect=false]" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-15T18:40:28.756168568" - }, - "Summary_merge": { - "content": [ - [ - "VcfFile [chromosomes=[chr22], sampleCount=2, variantCount=903, phased=false, phasedAutodetect=false]" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-15T18:35:39.946019792" + "timestamp": "2024-11-07T13:50:09.373771371" } } \ No newline at end of file diff --git a/subworkflows/local/bam_impute_glimpse2/main.nf b/subworkflows/local/bam_impute_glimpse2/main.nf index f8e704c1..63a913cd 100644 --- a/subworkflows/local/bam_impute_glimpse2/main.nf +++ b/subworkflows/local/bam_impute_glimpse2/main.nf @@ -7,7 +7,7 @@ include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_2 } from '../../../modules/nf-core/bc workflow BAM_IMPUTE_GLIMPSE2 { take: - ch_input // channel (mandatory): [ [id], bam, bai, bamlist ] + ch_input // channel (mandatory): [ [id], [bam], [bai], bamlist ] ch_panel // channel (mandatory): [ [panel, chr], vcf, tbi ] ch_chunks // channel (optional): [ [panel, chr], region1, region2 ] ch_fasta // channel (mandatory): [ [genome], fa, fai ] diff --git a/subworkflows/local/bam_impute_glimpse2/tests/main.nf.test b/subworkflows/local/bam_impute_glimpse2/tests/main.nf.test index 662aad85..b6a2bc6c 100644 --- a/subworkflows/local/bam_impute_glimpse2/tests/main.nf.test +++ b/subworkflows/local/bam_impute_glimpse2/tests/main.nf.test @@ -26,6 +26,7 @@ nextflow_workflow { [id: "NA12878"], file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bcf", checkIfExist:true), file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bcf.csi", checkIfExist:true), + [] ] ]) input[1] = Channel.of([ @@ -49,28 +50,41 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }).match("Summary_one_vcf") } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() } + ).match() } ) } } - test("Impute with glimpse2 two individuals - input bam") { + test("Impute with glimpse2 two individuals - input bam with bamlist") { when { workflow { """ + bamlist = Channel.of( + "NA12878.s.bam\tNA12878", + "NA19401.s.bam\tNA19401" + ).collectFile(name: 'bamlist.txt', newLine: true) input[0] = Channel.fromList([ [ - [id: "NA12878"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), + [id: "allid"], + [ + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam", checkIfExist:true) + ], + [ + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExist:true) + ] ], - [ - [id: "NA19401"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExist:true), - ], - ]) + ]).combine(bamlist) input[1] = Channel.of([ [id: "1000GP", chr: "22"], file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.s.norel.vcf.gz", checkIfExist:true), @@ -92,23 +106,34 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }).match("Summary_two_merged") } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() } + ).match() } ) } } - test("Impute with glimpse2 one individual - input file bam") { + test("Impute with glimpse2 one individual - input file bam with bamlist") { when { workflow { """ + bamlist = Channel.of( + "NA12878.s.bam\tNA12878" + ).collectFile(name: 'bamlist.txt', newLine: true) input[0] = Channel.fromList([ [ [id: "NA12878"], file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), ] - ]) + ]).combine(bamlist) input[1] = Channel.of([ [id: "1000GP", chr: "22"], file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.s.norel.vcf.gz", checkIfExist:true), @@ -130,8 +155,16 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }).match("Summary_one") } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() } + ).match() } ) } } diff --git a/subworkflows/local/bam_impute_glimpse2/tests/main.nf.test.snap b/subworkflows/local/bam_impute_glimpse2/tests/main.nf.test.snap index 89e2355c..7a717fc9 100644 --- a/subworkflows/local/bam_impute_glimpse2/tests/main.nf.test.snap +++ b/subworkflows/local/bam_impute_glimpse2/tests/main.nf.test.snap @@ -1,227 +1,114 @@ { - "Summary_one_vcf": { + "Impute with glimpse2 one vcf - input bcf": { "content": [ [ - "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=true]" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-15T20:24:53.138873933" - }, - "Impute with glimpse2 one vcf": { - "content": [ - { - "0": [ - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - } - ], - "panel": "1000GP", - "chr": "22", - "tools": "glimpse2" - }, - "all.vcf.gz:md5,12871b9108b2c39091710b220efe66e4", - "all.vcf.gz.tbi:md5,91cf385c7f8783ab54ab71f2c7c3d0d6" - ] - ], - "1": [ - "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", - "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", - "versions.yml:md5,1d8512dd2d5f6649a1111faabd24b399", - "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", - "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", - "versions.yml:md5,7d3bb3301fbcde0b12f553a2ae7d5b56" - ], - "vcf_tbi": [ - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - } - ], - "panel": "1000GP", - "chr": "22", - "tools": "glimpse2" - }, - "all.vcf.gz:md5,12871b9108b2c39091710b220efe66e4", - "all.vcf.gz.tbi:md5,91cf385c7f8783ab54ab71f2c7c3d0d6" - ] - ], - "versions": [ - "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", - "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", - "versions.yml:md5,1d8512dd2d5f6649a1111faabd24b399", - "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", - "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", - "versions.yml:md5,7d3bb3301fbcde0b12f553a2ae7d5b56" + "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", + "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", + "versions.yml:md5,1d8512dd2d5f6649a1111faabd24b399", + "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", + "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", + "versions.yml:md5,7d3bb3301fbcde0b12f553a2ae7d5b56" + ], + [ + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "22", + "tools": "glimpse2" + }, + "NA12878.vcf.gz", + "NA12878.vcf.gz.tbi" ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-15T20:24:49.977614625" - }, - "Summary_two_merged": { - "content": [ + ], [ - "VcfFile [chromosomes=[chr22], sampleCount=2, variantCount=903, phased=true, phasedAutodetect=true]" + "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=true]" + ], + [ + [ + "NA12878" + ] ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-15T19:54:55.708226897" + "timestamp": "2024-11-07T13:51:00.205148681" }, - "Summary_one": { + "Impute with glimpse2 one individual - input file bam with bamlist": { "content": [ + [ + "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", + "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", + "versions.yml:md5,1d8512dd2d5f6649a1111faabd24b399", + "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", + "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", + "versions.yml:md5,7d3bb3301fbcde0b12f553a2ae7d5b56" + ], + [ + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "22", + "tools": "glimpse2" + }, + "NA12878.vcf.gz", + "NA12878.vcf.gz.tbi" + ] + ], [ "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=true]" + ], + [ + [ + "NA12878" + ] ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-15T19:55:29.713768601" + "timestamp": "2024-11-07T13:52:40.66012322" }, - "Impute with glimpse2 two individuals": { + "Impute with glimpse2 two individuals - input bam with bamlist": { "content": [ - { - "0": [ - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - }, - { - "id": "NA19401" - } - ], - "panel": "1000GP", - "chr": "22", - "tools": "glimpse2" - }, - "all.vcf.gz:md5,89ac8fb35689ac345bbda89d26769985", - "all.vcf.gz.tbi:md5,3835e25e3ba02449c03f86d1d44bc4dd" - ] - ], - "1": [ - "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", - "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", - "versions.yml:md5,1d8512dd2d5f6649a1111faabd24b399", - "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", - "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", - "versions.yml:md5,7d3bb3301fbcde0b12f553a2ae7d5b56" - ], - "vcf_tbi": [ - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - }, - { - "id": "NA19401" - } - ], - "panel": "1000GP", - "chr": "22", - "tools": "glimpse2" - }, - "all.vcf.gz:md5,89ac8fb35689ac345bbda89d26769985", - "all.vcf.gz.tbi:md5,3835e25e3ba02449c03f86d1d44bc4dd" - ] - ], - "versions": [ - "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", - "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", - "versions.yml:md5,1d8512dd2d5f6649a1111faabd24b399", - "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", - "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", - "versions.yml:md5,7d3bb3301fbcde0b12f553a2ae7d5b56" + [ + "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", + "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", + "versions.yml:md5,1d8512dd2d5f6649a1111faabd24b399", + "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", + "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", + "versions.yml:md5,7d3bb3301fbcde0b12f553a2ae7d5b56" + ], + [ + [ + { + "id": "allid", + "panel": "1000GP", + "chr": "22", + "tools": "glimpse2" + }, + "allid.vcf.gz", + "allid.vcf.gz.tbi" ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-15T20:25:23.722053705" - }, - "Impute with glimpse2 one individual": { - "content": [ - { - "0": [ - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - } - ], - "panel": "1000GP", - "chr": "22", - "tools": "glimpse2" - }, - "all.vcf.gz:md5,122c2635b67460edf3a02e80069dcd81", - "all.vcf.gz.tbi:md5,f23fdc8f1678df5a351cd8d359f6a5cd" - ] - ], - "1": [ - "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", - "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", - "versions.yml:md5,1d8512dd2d5f6649a1111faabd24b399", - "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", - "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", - "versions.yml:md5,7d3bb3301fbcde0b12f553a2ae7d5b56" - ], - "vcf_tbi": [ - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - } - ], - "panel": "1000GP", - "chr": "22", - "tools": "glimpse2" - }, - "all.vcf.gz:md5,122c2635b67460edf3a02e80069dcd81", - "all.vcf.gz.tbi:md5,f23fdc8f1678df5a351cd8d359f6a5cd" - ] - ], - "versions": [ - "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", - "versions.yml:md5,02e20b0099653bc476dac65a92e768c1", - "versions.yml:md5,1d8512dd2d5f6649a1111faabd24b399", - "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", - "versions.yml:md5,2bfd212564086adb64cf01741a0d83ad", - "versions.yml:md5,7d3bb3301fbcde0b12f553a2ae7d5b56" + ], + [ + "VcfFile [chromosomes=[chr22], sampleCount=2, variantCount=903, phased=true, phasedAutodetect=true]" + ], + [ + [ + "NA12878", + "NA19401" ] - } + ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-15T20:25:54.091419593" + "timestamp": "2024-11-07T13:51:55.269054819" } -} +} \ No newline at end of file diff --git a/subworkflows/local/bam_impute_quilt/main.nf b/subworkflows/local/bam_impute_quilt/main.nf index c15555a9..94c891aa 100644 --- a/subworkflows/local/bam_impute_quilt/main.nf +++ b/subworkflows/local/bam_impute_quilt/main.nf @@ -18,12 +18,12 @@ workflow BAM_IMPUTE_QUILT { posfile_phasefile = [[id: null], posfile, phasefile] genetic_map_file = [] - ngen = params.ngen - buffer = params.buffer + ngen_params = params.ngen + buffer_params = params.buffer ch_hap_chunks = ch_hap_legend .combine(ch_chunks, by:0) - .map { it + ngen + buffer + [[]] } + .map { it + ngen_params + buffer_params + [[]] } if (!genetic_map_file.isEmpty()) { // Add genetic map file (untested) diff --git a/subworkflows/local/bam_impute_quilt/tests/main.nf.test b/subworkflows/local/bam_impute_quilt/tests/main.nf.test index ee1e86fe..57e19e49 100644 --- a/subworkflows/local/bam_impute_quilt/tests/main.nf.test +++ b/subworkflows/local/bam_impute_quilt/tests/main.nf.test @@ -17,22 +17,27 @@ nextflow_workflow { tag "bcftools/index" tag "bcftools/annotate" - test("Impute with quilt two individuals") { + test("Impute with quilt two individuals with bamlist") { when { workflow { """ + bamlist = Channel.of( + "NA12878.s.bam", + "NA19401.s.bam" + ).collectFile(name: 'bamlist.txt', newLine: true) input[0] = Channel.fromList([ [ - [id: "NA12878"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), + [id: "allid"], + [ + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam", checkIfExist:true) + ], + [ + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExist:true) + ] ], - [ - [id: "NA19401"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExist:true), - ], - ]) + ]).combine(bamlist) input[1] = Channel.of([ [id: "1000GP", chr: "22"], file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.hap.gz", checkIfExist:true), @@ -53,8 +58,16 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }).match("Summary_two_merged") } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() } + ).match() } ) } } @@ -68,6 +81,7 @@ nextflow_workflow { [id: "NA12878"], file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), + [] ] ]) input[1] = Channel.of([ @@ -90,8 +104,16 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }).match("Summary_one") } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() } + ).match() } ) } } diff --git a/subworkflows/local/bam_impute_quilt/tests/main.nf.test.snap b/subworkflows/local/bam_impute_quilt/tests/main.nf.test.snap index 95f372f7..1136b7f1 100644 --- a/subworkflows/local/bam_impute_quilt/tests/main.nf.test.snap +++ b/subworkflows/local/bam_impute_quilt/tests/main.nf.test.snap @@ -1,214 +1,102 @@ { - "Summary_two_merged": { + "Impute with quilt two individuals with bamlist": { "content": [ + [ + "versions.yml:md5,ac2d0f2a8e77cd796d3b4b84fdd46b0d", + "versions.yml:md5,cb038a1f67a47a76d0e0a983cfd56789" + ], + [ + [ + { + "id": "allid", + "panel": "1000GP", + "chr": "22", + "chunk": "16570065-16597215", + "tools": "quilt" + }, + "allid_22_16570065-16597215.impute.annotate.vcf.gz", + "allid_22_16570065-16597215.impute.annotate.vcf.gz.tbi" + ], + [ + { + "id": "allid", + "panel": "1000GP", + "chr": "22", + "chunk": "16587172-16609999", + "tools": "quilt" + }, + "allid_22_16587172-16609999.impute.annotate.vcf.gz", + "allid_22_16587172-16609999.impute.annotate.vcf.gz.tbi" + ] + ], [ "VcfFile [chromosomes=[chr22], sampleCount=2, variantCount=572, phased=true, phasedAutodetect=false]", "VcfFile [chromosomes=[chr22], sampleCount=2, variantCount=570, phased=true, phasedAutodetect=false]" + ], + [ + [ + "NA12878", + "NA19401" + ], + [ + "NA12878", + "NA19401" + ] ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-15T20:00:44.163346211" + "timestamp": "2024-11-07T13:53:40.231874326" }, "Impute with quilt one individuals": { "content": [ - { - "0": [ - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - } - ], - "panel": "1000GP", - "chr": "22", - "chunk": "16570065-16597215", - "tools": "quilt" - }, - "all_22_16570065-16597215.impute.annotate.vcf.gz:md5,07016f1c2868ff055cda46741e897d8d", - "all_22_16570065-16597215.impute.annotate.vcf.gz.tbi:md5,f668f1f8308eb2d8aeae52871d496cf4" - ], - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - } - ], - "panel": "1000GP", - "chr": "22", - "chunk": "16587172-16609999", - "tools": "quilt" - }, - "all_22_16587172-16609999.impute.annotate.vcf.gz:md5,e62bc794624cabf26e2e133009d3bc39", - "all_22_16587172-16609999.impute.annotate.vcf.gz.tbi:md5,9eb3329cfc035f61ec26a68c1ecc2457" - ] - ], - "1": [ - "versions.yml:md5,ac2d0f2a8e77cd796d3b4b84fdd46b0d", - "versions.yml:md5,cb038a1f67a47a76d0e0a983cfd56789" - ], - "vcf_tbi": [ - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - } - ], - "panel": "1000GP", - "chr": "22", - "chunk": "16570065-16597215", - "tools": "quilt" - }, - "all_22_16570065-16597215.impute.annotate.vcf.gz:md5,07016f1c2868ff055cda46741e897d8d", - "all_22_16570065-16597215.impute.annotate.vcf.gz.tbi:md5,f668f1f8308eb2d8aeae52871d496cf4" - ], - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - } - ], - "panel": "1000GP", - "chr": "22", - "chunk": "16587172-16609999", - "tools": "quilt" - }, - "all_22_16587172-16609999.impute.annotate.vcf.gz:md5,e62bc794624cabf26e2e133009d3bc39", - "all_22_16587172-16609999.impute.annotate.vcf.gz.tbi:md5,9eb3329cfc035f61ec26a68c1ecc2457" - ] + [ + "versions.yml:md5,ac2d0f2a8e77cd796d3b4b84fdd46b0d", + "versions.yml:md5,cb038a1f67a47a76d0e0a983cfd56789" + ], + [ + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "22", + "chunk": "16570065-16597215", + "tools": "quilt" + }, + "NA12878_22_16570065-16597215.impute.annotate.vcf.gz", + "NA12878_22_16570065-16597215.impute.annotate.vcf.gz.tbi" ], - "versions": [ - "versions.yml:md5,ac2d0f2a8e77cd796d3b4b84fdd46b0d", - "versions.yml:md5,cb038a1f67a47a76d0e0a983cfd56789" + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "22", + "chunk": "16587172-16609999", + "tools": "quilt" + }, + "NA12878_22_16587172-16609999.impute.annotate.vcf.gz", + "NA12878_22_16587172-16609999.impute.annotate.vcf.gz.tbi" ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-15T20:08:59.438126764" - }, - "Summary_one": { - "content": [ + ], [ "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=572, phased=true, phasedAutodetect=false]", "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=570, phased=true, phasedAutodetect=false]" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-15T20:05:13.062670619" - }, - "Impute with quilt two individuals": { - "content": [ - { - "0": [ - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - }, - { - "id": "NA19401" - } - ], - "panel": "1000GP", - "chr": "22", - "chunk": "16570065-16597215", - "tools": "quilt" - }, - "all_22_16570065-16597215.impute.annotate.vcf.gz:md5,ba2623c16adec2fc9ff7aa7211fb92b5", - "all_22_16570065-16597215.impute.annotate.vcf.gz.tbi:md5,fd2ab3c90342ed70566a08d848e3d736" - ], - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - }, - { - "id": "NA19401" - } - ], - "panel": "1000GP", - "chr": "22", - "chunk": "16587172-16609999", - "tools": "quilt" - }, - "all_22_16587172-16609999.impute.annotate.vcf.gz:md5,f158aa492dfa4966a28b44b99cd7beb1", - "all_22_16587172-16609999.impute.annotate.vcf.gz.tbi:md5,d3a6b0077504e48aadaa15d179733ffb" - ] - ], - "1": [ - "versions.yml:md5,ac2d0f2a8e77cd796d3b4b84fdd46b0d", - "versions.yml:md5,cb038a1f67a47a76d0e0a983cfd56789" - ], - "vcf_tbi": [ - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - }, - { - "id": "NA19401" - } - ], - "panel": "1000GP", - "chr": "22", - "chunk": "16570065-16597215", - "tools": "quilt" - }, - "all_22_16570065-16597215.impute.annotate.vcf.gz:md5,ba2623c16adec2fc9ff7aa7211fb92b5", - "all_22_16570065-16597215.impute.annotate.vcf.gz.tbi:md5,fd2ab3c90342ed70566a08d848e3d736" - ], - [ - { - "id": "all", - "metas": [ - { - "id": "NA12878" - }, - { - "id": "NA19401" - } - ], - "panel": "1000GP", - "chr": "22", - "chunk": "16587172-16609999", - "tools": "quilt" - }, - "all_22_16587172-16609999.impute.annotate.vcf.gz:md5,f158aa492dfa4966a28b44b99cd7beb1", - "all_22_16587172-16609999.impute.annotate.vcf.gz.tbi:md5,d3a6b0077504e48aadaa15d179733ffb" - ] + ], + [ + [ + "NA12878" ], - "versions": [ - "versions.yml:md5,ac2d0f2a8e77cd796d3b4b84fdd46b0d", - "versions.yml:md5,cb038a1f67a47a76d0e0a983cfd56789" + [ + "NA12878" ] - } + ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-15T20:08:24.300458322" + "timestamp": "2024-11-07T13:54:20.551354608" } } \ No newline at end of file diff --git a/subworkflows/local/bam_impute_stitch/main.nf b/subworkflows/local/bam_impute_stitch/main.nf index 7e67d652..4b21d37e 100644 --- a/subworkflows/local/bam_impute_stitch/main.nf +++ b/subworkflows/local/bam_impute_stitch/main.nf @@ -5,7 +5,7 @@ include { BCFTOOLS_INDEX } from '../../../modules/nf-core/bcftools/index' workflow BAM_IMPUTE_STITCH { take: - ch_input // channel: [ [id], bam, bai, bamlist ] + ch_input // channel: [ [id], [bam], [bai], bamlist ] ch_posfile // channel: [ [panel, chr], legend ] ch_region // channel: [ [chr, region], region ] ch_fasta // channel: [ [genome], fa, fai ] @@ -19,8 +19,8 @@ workflow BAM_IMPUTE_STITCH { // Value channels def input_empty = [[]] def rdata_empty = [[]] - k_val = params.k_val - ngen = params.ngen + k_val_params = params.k_val + ngen_params = params.ngen // Transform posfile to TSV with ',' GAWK(ch_posfile, []) @@ -32,14 +32,14 @@ workflow BAM_IMPUTE_STITCH { // Get chromosomes of fasta ch_chromosomes = ch_region - .map{metaCR, region -> [[chr: metaCR.chr], metaCR.chr]} + .map{metaCR, _region -> [[chr: metaCR.chr], metaCR.chr]} // Make final channel with parameters ch_parameters = ch_posfile .map { it + input_empty + rdata_empty} .join(ch_chromosomes) - .map { it + k_val + ngen} - .map { metaC, metaPC, posfile, input, rdata, chr, k_val, ngen -> + .map { it + k_val_params + ngen_params} + .map { _metaC, metaPC, posfile, input, rdata, chr, k_val, ngen -> [metaPC, posfile, input, rdata, chr, k_val, ngen] } diff --git a/subworkflows/local/bam_impute_stitch/tests/main.nf.test b/subworkflows/local/bam_impute_stitch/tests/main.nf.test index 676ce00b..55d9a0fa 100644 --- a/subworkflows/local/bam_impute_stitch/tests/main.nf.test +++ b/subworkflows/local/bam_impute_stitch/tests/main.nf.test @@ -15,35 +15,7 @@ nextflow_workflow { tag "bcftools" tag "bcftools_index" - test("Prepare input stitch") { - setup { - run("PREPARE_INPUT_STITCH") { - script "../../prepare_input_stitch/main.nf" - process { - """ - input[0] = Channel.fromList([ - [ - [id: "NA12878"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), - ], - [ - [id: "NA19401"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExist:true), - ], - ]) - input[1] = Channel.of([ - [id: "1000GP", chr: "chr22"], - file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.legend.gz", checkIfExist:true) - ]).collect() - input[2] = Channel.of([ - [chr: "chr22", region: "chr22:16570000-16610000"], "chr22:16570000-16610000" - ]).collect() - """ - } - } - } + test("Impute with stitch two individuals with bamlist") { when { params { max_cpus = 2 @@ -51,9 +23,37 @@ nextflow_workflow { } workflow { """ - input[0] = PREPARE_INPUT_STITCH.out.stitch_samples - input[1] = PREPARE_INPUT_STITCH.out.stitch_parameters - input[2] = Channel.of([ + bamlist = Channel.of( + "NA12878.s.bam", + "NA19401.s.bam" + ).collectFile(name: 'bamlist.txt', newLine: true) + ch_samples = Channel.fromList([ + [ + [id: "allid"], + [ + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam", checkIfExist:true) + ], + [ + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExist:true) + ] + ], + ]) + + ch_posfile = Channel.of([ + [id: "1000GP", chr: "chr22"], + file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.legend.gz", checkIfExist:true) + ]) + + ch_region = Channel.of([ + [chr: "chr22", region: "chr22:16570000-16610000"], "chr22:16570000-16610000" + ]) + + input[0] = ch_samples.combine(bamlist) + input[1] = ch_posfile + input[2] = ch_region + input[3] = Channel.of([ [id: "GRCh38"], file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true), file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz.fai", checkIfExist:true), @@ -65,8 +65,16 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }).match("SummaryMixed") } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() } + ).match() } ) } } diff --git a/subworkflows/local/bam_impute_stitch/tests/main.nf.test.snap b/subworkflows/local/bam_impute_stitch/tests/main.nf.test.snap index 648d160e..36e74e98 100644 --- a/subworkflows/local/bam_impute_stitch/tests/main.nf.test.snap +++ b/subworkflows/local/bam_impute_stitch/tests/main.nf.test.snap @@ -1,57 +1,37 @@ { - "Prepare input stitch": { + "Impute with stitch two individuals with bamlist": { "content": [ - { - "0": [ - [ - { - "id": "all_samples", - "chr": "chr22", - "panel": "1000GP", - "tools": "stitch" - }, - "stitch.chr22.vcf.gz:md5,9d3c27d9f0325cc92c22234665f5bb12", - "stitch.chr22.vcf.gz.tbi:md5,7d8d37b65e631c2b40c54e4a175de86c" - ] - ], - "1": [ - "versions.yml:md5,4330856a215c4986b0591d550a4d22bf", - "versions.yml:md5,8561197b98b9a1e1f8f1b01c1369da35" - ], - "vcf_tbi": [ - [ - { - "id": "all_samples", - "chr": "chr22", - "panel": "1000GP", - "tools": "stitch" - }, - "stitch.chr22.vcf.gz:md5,9d3c27d9f0325cc92c22234665f5bb12", - "stitch.chr22.vcf.gz.tbi:md5,7d8d37b65e631c2b40c54e4a175de86c" - ] - ], - "versions": [ - "versions.yml:md5,4330856a215c4986b0591d550a4d22bf", - "versions.yml:md5,8561197b98b9a1e1f8f1b01c1369da35" + [ + "versions.yml:md5,4330856a215c4986b0591d550a4d22bf", + "versions.yml:md5,8561197b98b9a1e1f8f1b01c1369da35", + "versions.yml:md5,c0772dccc2cc2a3c8f0b3fa5f02312bc" + ], + [ + [ + { + "id": "allid", + "chr": "chr22", + "panel": "1000GP", + "tools": "stitch" + }, + "stitch.chr22.vcf.gz", + "stitch.chr22.vcf.gz.tbi" ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" - }, - "timestamp": "2024-07-17T16:32:53.365697746" - }, - "SummaryMixed": { - "content": [ + ], [ - "VcfFile [chromosomes=[22], sampleCount=2, variantCount=903, phased=false, phasedAutodetect=false]" + "VcfFile [chromosomes=[chr22], sampleCount=2, variantCount=903, phased=false, phasedAutodetect=false]" + ], + [ + [ + "NA12878", + "NA19401" + ] ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-17T16:32:53.598743638" + "timestamp": "2024-11-07T13:55:08.174481463" } } \ No newline at end of file diff --git a/subworkflows/local/bam_region_samtools/tests/main.nf.test b/subworkflows/local/bam_region_samtools/tests/main.nf.test index dd9b6380..b2456d38 100644 --- a/subworkflows/local/bam_region_samtools/tests/main.nf.test +++ b/subworkflows/local/bam_region_samtools/tests/main.nf.test @@ -51,8 +51,17 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.bam_region.collect{ bam(it[1]).getReads().size() }).match("Summary10000bp") } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.bam_region.collect{ + bam(it[1]).getReads().size() + } + ).match() } ) } } @@ -92,8 +101,17 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.bam_region.collect{ bam(it[1]).getReads().size() }).match("Summary1000bp") } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.bam_region.collect{ + bam(it[1]).getReads().size() + } + ).match() } ) } } diff --git a/subworkflows/local/bam_region_samtools/tests/main.nf.test.snap b/subworkflows/local/bam_region_samtools/tests/main.nf.test.snap index 50e4a7a6..82e4b44b 100644 --- a/subworkflows/local/bam_region_samtools/tests/main.nf.test.snap +++ b/subworkflows/local/bam_region_samtools/tests/main.nf.test.snap @@ -1,142 +1,44 @@ { "Get subregion of bam file 10000bp": { "content": [ - { - "0": [ - [ - { - "id": "NA12878", - "chr": "all" - }, - "NA12878.bam:md5,382b24f44346ec2027e8578a5085c20f", - "NA12878.bam.bai:md5,484505b0727206e1e523dd90fa31cd16" - ], - [ - { - "id": "NA19401", - "chr": "all" - }, - "NA19401.bam:md5,9efa18406f24954c75934d928ed9c062", - "NA19401.bam.bai:md5,5a9429b877ffee92f7694d3579b4354b" - ] - ], - "1": [ - "versions.yml:md5,466438b58e39f6156e98d049f38e9d71", - "versions.yml:md5,7c6c94bfec70fe9da9e00f94b45f38f5", - "versions.yml:md5,966689bbca491e03935dd21220e66a1e" - ], - "bam_region": [ - [ - { - "id": "NA12878", - "chr": "all" - }, - "NA12878.bam:md5,382b24f44346ec2027e8578a5085c20f", - "NA12878.bam.bai:md5,484505b0727206e1e523dd90fa31cd16" - ], - [ - { - "id": "NA19401", - "chr": "all" - }, - "NA19401.bam:md5,9efa18406f24954c75934d928ed9c062", - "NA19401.bam.bai:md5,5a9429b877ffee92f7694d3579b4354b" - ] - ], - "versions": [ - "versions.yml:md5,466438b58e39f6156e98d049f38e9d71", - "versions.yml:md5,7c6c94bfec70fe9da9e00f94b45f38f5", - "versions.yml:md5,966689bbca491e03935dd21220e66a1e" - ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" - }, - "timestamp": "2024-07-17T16:44:44.476760014" - }, - "Summary10000bp": { - "content": [ + [ + "versions.yml:md5,17ab59cf0e993cc8db9086093cdeb6e2", + "versions.yml:md5,3043c69a324445a251b7e9569bd012d3", + "versions.yml:md5,4dbd8db078f2e38fb335b8c3ee3db169" + ], + [ + + ], [ 2498, 2510 ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-17T16:44:44.886794567" + "timestamp": "2024-11-07T13:55:45.543427226" }, "Get subregion of bam file 1000bp": { "content": [ - { - "0": [ - [ - { - "id": "NA12878", - "chr": "all" - }, - "NA12878.bam:md5,bb7e4faf368fa9c3bce66db3632fe05b", - "NA12878.bam.bai:md5,8d864fd88a20d14d4aff3de607655cbb" - ], - [ - { - "id": "NA19401", - "chr": "all" - }, - "NA19401.bam:md5,159d5b70d052e1269698635e28a8cbc9", - "NA19401.bam.bai:md5,ee992cd617b553c5fcfddd897193a0e5" - ] - ], - "1": [ - "versions.yml:md5,466438b58e39f6156e98d049f38e9d71", - "versions.yml:md5,7c6c94bfec70fe9da9e00f94b45f38f5", - "versions.yml:md5,966689bbca491e03935dd21220e66a1e" - ], - "bam_region": [ - [ - { - "id": "NA12878", - "chr": "all" - }, - "NA12878.bam:md5,bb7e4faf368fa9c3bce66db3632fe05b", - "NA12878.bam.bai:md5,8d864fd88a20d14d4aff3de607655cbb" - ], - [ - { - "id": "NA19401", - "chr": "all" - }, - "NA19401.bam:md5,159d5b70d052e1269698635e28a8cbc9", - "NA19401.bam.bai:md5,ee992cd617b553c5fcfddd897193a0e5" - ] - ], - "versions": [ - "versions.yml:md5,466438b58e39f6156e98d049f38e9d71", - "versions.yml:md5,7c6c94bfec70fe9da9e00f94b45f38f5", - "versions.yml:md5,966689bbca491e03935dd21220e66a1e" - ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" - }, - "timestamp": "2024-07-17T16:45:00.483599493" - }, - "Summary1000bp": { - "content": [ + [ + "versions.yml:md5,17ab59cf0e993cc8db9086093cdeb6e2", + "versions.yml:md5,3043c69a324445a251b7e9569bd012d3", + "versions.yml:md5,4dbd8db078f2e38fb335b8c3ee3db169" + ], + [ + + ], [ 368, 327 ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-17T16:45:00.954762728" + "timestamp": "2024-11-07T13:57:19.117705738" } } \ No newline at end of file diff --git a/subworkflows/local/chunk_prepare_channel/tests/main.nf.test.snap b/subworkflows/local/chunk_prepare_channel/tests/main.nf.test.snap index 34ba7aa7..974d2ce6 100644 --- a/subworkflows/local/chunk_prepare_channel/tests/main.nf.test.snap +++ b/subworkflows/local/chunk_prepare_channel/tests/main.nf.test.snap @@ -2,16 +2,14 @@ "Prepare chunks channel error tool": { "content": [ [ - "N E X T F L O W ~ version 23.10.1", - "Launching `/mnt/c/Users/llenezet/Documents/Repositories/phaseimpute/.nf-test/tests/c7782a704e2a438fa20d101b0208a35d/meta/mock.nf` [hungry_wescoff] DSL2 - revision: c41c2d7547", "Only 'glimpse' and 'quilt' output format are supported. Got glimpse2" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-18T09:57:16.071041128" + "timestamp": "2024-11-06T15:30:55.291994433" }, "Prepare chunks channel Quilt": { "content": [ diff --git a/subworkflows/local/get_region/tests/main.nf.test.snap b/subworkflows/local/get_region/tests/main.nf.test.snap index 252b98d6..9f9e1934 100644 --- a/subworkflows/local/get_region/tests/main.nf.test.snap +++ b/subworkflows/local/get_region/tests/main.nf.test.snap @@ -20,16 +20,14 @@ "Should run with an error": { "content": [ [ - "N E X T F L O W ~ version 23.10.1", - "Launching `/mnt/c/Users/llenezet/Documents/Repositories/phaseimpute/.nf-test/tests/68cf57ba96afcf7b8ba9414fb03e77b1/meta/mock.nf` [angry_babbage] DSL2 - revision: d7db2c206c", "Invalid input_region: chr22:0-4000:4648" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-18T10:00:37.781505704" + "timestamp": "2024-11-06T15:31:15.872517093" }, "Should run with specified chr": { "content": [ diff --git a/subworkflows/local/utils_nfcore_chrcheck_pipeline/main.nf b/subworkflows/local/utils_nfcore_chrcheck_pipeline/main.nf index 1850b518..0c1c7c67 100644 --- a/subworkflows/local/utils_nfcore_chrcheck_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_chrcheck_pipeline/main.nf @@ -2,7 +2,7 @@ // Check if the contig names in the input files match the reference contig names. // def checkChr(ch_chr, ch_input){ - chr_checked = ch_chr + def chr_checked = ch_chr .combine(ch_input, by:0) .map{meta, chr, file, index, lst -> [ @@ -12,9 +12,9 @@ def checkChr(ch_chr, ch_input){ ] } .branch{ meta, file, index, chr, lst -> - lst_diff = diffChr(chr, lst, file) - diff = lst_diff[0] - prefix = lst_diff[1] + def lst_diff = diffChr(chr, lst, file) + def diff = lst_diff[0] + def prefix = lst_diff[1] no_rename: diff.size() == 0 return [meta, file, index] to_rename: true @@ -27,12 +27,12 @@ def checkChr(ch_chr, ch_input){ // Check if the contig names can be solved by adding/removing the `chr` prefix. // def diffChr(chr_target, chr_ref, file) { - diff = chr_ref - chr_target - prefix = (chr_ref - chr_target) =~ "chr" ? "chr" : "nochr" + def diff = chr_ref - chr_target + def prefix = (chr_ref - chr_target) =~ "chr" ? "chr" : "nochr" if (diff.size() != 0) { // Ensure that by adding/removing the prefix we can solve the problem - new_chr = [] - to_rename = [] + def new_chr = [] + def to_rename = [] if (prefix == "chr") { chr_target.each{ new_chr += "chr${it}" } diff.each{ to_rename += it.replace('chr', '') } @@ -40,9 +40,9 @@ def diffChr(chr_target, chr_ref, file) { chr_target.each{ new_chr += it.replace('chr', '') } diff.each{ to_rename += "chr${it}" } } - new_diff = diff - new_chr + def new_diff = diff - new_chr if (new_diff.size() != 0) { - chr_names = new_diff.size() > params.max_chr_names ? new_diff[0..params.max_chr_names - 1] + ['...'] : new_diff + def chr_names = new_diff.size() > params.max_chr_names ? new_diff[0..params.max_chr_names - 1] + ['...'] : new_diff error "Contig names: ${chr_names} absent from file: ${file} and cannot be solved by adding or removing the `chr` prefix." } diff = to_rename diff --git a/subworkflows/local/utils_nfcore_chrcheck_pipeline/tests/function.nf.test.snap b/subworkflows/local/utils_nfcore_chrcheck_pipeline/tests/function.nf.test.snap new file mode 100644 index 00000000..ff0bf78b --- /dev/null +++ b/subworkflows/local/utils_nfcore_chrcheck_pipeline/tests/function.nf.test.snap @@ -0,0 +1,62 @@ +{ + "ref chr & target chr but missing contig": { + "content": [ + [ + "Contig names: [chr4] absent from file: 123.vcf and cannot be solved by adding or removing the `chr` prefix." + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-06T15:31:34.992652974" + }, + "Mix file with and withouth chr": { + "content": [ + [ + [ + "chr2", + "chr1" + ], + "nochr" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-06T15:31:39.923011027" + }, + "ref no chr & target chr": { + "content": [ + [ + [ + "chr2", + "chr1" + ], + "nochr" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-06T15:31:25.618460553" + }, + "ref chr & target no chr": { + "content": [ + [ + [ + "2", + "1" + ], + "chr" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-06T15:31:30.499438797" + } +} \ No newline at end of file diff --git a/subworkflows/local/utils_nfcore_phaseimpute_pipeline/main.nf b/subworkflows/local/utils_nfcore_phaseimpute_pipeline/main.nf index 21eab92c..64f90e95 100644 --- a/subworkflows/local/utils_nfcore_phaseimpute_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_phaseimpute_pipeline/main.nf @@ -30,10 +30,9 @@ workflow PIPELINE_INITIALISATION { take: version // boolean: Display version and exit validate_params // boolean: Boolean whether to validate parameters against the schema at runtime - monochrome_logs // boolean: Do not use coloured log outputs + _monochrome_logs // boolean: Do not use coloured log outputs nextflow_cli_args // array: List of positional nextflow CLI args outdir // string: The output directory where the results will be saved - input // string: Path to input samplesheet main: @@ -191,7 +190,7 @@ workflow PIPELINE_INITIALISATION { } } else { ch_map = ch_regions - .map{ metaCR, regions -> [metaCR.subMap("chr"), []] } + .map{ metaCR, _regions -> [metaCR.subMap("chr"), []] } } // @@ -244,7 +243,7 @@ workflow PIPELINE_INITIALISATION { // Check contigs name in different meta map // // Collect all chromosomes names in all different inputs - chr_ref = ch_ref_gen.map { meta, fasta, fai -> [fai.readLines()*.split('\t').collect{it[0]}] } + chr_ref = ch_ref_gen.map { _meta, _fasta, fai_file -> [fai_file.readLines()*.split('\t').collect{it[0]}] } chr_regions = extractChr(ch_regions) // Check that the chromosomes names that will be used are all present in different inputs @@ -260,15 +259,15 @@ workflow PIPELINE_INITIALISATION { .toList() .subscribe{ chr -> if (chr.size() > 0) { - chr_names = chr.size() > params.max_chr_names ? chr[0..params.max_chr_names - 1] + ['...'] : chr + def chr_names = chr.size() > params.max_chr_names ? chr[0..params.max_chr_names - 1] + ['...'] : chr log.warn "The following contigs are absent from at least one file : ${chr_names} and therefore won't be used" } } ch_regions = ch_regions .combine(chr_all_mis.toList()) - .filter { meta, regions, chr_mis -> + .filter { meta, _regions, chr_mis -> !(meta.chr in chr_mis) } - .map { meta, regions, chr_mis -> [meta, regions] } + .map { meta, regions, _chr_mis -> [meta, regions] } .ifEmpty { error "No regions left to process" } ch_regions @@ -355,40 +354,40 @@ workflow PIPELINE_COMPLETION { def validateInputParameters() { genomeExistsError() // Check that only genome or fasta is provided - assert params.genome == null || params.fasta == null, "Either --genome or --fasta must be provided" - assert !(params.genome == null && params.fasta == null), "Only one of --genome or --fasta must be provided" + assert (params.genome == null || params.fasta == null) : "Either --genome or --fasta must be provided" + assert !(params.genome == null && params.fasta == null) : "Only one of --genome or --fasta must be provided" // Check that a steps is provided - assert params.steps, "A step must be provided" + assert params.steps : "A step must be provided" // Check that at least one tool is provided if (params.steps.split(',').contains("impute")) { - assert params.tools, "No tools provided" + assert params.tools : "No tools provided" } // Check that input is provided for all steps, except panelprep if (params.steps.split(',').contains("all") || params.steps.split(',').contains("impute") || params.steps.split(',').contains("simulate") || params.steps.split(',').contains("validate")) { - assert params.input, "No input provided" + assert params.input : "No input provided" } // Check that posfile and chunks are provided when running impute only. Steps with panelprep generate those files. if (params.steps.split(',').contains("impute") && !params.steps.split(',').find { it in ["all", "panelprep"] }) { // Required by all tools except glimpse2 if (!params.tools.split(',').find { it in ["glimpse2"] }) { - assert params.posfile, "No --posfile provided for --steps impute" + assert params.posfile : "No --posfile provided for --steps impute" } // Required by all tools except STITCH if (params.tools != "stitch") { - assert params.chunks, "No --chunks provided for --steps impute" + assert params.chunks : "No --chunks provided for --steps impute" } // Required by GLIMPSE1 and GLIMPSE2 only if (params.tools.split(',').contains("glimpse")) { - assert params.panel, "No --panel provided for imputation with GLIMPSE" + assert params.panel : "No --panel provided for imputation with GLIMPSE" } // Check that input_truth is provided when running validate if (params.steps.split(',').find { it in ["all", "validate"] } ) { - assert params.input_truth, "No --input_truth was provided for --steps validate" + assert params.input_truth : "No --input_truth was provided for --steps validate" } } @@ -414,6 +413,8 @@ def validateInputParameters() { // Check that the chunk model is provided assert params.chunk_model : "No chunk model provided" + + return null } // @@ -434,13 +435,14 @@ def validateInputBatchTools(ch_input, batch_size, extension, tools) { if (nb_input > batch_size) { if (tools.contains("glimpse2") || tools.contains("quilt")) { - log.warn("Glimpse2 or Quilt software is selected and the number of input files (${nb_input}) is less than the batch size (${batch_size}). The input files will be processed in ${(int) Math.ceil(nb_input / batch_size)} batches.") + log.warn("Glimpse2 or Quilt software is selected and the number of input files (${nb_input}) is less than the batch size (${batch_size}). The input files will be processed in ${Math.ceil(nb_input / batch_size) as int} batches.") } if (tools.contains("stitch") || tools.contains("glimpse1")) { error "Stitch or Glimpse1 software is selected and the number of input files (${nb_input}) is less than the batch size (${batch_size}). Splitting the input files in batches would induce batch effect." } } } + return null } // @@ -448,22 +450,23 @@ def validateInputBatchTools(ch_input, batch_size, extension, tools) { // def validatePosfileTools(ch_posfile, tools, steps){ ch_posfile - .map{ meta, vcf, index, hap, legend -> + .map{ _meta, vcf, index, hap, legend -> if (tools.contains("glimpse1")) { - assert legend, "Glimpse1 tool needs a legend file provided in the posfile. This file can be created through the panelprep step." + assert legend : "Glimpse1 tool needs a legend file provided in the posfile. This file can be created through the panelprep step." } if (tools.contains("stitch")) { - assert legend, "Stitch tool needs a legend file provided in the posfile. This file can be created through the panelprep step." + assert legend : "Stitch tool needs a legend file provided in the posfile. This file can be created through the panelprep step." } if (tools.contains("quilt")) { - assert legend, "Quilt tool needs a legend file provided in the posfile. This file can be created through the panelprep step." - assert hap, "Quilt tool needs a hap file provided in the posfile. This file can be created through the panelprep step." + assert legend : "Quilt tool needs a legend file provided in the posfile. This file can be created through the panelprep step." + assert hap : "Quilt tool needs a hap file provided in the posfile. This file can be created through the panelprep step." } if (steps.contains("validate")) { - assert vcf, "Validation step needs a vcf file provided in the posfile for the allele frequency. This file can be created through the panelprep step." - assert index, "Validation step needs an index file provided in the posfile for the allele frequency. This file can be created through the panelprep step." + assert vcf : "Validation step needs a vcf file provided in the posfile for the allele frequency. This file can be created through the panelprep step." + assert index : "Validation step needs an index file provided in the posfile for the allele frequency. This file can be created through the panelprep step." } } + return null } // @@ -480,13 +483,13 @@ def extractChr(ch_input) { // Give back the intersection of a and b // def checkMetaChr(chr_a, chr_b, name){ - intersect = chr_a + def intersect = chr_a .combine(chr_b) .map{ a, b -> if (b != [[]] && !(a - b).isEmpty()) { - chr_names = (a - b).size() > params.max_chr_names ? (a - b)[0..params.max_chr_names - 1] + ['...'] : (a - b) - verb = (a - b).size() == 1 ? "is" : "are" + def chr_names = (a - b).size() > params.max_chr_names ? (a - b)[0..params.max_chr_names - 1] + ['...'] : (a - b) + def verb = (a - b).size() == 1 ? "is" : "are" log.warn "Chr : ${chr_names} ${verb} missing from ${name}" return (a-b) } @@ -500,20 +503,20 @@ def checkMetaChr(chr_a, chr_b, name){ // Get file extension // def getFileExtension(file) { - if (file instanceof Path) { - file = file.getName() - } else if (file instanceof ArrayList) { - if (file.size() == 0) { - return null - } else { - error "Type not supported: ${file} = ${file.getClass()}" - } - } - if (file instanceof CharSequence) { - return file.toString().replace(".gz", "").split("\\.").last() + def file_name = "" + + if (file instanceof Path || file instanceof nextflow.file.http.XPath) { + file_name = file.name + } else if (file instanceof CharSequence) { + file_name = file.toString() + } else if (file instanceof List) { + return file.collect { getFileExtension(it) } } else { error "Type not supported: ${file.getClass()}" } + + // Remove .gz if present and get the last part after splitting by "." + return file_name.replace(".gz", "").split("\\.").last() } // @@ -563,10 +566,10 @@ def exportCsv(ch_files, metas, header, name, outdir) { ch_files.collectFile(keepHeader: true, skip: 1, sort: true, storeDir: "${params.outdir}/${outdir}") { it -> def meta = "" def file = "" - for (i in metas) { + metas.each { i -> meta += "${it[0][i]}," } - for (i in it[1]) { + it[1].each { i -> file += "${params.outdir}/${i.value}/${it[i.key].fileName}," } file = file.substring(0, file.length() - 1) // remove last comma diff --git a/subworkflows/local/utils_nfcore_phaseimpute_pipeline/tests/function.nf.test b/subworkflows/local/utils_nfcore_phaseimpute_pipeline/tests/function.nf.test index d1d04cb1..bf8d7b2b 100644 --- a/subworkflows/local/utils_nfcore_phaseimpute_pipeline/tests/function.nf.test +++ b/subworkflows/local/utils_nfcore_phaseimpute_pipeline/tests/function.nf.test @@ -15,10 +15,53 @@ nextflow_function { } } then { - assert function.success - assert snapshot(function.result).match() + assertAll( + { assert function.success }, + { assert function.result == "vcf" } + ) + } + } + + test ("Test getFileExtension non empty list") { + function "getFileExtension" + tag "getFileExtension" + when { + function { + """ + input[0] = [ + file(params.pipelines_testdata_base_path + "hum_data/panel/chr21/1000GP.chr21.s.norel.vcf.gz", checkIfExists: true), + "test.myfile.txt.gz" + ] + """ + } + } + then { + assertAll( + { assert function.success }, + { assert function.result == ['vcf', 'txt'] }, + { assert snapshot(function.result).match() } + ) + } + } + + test ("Test getFileExtension empty list") { + function "getFileExtension" + tag "getFileExtension" + when { + function { + """ + input[0] = [] + """ + } + } + then { + assertAll( + { assert function.success }, + { assert function.result == [] } + ) } } + test("Test checkFileIndex no error with empty channel") { function "checkFileIndex" tag "checkFileIndex" @@ -46,6 +89,7 @@ nextflow_function { assert snapshot(function.result).match() } } + test("Test checkFileIndex no error") { function "checkFileIndex" tag "checkFileIndex" @@ -71,6 +115,7 @@ nextflow_function { assert function.success } } + test("Test checkFileIndex bam bai") { function "checkFileIndex" tag "checkFileIndex" @@ -90,6 +135,7 @@ nextflow_function { assert function.stdout.contains("[id:input7]: Index file for .bam must have the extension .bai") } } + test("Test checkFileIndex cram crai") { function "checkFileIndex" tag "checkFileIndex" @@ -109,6 +155,7 @@ nextflow_function { assert function.stdout.contains("[id:input7]: Index file for .cram must have the extension .crai") } } + test("Test checkFileIndex bcf csi") { function "checkFileIndex" tag "checkFileIndex" @@ -128,6 +175,7 @@ nextflow_function { assert function.stdout.contains("[id:input7]: Index file for [.vcf, .vcf.gz, bcf] must have the extension [.tbi, .csi]") } } + test("Test checkFileIndex vcf csi") { function "checkFileIndex" tag "checkFileIndex" @@ -147,6 +195,7 @@ nextflow_function { assert function.stdout.contains("[id:input7]: Index file for [.vcf, .vcf.gz, bcf] must have the extension [.tbi, .csi]") } } + test("Test checkFileIndex vcf.gz csi") { function "checkFileIndex" tag "checkFileIndex" @@ -166,6 +215,7 @@ nextflow_function { assert function.stdout.contains("[id:input7]: Index file for [.vcf, .vcf.gz, bcf] must have the extension [.tbi, .csi]") } } + test("Test checkFileIndex fa fai") { function "checkFileIndex" tag "checkFileIndex" @@ -185,6 +235,7 @@ nextflow_function { assert function.stdout.contains("[id:input7]: Index file for [fa, fasta] must have the extension .fai") } } + test("Test checkFileIndex fasta fai") { function "checkFileIndex" tag "checkFileIndex" @@ -204,6 +255,7 @@ nextflow_function { assert function.stdout.contains("[id:input7]: Index file for [fa, fasta] must have the extension .fai") } } + test("Test Function exportCsv") { function "exportCsv" tag "exportCsv" @@ -224,12 +276,13 @@ nextflow_function { } then { - assertAll( - { assert function.success }, - { assert snapshot(function.result).match() } - ) + with(function) { + assert success + assert snapshot(result).match() + } } } + test ("Test checkMetaChr") { function "checkMetaChr" tag "checkMetaChr" @@ -246,6 +299,7 @@ nextflow_function { assert function.success } } + test ("Test checkMetaChr warning") { function "checkMetaChr" tag "checkMetaChr" @@ -281,8 +335,10 @@ nextflow_function { } } then { - assert function.failed - assert snapshot(function.stdout).match() + assertAll ( + { assert function.failed }, + { assert snapshot(function.stdout).match() } + ) } } @@ -300,8 +356,10 @@ nextflow_function { } } then { - assert function.failed - assert snapshot(function.stdout).match() + assertAll ( + { assert function.failed }, + { assert snapshot(function.stdout).match() } + ) } } @@ -319,8 +377,31 @@ nextflow_function { } } then { - assert function.failed - assert snapshot(function.stdout).match() + assertAll ( + { assert function.failed }, + { assert snapshot(function.stdout).match() } + ) + } + } + + test ("Test validateInputBatchTools success batch") { + function "validateInputBatchTools" + tag "validateInputBatchTools" + when { + function { + """ + input[0] = Channel.of(0..150) + input[1] = 60 + input[2] = "cram" + input[3] = ["quilt", "glimpse2"] + """ + } + } + then { + assertAll ( + { assert function.success }, + { assert snapshot(function.stdout).match() } + ) } } } diff --git a/subworkflows/local/utils_nfcore_phaseimpute_pipeline/tests/function.nf.test.snap b/subworkflows/local/utils_nfcore_phaseimpute_pipeline/tests/function.nf.test.snap index 3af29bdc..a0aaa167 100644 --- a/subworkflows/local/utils_nfcore_phaseimpute_pipeline/tests/function.nf.test.snap +++ b/subworkflows/local/utils_nfcore_phaseimpute_pipeline/tests/function.nf.test.snap @@ -26,53 +26,111 @@ "Test checkFileIndex no error with empty channel": { "content": null, "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-16T15:21:39.094768315" + "timestamp": "2024-11-06T15:32:04.356171769" }, "Test validateInputBatchTools only one vcf": { "content": [ [ - "When using a Variant Calling Format file as input, only one file can be provided. If you have multiple samples, please merge them into a single VCF file." + "N E X T F L O W ~ version 24.10.0", + "Launching `/mnt/c/Users/llenezet/Documents/Repositories/phaseimpute/.nf-test-d46c3ae4355f57c428b5399cb25385a3.nf` [deadly_lamarck] DSL2 - revision: 89cd7edbc5", + "When using a Variant Calling Format file as input, only one file can be provided. If you have multiple single-sample VCF files, please merge them into a single multisample VCF file." ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-07T16:40:38.015152671" + }, + "Test checkMetaChr warning": { + "content": [ + [ + + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-16T20:08:33.571723823" + "timestamp": "2024-11-07T14:03:45.047353204" }, "Test Function exportCsv": { "content": null, "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-10T16:27:29.128695884" + "timestamp": "2024-11-06T15:32:58.039856651" }, "Test validateInputBatchTools vcf only for glimpse": { "content": [ [ + "N E X T F L O W ~ version 24.10.0", + "Launching `/mnt/c/Users/llenezet/Documents/Repositories/phaseimpute/.nf-test-ee1562fb7668b97a4ee2fa78f0a93342.nf` [stupefied_gautier] DSL2 - revision: 33e883fb97", "Stitch or Quilt software cannot run with VCF or BCF files. Please provide alignment files (i.e. BAM or CRAM)." ] ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-07T16:40:24.343659957" + }, + "Test validateInputBatchTools success batch": { + "content": [ + [ + "N E X T F L O W ~ version 24.10.0", + "Launching `/mnt/c/Users/llenezet/Documents/Repositories/phaseimpute/.nf-test-a882e6f88e44c954568a3552c82f8d3c.nf` [compassionate_keller] DSL2 - revision: edfeedf8f1", + "WARN: Glimpse2 or Quilt software is selected and the number of input files (151) is less than the batch size (60). The input files will be processed in 3 batches." + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-07T16:41:05.86605167" + }, + "Test getFileExtension non empty list": { + "content": [ + [ + "vcf", + "txt" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-31T13:15:08.856706046" + }, + "Test getFileExtension empty list": { + "content": [ + [ + + ] + ], "meta": { "nf-test": "0.8.4", "nextflow": "24.04.4" }, - "timestamp": "2024-10-16T20:20:28.177195568" + "timestamp": "2024-10-30T20:00:55.32420517" }, "Test validateInputBatchTools error batch": { "content": [ [ - "Stitch or Glimpse1 software is selected and the number of input files (150) is less than the batch size (60). Splitting the input files in batches would induce batch effect." + "N E X T F L O W ~ version 24.10.0", + "Launching `/mnt/c/Users/llenezet/Documents/Repositories/phaseimpute/.nf-test-87470b2a8c60f98b5dc561cea5e9bc6f.nf` [prickly_euclid] DSL2 - revision: 45ae3df33f", + "WARN: Glimpse2 or Quilt software is selected and the number of input files (151) is less than the batch size (60). The input files will be processed in 3 batches.", + "Stitch or Glimpse1 software is selected and the number of input files (151) is less than the batch size (60). Splitting the input files in batches would induce batch effect." ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-16T20:27:27.025786146" + "timestamp": "2024-11-07T16:40:50.034843333" } } \ No newline at end of file diff --git a/subworkflows/local/utils_nfcore_phaseimpute_pipeline/tests/main.nf.test b/subworkflows/local/utils_nfcore_phaseimpute_pipeline/tests/main.nf.test index 2c7045c9..9760477c 100644 --- a/subworkflows/local/utils_nfcore_phaseimpute_pipeline/tests/main.nf.test +++ b/subworkflows/local/utils_nfcore_phaseimpute_pipeline/tests/main.nf.test @@ -24,10 +24,8 @@ nextflow_workflow { input[0] = false input[1] = false input[2] = false - input[3] = false - input[4] = [] - input[5] = "results" - input[6] = "" + input[3] = [] + input[4] = "results" """ } } @@ -57,10 +55,8 @@ nextflow_workflow { input[0] = false input[1] = false input[2] = false - input[3] = false - input[4] = [] - input[5] = "results" - input[6] = "" + input[3] = [] + input[4] = "results" """ } } @@ -89,10 +85,8 @@ nextflow_workflow { input[0] = false input[1] = false input[2] = false - input[3] = false - input[4] = [] - input[5] = "results" - input[6] = "" + input[3] = [] + input[4] = "results" """ } } diff --git a/subworkflows/local/vcf_chr_rename_bcftools/main.nf b/subworkflows/local/vcf_chr_rename_bcftools/main.nf index 1cab311d..e10351c6 100644 --- a/subworkflows/local/vcf_chr_rename_bcftools/main.nf +++ b/subworkflows/local/vcf_chr_rename_bcftools/main.nf @@ -19,7 +19,7 @@ workflow VCF_CHR_RENAME_BCFTOOLS { // Generate the chromosome renaming file ch_rename_file = ch_vcf - .collectFile{ meta, vcf, index, diff, prefix -> + .collectFile{ meta, _vcf, _index, diff, prefix -> def chr = diff.collect { i -> prefix == "chr" ? "${i} chr${i}" : "${i} ${i.replace('chr', '')}" @@ -30,12 +30,12 @@ workflow VCF_CHR_RENAME_BCFTOOLS { // Add the chromosome renaming file to the input channel ch_annotate_input = ch_vcf.map { - meta, vcf, index, diff, prefix -> + meta, vcf, index, _diff, _prefix -> [[id: meta.id], meta, vcf, index] } // channel: [ [id], vcf, index ] .combine(ch_rename_file, by:0) .map { - metaI, meta, vcf, index, rename_file -> + _metaI, meta, vcf, index, rename_file -> [meta, vcf, index, [], [], [], rename_file] } diff --git a/subworkflows/local/vcf_chunk_glimpse/main.nf b/subworkflows/local/vcf_chunk_glimpse/main.nf index dad0dcf0..cca84ce7 100644 --- a/subworkflows/local/vcf_chunk_glimpse/main.nf +++ b/subworkflows/local/vcf_chunk_glimpse/main.nf @@ -43,7 +43,7 @@ workflow VCF_CHUNK_GLIMPSE { } .join(ch_map) .map{ - metaC, metaPC, vcf, csi, chr, gmap -> [metaPC, vcf, csi, chr, gmap] + _metaC, metaPC, vcf, csi, chr, gmap -> [metaPC, vcf, csi, chr, gmap] } GLIMPSE2_CHUNK ( ch_input_glimpse2, chunk_model ) ch_versions = ch_versions.mix( GLIMPSE2_CHUNK.out.versions.first() ) diff --git a/subworkflows/local/vcf_concatenate_bcftools/tests/main.nf.test b/subworkflows/local/vcf_concatenate_bcftools/tests/main.nf.test index 62682207..bf59d2af 100644 --- a/subworkflows/local/vcf_concatenate_bcftools/tests/main.nf.test +++ b/subworkflows/local/vcf_concatenate_bcftools/tests/main.nf.test @@ -43,11 +43,17 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ - path(it[1]).vcf.summary - }).match("Concat content") - } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ + path(it[1]).vcf.summary + } + ).match() } ) } } diff --git a/subworkflows/local/vcf_concatenate_bcftools/tests/main.nf.test.snap b/subworkflows/local/vcf_concatenate_bcftools/tests/main.nf.test.snap index 3bddc9c8..f9977675 100644 --- a/subworkflows/local/vcf_concatenate_bcftools/tests/main.nf.test.snap +++ b/subworkflows/local/vcf_concatenate_bcftools/tests/main.nf.test.snap @@ -1,51 +1,27 @@ { - "Concat content": { + "Concatenate vcf": { "content": [ + [ + "versions.yml:md5,0370775d4b565f1cf95dcbea437fa36a" + ], + [ + [ + { + "id": "1000GP", + "chr": "all" + }, + "1000GP_all.vcf.gz", + "1000GP_all.vcf.gz.tbi" + ] + ], [ "VcfFile [chromosomes=[chr21, chr22], sampleCount=3196, variantCount=1739, phased=true, phasedAutodetect=true]" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-07-18T11:56:39.376973769" - }, - "Concatenate vcf": { - "content": [ - { - "0": [ - [ - { - "id": "1000GP", - "chr": "all" - }, - "1000GP_all.vcf.gz:md5,9836dd74da2ddd7956adf3e4f83f80e1", - "1000GP_all.vcf.gz.tbi:md5,e7180bb953d2bd657c420a5f76a7164d" - ] - ], - "1": [ - "versions.yml:md5,0370775d4b565f1cf95dcbea437fa36a" - ], - "vcf_tbi": [ - [ - { - "id": "1000GP", - "chr": "all" - }, - "1000GP_all.vcf.gz:md5,9836dd74da2ddd7956adf3e4f83f80e1", - "1000GP_all.vcf.gz.tbi:md5,e7180bb953d2bd657c420a5f76a7164d" - ] - ], - "versions": [ - "versions.yml:md5,0370775d4b565f1cf95dcbea437fa36a" - ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-18T11:56:36.85523481" + "timestamp": "2024-11-07T14:07:30.535498349" } } \ No newline at end of file diff --git a/subworkflows/local/vcf_concordance_glimpse2/main.nf b/subworkflows/local/vcf_concordance_glimpse2/main.nf index de861551..65ec81bf 100644 --- a/subworkflows/local/vcf_concordance_glimpse2/main.nf +++ b/subworkflows/local/vcf_concordance_glimpse2/main.nf @@ -24,7 +24,7 @@ workflow VCF_CONCORDANCE_GLIMPSE2 { ) .combine(ch_vcf_freq) .combine(ch_region.map{[it[1]]}.collect().toList()) - .map{metaI, metaIPTC, emul, e_csi, truth, t_csi, metaP, freq, f_csi, regions -> + .map{ _metaI, metaIPTC, emul, e_csi, truth, t_csi, _metaP, freq, f_csi, regions -> [metaIPTC, emul, e_csi, truth, t_csi, freq, f_csi, [], regions] } @@ -35,12 +35,12 @@ workflow VCF_CONCORDANCE_GLIMPSE2 { ) ch_versions = ch_versions.mix(GLIMPSE2_CONCORDANCE.out.versions.first()) - ch_multiqc_files = ch_multiqc_files.mix(GLIMPSE2_CONCORDANCE.out.errors_cal.map{meta, txt -> [txt]}) - ch_multiqc_files = ch_multiqc_files.mix(GLIMPSE2_CONCORDANCE.out.errors_grp.map{meta, txt -> [txt]}) - ch_multiqc_files = ch_multiqc_files.mix(GLIMPSE2_CONCORDANCE.out.errors_spl.map{meta, txt -> [txt]}) - ch_multiqc_files = ch_multiqc_files.mix(GLIMPSE2_CONCORDANCE.out.rsquare_grp.map{meta, txt -> [txt]}) - ch_multiqc_files = ch_multiqc_files.mix(GLIMPSE2_CONCORDANCE.out.rsquare_spl.map{meta, txt -> [txt]}) - ch_multiqc_files = ch_multiqc_files.mix(GLIMPSE2_CONCORDANCE.out.rsquare_per_site.map{meta, txt -> [txt]}) + ch_multiqc_files = ch_multiqc_files.mix(GLIMPSE2_CONCORDANCE.out.errors_cal.map{ _meta, txt -> [txt]}) + ch_multiqc_files = ch_multiqc_files.mix(GLIMPSE2_CONCORDANCE.out.errors_grp.map{ _meta, txt -> [txt]}) + ch_multiqc_files = ch_multiqc_files.mix(GLIMPSE2_CONCORDANCE.out.errors_spl.map{ _meta, txt -> [txt]}) + ch_multiqc_files = ch_multiqc_files.mix(GLIMPSE2_CONCORDANCE.out.rsquare_grp.map{ _meta, txt -> [txt]}) + ch_multiqc_files = ch_multiqc_files.mix(GLIMPSE2_CONCORDANCE.out.rsquare_spl.map{ _meta, txt -> [txt]}) + ch_multiqc_files = ch_multiqc_files.mix(GLIMPSE2_CONCORDANCE.out.rsquare_per_site.map{ _meta, txt -> [txt]}) GUNZIP(GLIMPSE2_CONCORDANCE.out.errors_grp) ch_versions = ch_versions.mix(GUNZIP.out.versions.first()) @@ -50,7 +50,7 @@ workflow VCF_CONCORDANCE_GLIMPSE2 { GAWK( ADD_COLUMNS.out.txt - .map{meta, txt -> [["id":"TestQuality"], txt]} + .map{ _meta, txt -> [["id":"TestQuality"], txt]} .groupTuple(), [] ) diff --git a/subworkflows/local/vcf_concordance_glimpse2/tests/main.nf.test.snap b/subworkflows/local/vcf_concordance_glimpse2/tests/main.nf.test.snap index 478a073a..7fdea09f 100644 --- a/subworkflows/local/vcf_concordance_glimpse2/tests/main.nf.test.snap +++ b/subworkflows/local/vcf_concordance_glimpse2/tests/main.nf.test.snap @@ -97,9 +97,9 @@ } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-17T12:39:49.843552307" + "timestamp": "2024-11-07T14:08:13.256185601" } } \ No newline at end of file diff --git a/subworkflows/local/vcf_impute_glimpse1/main.nf b/subworkflows/local/vcf_impute_glimpse1/main.nf index 4a5c352f..25177676 100644 --- a/subworkflows/local/vcf_impute_glimpse1/main.nf +++ b/subworkflows/local/vcf_impute_glimpse1/main.nf @@ -7,10 +7,9 @@ include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_2 } from '../../../modules/nf-core/bc workflow VCF_IMPUTE_GLIMPSE1 { take: - ch_input // channel (mandatory): [ [id], bam, bai ] + ch_input // channel (mandatory): [ [id], vcf, tbi ] ch_panel // channel (mandatory): [ [panel, chr], vcf, tbi ] ch_chunks // channel (optional): [ [panel, chr], region1, region2 ] - ch_fasta // channel (mandatory): [ [genome], fa, fai ] main: @@ -33,7 +32,7 @@ workflow VCF_IMPUTE_GLIMPSE1 { .combine(samples_file) .combine(ch_chunks_panel, by: 0) .combine(gmap_file) - .map{ metaPC, metaIPC, bam, bai, samples, regionin, regionout, panel, panel_index, gmap -> + .map{ _metaPC, metaIPC, bam, bai, samples, regionin, regionout, panel, panel_index, gmap -> [metaIPC + ["chunk": regionout], bam, bai, samples, regionin, regionout, panel, panel_index, gmap] } diff --git a/subworkflows/local/vcf_impute_glimpse1/tests/main.nf.test b/subworkflows/local/vcf_impute_glimpse1/tests/main.nf.test index bea430e5..a9a626d5 100644 --- a/subworkflows/local/vcf_impute_glimpse1/tests/main.nf.test +++ b/subworkflows/local/vcf_impute_glimpse1/tests/main.nf.test @@ -4,12 +4,12 @@ nextflow_workflow { script "../main.nf" config "./nextflow.config" - workflow "BAM_IMPUTE_GLIMPSE1" + workflow "VCF_IMPUTE_GLIMPSE1" tag "subworkflows" tag "subworkflows_local" - tag "subworkflows/bam_impute_glimpse1" - tag "bam_impute_glimpse1" + tag "subworkflows/vcf_impute_glimpse1" + tag "vcf_impute_glimpse1" tag "bam_gl_bcftools" tag "glimpse" @@ -24,34 +24,25 @@ nextflow_workflow { """ input[0] = Channel.fromList([ [ - [id: "NA12878"], + [id: "NA12878", panel: "1000GP", chr: "22"], file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bcf", checkIfExist:true), file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bcf.csi", checkIfExist:true), ], [ - [id: "NA19401"], + [id: "NA19401", panel: "1000GP", chr: "22"], file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bcf", checkIfExist:true), file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bcf.csi", checkIfExist:true), ], ]) input[1] = Channel.of([ - [id: "1000GP", chr: "22"], - file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.legend.gz", checkIfExist:true) - ]).collect() - input[2] = Channel.of([ [id: "1000GP", chr: "22"], file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.s.norel.vcf.gz", checkIfExist:true), file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.s.norel.vcf.gz.csi", checkIfExist:true), ]).collect() - input[3] = Channel.of( + input[2] = Channel.of( [[chr: "22", id: "1000GP"], "chr22:16570065-16597215", "chr22:16570065-16592216"], [[chr: "22", id: "1000GP"], "chr22:16587172-16609999", "chr22:16592229-16609999"] ) - input[4] = Channel.of([ - [id: "GRCh38"], - file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz.fai", checkIfExist:true), - ]).collect() """ } } @@ -59,8 +50,16 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }).match("Summary_two_vcf") } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() } + ).match() } ) } } @@ -71,29 +70,20 @@ nextflow_workflow { """ input[0] = Channel.fromList([ [ - [id: "NA12878"], + [id: "NA12878", panel: "1000GP", chr: "22"], file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bcf", checkIfExist:true), file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bcf.csi", checkIfExist:true), ] ]) input[1] = Channel.of([ - [id: "1000GP", chr: "22"], - file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.legend.gz", checkIfExist:true) - ]).collect() - input[2] = Channel.of([ [id: "1000GP", chr: "22"], file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.s.norel.vcf.gz", checkIfExist:true), file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.s.norel.vcf.gz.csi", checkIfExist:true), ]).collect() - input[3] = Channel.of( + input[2] = Channel.of( [[chr: "22", id: "1000GP"], "chr22:16570065-16597215", "chr22:16570065-16592216"], [[chr: "22", id: "1000GP"], "chr22:16587172-16609999", "chr22:16592229-16609999"] ) - input[4] = Channel.of([ - [id: "GRCh38"], - file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz.fai", checkIfExist:true), - ]).collect() """ } } @@ -101,8 +91,16 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }).match("Summary_one_vcf") } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary }, + workflow.out.vcf_tbi.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() } + ).match() } ) } } diff --git a/subworkflows/local/vcf_impute_glimpse1/tests/main.nf.test.snap b/subworkflows/local/vcf_impute_glimpse1/tests/main.nf.test.snap index 914a5877..f6481644 100644 --- a/subworkflows/local/vcf_impute_glimpse1/tests/main.nf.test.snap +++ b/subworkflows/local/vcf_impute_glimpse1/tests/main.nf.test.snap @@ -1,369 +1,96 @@ { - "Summary_one_vcf": { + "Impute with glimpse1 one vcf": { "content": [ + [ + "versions.yml:md5,2f8b6f8bb3b3972bb0375abf1de08807", + "versions.yml:md5,2f8b6f8bb3b3972bb0375abf1de08807", + "versions.yml:md5,8c79d92b93fe75a9094499ce5d5eaca2", + "versions.yml:md5,9d78fceae32ec42b1818bb5890e9a6ba", + "versions.yml:md5,bf4a479eb73467775a4afeebd25841aa", + "versions.yml:md5,bf4a479eb73467775a4afeebd25841aa" + ], + [ + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "22", + "tools": "glimpse1" + }, + "NA12878_22_ligate.vcf.gz", + "NA12878_22_ligate.vcf.gz.tbi" + ] + ], [ "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=false, phasedAutodetect=false]" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-15T20:18:10.29281923" - }, - "Impute with glimpse1 one vcf": { - "content": [ - { - "0": [ - [ - { - "id": "NA12878", - "panel": "1000GP", - "chr": "22", - "tools": "glimpse1" - }, - "NA12878_22_ligate.vcf.gz:md5,001cfd63118b26a767149d88d295e770", - "NA12878_22_ligate.vcf.gz.tbi:md5,870a906079573453167617fc818638ab" - ] - ], - "1": [ - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,ba880476e98fa9825649bb9d394a96b5", - "versions.yml:md5,cffe7f76c26424afef6177533d1b8768", - "versions.yml:md5,e554dad12029fb193020cbcdbc1519cc", - "versions.yml:md5,f630355fc3b592f13a2ca2f1edd4aad1" - ], - "2": [ - - ], - "multiqc_files": [ - - ], - "vcf_tbi": [ - [ - { - "id": "NA12878", - "panel": "1000GP", - "chr": "22", - "tools": "glimpse1" - }, - "NA12878_22_ligate.vcf.gz:md5,001cfd63118b26a767149d88d295e770", - "NA12878_22_ligate.vcf.gz.tbi:md5,870a906079573453167617fc818638ab" - ] - ], - "versions": [ - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,ba880476e98fa9825649bb9d394a96b5", - "versions.yml:md5,cffe7f76c26424afef6177533d1b8768", - "versions.yml:md5,e554dad12029fb193020cbcdbc1519cc", - "versions.yml:md5,f630355fc3b592f13a2ca2f1edd4aad1" + ], + [ + [ + "NA12878" ] - } + ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-15T20:18:02.133587421" + "timestamp": "2024-11-07T12:31:45.012960487" }, "Impute with glimpse1 two vcf": { "content": [ - { - "0": [ - [ - { - "id": "NA12878", - "panel": "1000GP", - "chr": "22", - "tools": "glimpse1" - }, - "NA12878_22_ligate.vcf.gz:md5,425adcee9993cd20735d6805aed0a8fc", - "NA12878_22_ligate.vcf.gz.tbi:md5,e642114e10be3e2d0bc7a2ba4ecf71f0" - ], - [ - { - "id": "NA19401", - "panel": "1000GP", - "chr": "22", - "tools": "glimpse1" - }, - "NA19401_22_ligate.vcf.gz:md5,4ce47dfb271878e1e33d333ad97e70ac", - "NA19401_22_ligate.vcf.gz.tbi:md5,7efba07d4dec3b525149f459c08d853b" - ] - ], - "1": [ - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,ba880476e98fa9825649bb9d394a96b5", - "versions.yml:md5,ba880476e98fa9825649bb9d394a96b5", - "versions.yml:md5,cffe7f76c26424afef6177533d1b8768", - "versions.yml:md5,cffe7f76c26424afef6177533d1b8768", - "versions.yml:md5,e554dad12029fb193020cbcdbc1519cc", - "versions.yml:md5,f630355fc3b592f13a2ca2f1edd4aad1" - ], - "2": [ - - ], - "multiqc_files": [ - - ], - "vcf_tbi": [ - [ - { - "id": "NA12878", - "panel": "1000GP", - "chr": "22", - "tools": "glimpse1" - }, - "NA12878_22_ligate.vcf.gz:md5,425adcee9993cd20735d6805aed0a8fc", - "NA12878_22_ligate.vcf.gz.tbi:md5,e642114e10be3e2d0bc7a2ba4ecf71f0" - ], - [ - { - "id": "NA19401", - "panel": "1000GP", - "chr": "22", - "tools": "glimpse1" - }, - "NA19401_22_ligate.vcf.gz:md5,4ce47dfb271878e1e33d333ad97e70ac", - "NA19401_22_ligate.vcf.gz.tbi:md5,7efba07d4dec3b525149f459c08d853b" - ] - ], - "versions": [ - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,ba880476e98fa9825649bb9d394a96b5", - "versions.yml:md5,ba880476e98fa9825649bb9d394a96b5", - "versions.yml:md5,cffe7f76c26424afef6177533d1b8768", - "versions.yml:md5,cffe7f76c26424afef6177533d1b8768", - "versions.yml:md5,e554dad12029fb193020cbcdbc1519cc", - "versions.yml:md5,f630355fc3b592f13a2ca2f1edd4aad1" + [ + "versions.yml:md5,2f8b6f8bb3b3972bb0375abf1de08807", + "versions.yml:md5,2f8b6f8bb3b3972bb0375abf1de08807", + "versions.yml:md5,2f8b6f8bb3b3972bb0375abf1de08807", + "versions.yml:md5,2f8b6f8bb3b3972bb0375abf1de08807", + "versions.yml:md5,8c79d92b93fe75a9094499ce5d5eaca2", + "versions.yml:md5,8c79d92b93fe75a9094499ce5d5eaca2", + "versions.yml:md5,9d78fceae32ec42b1818bb5890e9a6ba", + "versions.yml:md5,9d78fceae32ec42b1818bb5890e9a6ba", + "versions.yml:md5,bf4a479eb73467775a4afeebd25841aa", + "versions.yml:md5,bf4a479eb73467775a4afeebd25841aa", + "versions.yml:md5,bf4a479eb73467775a4afeebd25841aa", + "versions.yml:md5,bf4a479eb73467775a4afeebd25841aa" + ], + [ + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "22", + "tools": "glimpse1" + }, + "NA12878_22_ligate.vcf.gz", + "NA12878_22_ligate.vcf.gz.tbi" + ], + [ + { + "id": "NA19401", + "panel": "1000GP", + "chr": "22", + "tools": "glimpse1" + }, + "NA19401_22_ligate.vcf.gz", + "NA19401_22_ligate.vcf.gz.tbi" ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-15T20:17:35.167720938" - }, - "Summary_two_vcf": { - "content": [ + ], [ "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=false, phasedAutodetect=false]", "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=false, phasedAutodetect=false]" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-15T20:16:04.438014299" - }, - "Summary_two_merged": { - "content": [ + ], [ - "VcfFile [chromosomes=[chr22], sampleCount=2, variantCount=903, phased=false, phasedAutodetect=false]" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-15T19:12:26.717097717" - }, - "Summary_one": { - "content": [ - [ - "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=false, phasedAutodetect=false]" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-15T18:51:53.265129979" - }, - "Impute with glimpse1 two target": { - "content": [ - { - "0": [ - [ - { - "panel": "1000GP", - "chr": "22", - "id": "all", - "metas": [ - { - "id": "NA19401", - "panel": "1000GP", - "chr": "22" - }, - { - "id": "NA12878", - "panel": "1000GP", - "chr": "22" - } - ], - "variantcaller": "bcftools", - "tools": "glimpse1" - }, - "all_22_ligate.vcf.gz:md5,b0c1703dee27ea6cc1fd8bb1f4835c05", - "all_22_ligate.vcf.gz.tbi:md5,7280c66fe369a2737c6137c4f5c1ccfd" - ] + [ + "NA12878" ], - "1": [ - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,470f38ebb4e2333ff70702df9716dfa2", - "versions.yml:md5,470f38ebb4e2333ff70702df9716dfa2", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,ba880476e98fa9825649bb9d394a96b5", - "versions.yml:md5,c31f44e734475e947185393613d55450", - "versions.yml:md5,cffe7f76c26424afef6177533d1b8768", - "versions.yml:md5,e554dad12029fb193020cbcdbc1519cc", - "versions.yml:md5,f630355fc3b592f13a2ca2f1edd4aad1", - "versions.yml:md5,fe05ac885c0841c53f9f4a1cbae5d9e9" - ], - "2": [ - "NA12878.bcftools_stats.txt:md5,4cacbe4d6dfba4a8035e37611c91923c", - "NA19401.bcftools_stats.txt:md5,f91fd586acfdf3845d111a062fbb263f" - ], - "multiqc_files": [ - "NA12878.bcftools_stats.txt:md5,4cacbe4d6dfba4a8035e37611c91923c", - "NA19401.bcftools_stats.txt:md5,f91fd586acfdf3845d111a062fbb263f" - ], - "vcf_tbi": [ - [ - { - "panel": "1000GP", - "chr": "22", - "id": "all", - "metas": [ - { - "id": "NA19401", - "panel": "1000GP", - "chr": "22" - }, - { - "id": "NA12878", - "panel": "1000GP", - "chr": "22" - } - ], - "variantcaller": "bcftools", - "tools": "glimpse1" - }, - "all_22_ligate.vcf.gz:md5,b0c1703dee27ea6cc1fd8bb1f4835c05", - "all_22_ligate.vcf.gz.tbi:md5,7280c66fe369a2737c6137c4f5c1ccfd" - ] - ], - "versions": [ - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,470f38ebb4e2333ff70702df9716dfa2", - "versions.yml:md5,470f38ebb4e2333ff70702df9716dfa2", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,ba880476e98fa9825649bb9d394a96b5", - "versions.yml:md5,c31f44e734475e947185393613d55450", - "versions.yml:md5,cffe7f76c26424afef6177533d1b8768", - "versions.yml:md5,e554dad12029fb193020cbcdbc1519cc", - "versions.yml:md5,f630355fc3b592f13a2ca2f1edd4aad1", - "versions.yml:md5,fe05ac885c0841c53f9f4a1cbae5d9e9" - ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-15T20:18:58.997991111" - }, - "Impute with glimpse1 one target": { - "content": [ - { - "0": [ - [ - { - "id": "NA12878", - "panel": "1000GP", - "chr": "22", - "variantcaller": "bcftools", - "tools": "glimpse1" - }, - "NA12878_22_ligate.vcf.gz:md5,3ca556e82a6d1eb0e1b85d6ee3e60382", - "NA12878_22_ligate.vcf.gz.tbi:md5,e642114e10be3e2d0bc7a2ba4ecf71f0" - ] - ], - "1": [ - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,470f38ebb4e2333ff70702df9716dfa2", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,ba880476e98fa9825649bb9d394a96b5", - "versions.yml:md5,cffe7f76c26424afef6177533d1b8768", - "versions.yml:md5,e554dad12029fb193020cbcdbc1519cc", - "versions.yml:md5,f630355fc3b592f13a2ca2f1edd4aad1", - "versions.yml:md5,fe05ac885c0841c53f9f4a1cbae5d9e9" - ], - "2": [ - "NA12878.bcftools_stats.txt:md5,4cacbe4d6dfba4a8035e37611c91923c" - ], - "multiqc_files": [ - "NA12878.bcftools_stats.txt:md5,4cacbe4d6dfba4a8035e37611c91923c" - ], - "vcf_tbi": [ - [ - { - "id": "NA12878", - "panel": "1000GP", - "chr": "22", - "variantcaller": "bcftools", - "tools": "glimpse1" - }, - "NA12878_22_ligate.vcf.gz:md5,3ca556e82a6d1eb0e1b85d6ee3e60382", - "NA12878_22_ligate.vcf.gz.tbi:md5,e642114e10be3e2d0bc7a2ba4ecf71f0" - ] - ], - "versions": [ - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,37a7932cdb5436e6de517224997782b7", - "versions.yml:md5,470f38ebb4e2333ff70702df9716dfa2", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,a3db5c2981d19a6f37340bb9c7cede83", - "versions.yml:md5,ba880476e98fa9825649bb9d394a96b5", - "versions.yml:md5,cffe7f76c26424afef6177533d1b8768", - "versions.yml:md5,e554dad12029fb193020cbcdbc1519cc", - "versions.yml:md5,f630355fc3b592f13a2ca2f1edd4aad1", - "versions.yml:md5,fe05ac885c0841c53f9f4a1cbae5d9e9" + [ + "NA19401" ] - } + ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-15T20:19:46.19707687" + "timestamp": "2024-11-07T12:31:10.854492318" } } \ No newline at end of file diff --git a/subworkflows/local/vcf_normalize_bcftools/main.nf b/subworkflows/local/vcf_normalize_bcftools/main.nf index 5129af8b..b90cb6aa 100644 --- a/subworkflows/local/vcf_normalize_bcftools/main.nf +++ b/subworkflows/local/vcf_normalize_bcftools/main.nf @@ -12,7 +12,7 @@ workflow VCF_NORMALIZE_BCFTOOLS { main: ch_versions = Channel.empty() - ch_fasta = ch_fasta.map { meta, fasta, fai -> [meta, fasta] } + ch_fasta = ch_fasta.map { meta, fasta, _fai -> [meta, fasta] } // Join duplicated biallelic sites into multiallelic records if (params.normalize) { diff --git a/subworkflows/local/vcf_normalize_bcftools/tests/main.nf.test b/subworkflows/local/vcf_normalize_bcftools/tests/main.nf.test index 68333ed4..6fa38fbd 100644 --- a/subworkflows/local/vcf_normalize_bcftools/tests/main.nf.test +++ b/subworkflows/local/vcf_normalize_bcftools/tests/main.nf.test @@ -54,11 +54,20 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ - path(it[1]).vcf.summary - }).match("Normalize content") - }, + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ + path(it[1]).vcf.summary + }, + workflow.out.vcf_tbi.collect{ + path(it[1]).vcf.header.getGenotypeSamples().size() + } + ).match() }, { workflow.out.vcf_tbi.collect{ assert path(it[1]).vcf.variantCount == path(it[1]).vcf.noSnps }} @@ -100,11 +109,20 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ - path(it[1]).vcf.summary - }).match("Norm content recomputed") - } + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ + path(it[1]).vcf.summary + }, + workflow.out.vcf_tbi.collect{ + path(it[1]).vcf.header.getGenotypeSamples().size() + } + ).match() } ) } } diff --git a/subworkflows/local/vcf_normalize_bcftools/tests/main.nf.test.snap b/subworkflows/local/vcf_normalize_bcftools/tests/main.nf.test.snap index af3ae15d..ae68d16e 100644 --- a/subworkflows/local/vcf_normalize_bcftools/tests/main.nf.test.snap +++ b/subworkflows/local/vcf_normalize_bcftools/tests/main.nf.test.snap @@ -1,154 +1,88 @@ { - "Normalize content": { - "content": [ - [ - "VcfFile [chromosomes=[chr21], sampleCount=3196, variantCount=836, phased=true, phasedAutodetect=true]", - "VcfFile [chromosomes=[chr22], sampleCount=3196, variantCount=903, phased=true, phasedAutodetect=true]" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-07-18T15:21:05.213839279" - }, "Normalize vcf with computing frequencies after removing samples": { "content": [ - { - "0": [ - [ - { - "id": "1000GP", - "chr": "chr21" - }, - "1000GP_chr21_fixed.vcf.gz:md5,07239edd29a6c5a8ca1c3226d0f83de5", - "1000GP_chr21_fixed.vcf.gz.tbi:md5,388eefaf444c084970d27dff0478b212" - ], - [ - { - "id": "1000GP", - "chr": "chr22" - }, - "1000GP_chr22_fixed.vcf.gz:md5,5d4579b182241f5aa812206ac81835d7", - "1000GP_chr22_fixed.vcf.gz.tbi:md5,9088246d10963b3cd8704715dc09c436" - ] - ], - "1": [ - "versions.yml:md5,3bba75c8e94eb2271ad38e3a1ee06ad8", - "versions.yml:md5,3bba75c8e94eb2271ad38e3a1ee06ad8", - "versions.yml:md5,bdf2c1ea1cace63b301158243f3fd12f", - "versions.yml:md5,bdf2c1ea1cace63b301158243f3fd12f", - "versions.yml:md5,c1918a7ebe19e200e8981e12c8fd52d4", - "versions.yml:md5,c1918a7ebe19e200e8981e12c8fd52d4", - "versions.yml:md5,da9510d939fc9cb45b897127f0d5e490", - "versions.yml:md5,da9510d939fc9cb45b897127f0d5e490" - ], - "vcf_tbi": [ - [ - { - "id": "1000GP", - "chr": "chr21" - }, - "1000GP_chr21_fixed.vcf.gz:md5,07239edd29a6c5a8ca1c3226d0f83de5", - "1000GP_chr21_fixed.vcf.gz.tbi:md5,388eefaf444c084970d27dff0478b212" - ], - [ - { - "id": "1000GP", - "chr": "chr22" - }, - "1000GP_chr22_fixed.vcf.gz:md5,5d4579b182241f5aa812206ac81835d7", - "1000GP_chr22_fixed.vcf.gz.tbi:md5,9088246d10963b3cd8704715dc09c436" - ] + [ + "versions.yml:md5,3bba75c8e94eb2271ad38e3a1ee06ad8", + "versions.yml:md5,3bba75c8e94eb2271ad38e3a1ee06ad8", + "versions.yml:md5,bdf2c1ea1cace63b301158243f3fd12f", + "versions.yml:md5,bdf2c1ea1cace63b301158243f3fd12f", + "versions.yml:md5,c1918a7ebe19e200e8981e12c8fd52d4", + "versions.yml:md5,c1918a7ebe19e200e8981e12c8fd52d4", + "versions.yml:md5,da9510d939fc9cb45b897127f0d5e490", + "versions.yml:md5,da9510d939fc9cb45b897127f0d5e490" + ], + [ + [ + { + "id": "1000GP", + "chr": "chr21" + }, + "1000GP_chr21_fixed.vcf.gz", + "1000GP_chr21_fixed.vcf.gz.tbi" ], - "versions": [ - "versions.yml:md5,3bba75c8e94eb2271ad38e3a1ee06ad8", - "versions.yml:md5,3bba75c8e94eb2271ad38e3a1ee06ad8", - "versions.yml:md5,bdf2c1ea1cace63b301158243f3fd12f", - "versions.yml:md5,bdf2c1ea1cace63b301158243f3fd12f", - "versions.yml:md5,c1918a7ebe19e200e8981e12c8fd52d4", - "versions.yml:md5,c1918a7ebe19e200e8981e12c8fd52d4", - "versions.yml:md5,da9510d939fc9cb45b897127f0d5e490", - "versions.yml:md5,da9510d939fc9cb45b897127f0d5e490" + [ + { + "id": "1000GP", + "chr": "chr22" + }, + "1000GP_chr22_fixed.vcf.gz", + "1000GP_chr22_fixed.vcf.gz.tbi" ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-07-22T15:51:30.725699084" - }, - "Norm content recomputed": { - "content": [ + ], [ "VcfFile [chromosomes=[chr21], sampleCount=3190, variantCount=836, phased=true, phasedAutodetect=true]", "VcfFile [chromosomes=[chr22], sampleCount=3190, variantCount=903, phased=true, phasedAutodetect=true]" + ], + [ + 3190, + 3190 ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-18T15:23:37.057826205" + "timestamp": "2024-11-07T14:11:08.9049564" }, "Normalize vcf without computing frequencies nor removing samples": { "content": [ - { - "0": [ - [ - { - "id": "1000GP", - "chr": "chr21" - }, - "1000GP_chr21_biallelic_snps.vcf.gz:md5,17746c80b9e02787f4cb950a3c2efa93", - "1000GP_chr21_biallelic_snps.vcf.gz.tbi:md5,006d0bec1050410aa64d427e2fad42e2" - ], - [ - { - "id": "1000GP", - "chr": "chr22" - }, - "1000GP_chr22_biallelic_snps.vcf.gz:md5,817ebeceadcaea1e95f92c7b67659f28", - "1000GP_chr22_biallelic_snps.vcf.gz.tbi:md5,d3460d21cacfbb15b34289454e2922a8" - ] - ], - "1": [ - "versions.yml:md5,c1918a7ebe19e200e8981e12c8fd52d4", - "versions.yml:md5,c1918a7ebe19e200e8981e12c8fd52d4", - "versions.yml:md5,da9510d939fc9cb45b897127f0d5e490", - "versions.yml:md5,da9510d939fc9cb45b897127f0d5e490" - ], - "vcf_tbi": [ - [ - { - "id": "1000GP", - "chr": "chr21" - }, - "1000GP_chr21_biallelic_snps.vcf.gz:md5,17746c80b9e02787f4cb950a3c2efa93", - "1000GP_chr21_biallelic_snps.vcf.gz.tbi:md5,006d0bec1050410aa64d427e2fad42e2" - ], - [ - { - "id": "1000GP", - "chr": "chr22" - }, - "1000GP_chr22_biallelic_snps.vcf.gz:md5,817ebeceadcaea1e95f92c7b67659f28", - "1000GP_chr22_biallelic_snps.vcf.gz.tbi:md5,d3460d21cacfbb15b34289454e2922a8" - ] + [ + "versions.yml:md5,c1918a7ebe19e200e8981e12c8fd52d4", + "versions.yml:md5,c1918a7ebe19e200e8981e12c8fd52d4", + "versions.yml:md5,da9510d939fc9cb45b897127f0d5e490", + "versions.yml:md5,da9510d939fc9cb45b897127f0d5e490" + ], + [ + [ + { + "id": "1000GP", + "chr": "chr21" + }, + "1000GP_chr21_biallelic_snps.vcf.gz", + "1000GP_chr21_biallelic_snps.vcf.gz.tbi" ], - "versions": [ - "versions.yml:md5,c1918a7ebe19e200e8981e12c8fd52d4", - "versions.yml:md5,c1918a7ebe19e200e8981e12c8fd52d4", - "versions.yml:md5,da9510d939fc9cb45b897127f0d5e490", - "versions.yml:md5,da9510d939fc9cb45b897127f0d5e490" + [ + { + "id": "1000GP", + "chr": "chr22" + }, + "1000GP_chr22_biallelic_snps.vcf.gz", + "1000GP_chr22_biallelic_snps.vcf.gz.tbi" ] - } + ], + [ + "VcfFile [chromosomes=[chr21], sampleCount=3196, variantCount=836, phased=true, phasedAutodetect=true]", + "VcfFile [chromosomes=[chr22], sampleCount=3196, variantCount=903, phased=true, phasedAutodetect=true]" + ], + [ + 3196, + 3196 + ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-22T15:51:02.997348191" + "timestamp": "2024-11-07T14:10:11.989583075" } } \ No newline at end of file diff --git a/subworkflows/local/vcf_phase_shapeit5/main.nf b/subworkflows/local/vcf_phase_shapeit5/main.nf index 7bf0e7d2..a8950adb 100644 --- a/subworkflows/local/vcf_phase_shapeit5/main.nf +++ b/subworkflows/local/vcf_phase_shapeit5/main.nf @@ -21,12 +21,12 @@ workflow VCF_PHASE_SHAPEIT5 { // Chunk with Glimpse2 ch_input_glimpse2 = ch_vcf .map{ - metaIC, vcf, csi, pedigree -> [metaIC.subMap("chr"), metaIC, vcf, csi] + metaIC, vcf, csi, _pedigree -> [metaIC.subMap("chr"), metaIC, vcf, csi] } .combine(ch_region.map{ metaCR, region -> [metaCR.subMap("chr"), region]}, by:0) .join(ch_map) .map{ - metaC, metaIC, vcf, csi, region, gmap -> [metaIC, vcf, csi, region, gmap] + _metaC, metaIC, vcf, csi, region, gmap -> [metaIC, vcf, csi, region, gmap] } GLIMPSE2_CHUNK ( ch_input_glimpse2, chunk_model ) ch_versions = ch_versions.mix( GLIMPSE2_CHUNK.out.versions.first() ) @@ -47,7 +47,7 @@ workflow VCF_PHASE_SHAPEIT5 { metaIC, vcf, csi, pedigree, regionbuf, regioncnk -> [metaIC.subMap("chr"), metaIC, vcf, csi, pedigree, regionbuf, regioncnk] } .combine(ch_map, by:0) - .map { metaC, metaIC, vcf, index, pedigree, regionbuf, regioncnk, gmap -> + .map { _metaC, metaIC, vcf, index, pedigree, regionbuf, regioncnk, gmap -> [metaIC + [chunk: regioncnk], vcf, index, pedigree, regionbuf, gmap] } diff --git a/subworkflows/local/vcf_phase_shapeit5/tests/main.nf.test b/subworkflows/local/vcf_phase_shapeit5/tests/main.nf.test index a2f855ac..622331e8 100644 --- a/subworkflows/local/vcf_phase_shapeit5/tests/main.nf.test +++ b/subworkflows/local/vcf_phase_shapeit5/tests/main.nf.test @@ -61,11 +61,16 @@ nextflow_workflow { assertAll( { assert workflow.success }, { assert snapshot( - workflow.out, + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary - }).match() - }, + } + ).match() }, { workflow.out.vcf_tbi.collect{ assert path(it[1]).vcf.phased }} @@ -114,11 +119,16 @@ nextflow_workflow { assertAll( { assert workflow.success }, { assert snapshot( - workflow.out, + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, workflow.out.vcf_tbi.collect{ path(it[1]).vcf.summary - }).match() - }, + } + ).match() }, { workflow.out.vcf_tbi.collect{ assert path(it[1]).vcf.phased }} diff --git a/subworkflows/local/vcf_phase_shapeit5/tests/main.nf.test.snap b/subworkflows/local/vcf_phase_shapeit5/tests/main.nf.test.snap index bb7e9f9d..b4a9bd23 100644 --- a/subworkflows/local/vcf_phase_shapeit5/tests/main.nf.test.snap +++ b/subworkflows/local/vcf_phase_shapeit5/tests/main.nf.test.snap @@ -53,6 +53,31 @@ "versions.yml:md5,ed131d2608f28f8ada06ccc42717575e" ] }, + [ + "versions.yml:md5,529c03b8d921c72026e91d71c0321811", + "versions.yml:md5,714bb0db6e2d39cf0042359a64915bc6", + "versions.yml:md5,8ffcda8a9d22f60c90d0e4276da3e714", + "versions.yml:md5,cab7592ebcb3d391afcd3191a175723b", + "versions.yml:md5,ed131d2608f28f8ada06ccc42717575e" + ], + [ + [ + { + "id": "1000GP", + "chr": "chr21" + }, + "1000GP.vcf.gz", + "1000GP.vcf.gz.csi" + ], + [ + { + "id": "1000GP", + "chr": "chr22" + }, + "1000GP.vcf.gz", + "1000GP.vcf.gz.csi" + ] + ], [ "VcfFile [chromosomes=[chr21], sampleCount=3196, variantCount=836, phased=true, phasedAutodetect=true]", "VcfFile [chromosomes=[chr22], sampleCount=3196, variantCount=903, phased=true, phasedAutodetect=true]" diff --git a/subworkflows/local/vcf_sites_extract_bcftools/main.nf b/subworkflows/local/vcf_sites_extract_bcftools/main.nf index d82736b4..c94dd95e 100644 --- a/subworkflows/local/vcf_sites_extract_bcftools/main.nf +++ b/subworkflows/local/vcf_sites_extract_bcftools/main.nf @@ -9,7 +9,7 @@ workflow VCF_SITES_EXTRACT_BCFTOOLS { main: ch_versions = Channel.empty() - ch_fasta = ch_fasta.map { meta, fasta, fai -> [meta, fasta] } + ch_fasta = ch_fasta.map { meta, fasta, _fai -> [meta, fasta] } // Convert VCF to Hap and Legend files BCFTOOLS_CONVERT(ch_vcf, ch_fasta, []) diff --git a/subworkflows/local/vcf_split_bcftools/tests/main.nf.test b/subworkflows/local/vcf_split_bcftools/tests/main.nf.test index bcb0a9ed..46c09660 100644 --- a/subworkflows/local/vcf_split_bcftools/tests/main.nf.test +++ b/subworkflows/local/vcf_split_bcftools/tests/main.nf.test @@ -57,11 +57,17 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out).match() }, - { assert snapshot(workflow.out.vcf_tbi.collect{ - path(it[1]).vcf.summary - }).match("Phasing content") - }, + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_tbi.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_tbi.collect{ + path(it[1]).vcf.summary + } + ).match() }, { workflow.out.vcf_tbi.collect{ assert path(it[1]).vcf.sampleCount == 1 }} diff --git a/subworkflows/local/vcf_split_bcftools/tests/main.nf.test.snap b/subworkflows/local/vcf_split_bcftools/tests/main.nf.test.snap index 8ffde0b8..d3bd681e 100644 --- a/subworkflows/local/vcf_split_bcftools/tests/main.nf.test.snap +++ b/subworkflows/local/vcf_split_bcftools/tests/main.nf.test.snap @@ -1,69 +1,32 @@ { "Split vcf file": { "content": [ - { - "0": [ - [ - { - "id": "NA12878" - }, - "NA12878.vcf.gz:md5,af16cd340d33ffecc15dd6062b243232", - "NA12878.vcf.gz.tbi:md5,31c12acb72d301cc69478c58b513d779" - ], - [ - { - "id": "NA19401" - }, - "NA19401.vcf.gz:md5,09e2e2a30260310fe7db55edcf36b1c9", - "NA19401.vcf.gz.tbi:md5,8f93c5e7d94089d9b0313f1d7d7ba40d" - ], - [ - { - "id": "NA20359" - }, - "NA20359.vcf.gz:md5,56cba6b61bcc14c42d92bf3708ebf621", - "NA20359.vcf.gz.tbi:md5,6bf326636fb91d7ffffad543763c5be1" - ] - ], - "1": [ - "versions.yml:md5,6c3351d97e3a99f7a7a3231fc49f92e2" + [ + "versions.yml:md5,6c3351d97e3a99f7a7a3231fc49f92e2" + ], + [ + [ + { + "id": "NA12878" + }, + "NA12878.vcf.gz", + "NA12878.vcf.gz.tbi" ], - "vcf_tbi": [ - [ - { - "id": "NA12878" - }, - "NA12878.vcf.gz:md5,af16cd340d33ffecc15dd6062b243232", - "NA12878.vcf.gz.tbi:md5,31c12acb72d301cc69478c58b513d779" - ], - [ - { - "id": "NA19401" - }, - "NA19401.vcf.gz:md5,09e2e2a30260310fe7db55edcf36b1c9", - "NA19401.vcf.gz.tbi:md5,8f93c5e7d94089d9b0313f1d7d7ba40d" - ], - [ - { - "id": "NA20359" - }, - "NA20359.vcf.gz:md5,56cba6b61bcc14c42d92bf3708ebf621", - "NA20359.vcf.gz.tbi:md5,6bf326636fb91d7ffffad543763c5be1" - ] + [ + { + "id": "NA19401" + }, + "NA19401.vcf.gz", + "NA19401.vcf.gz.tbi" ], - "versions": [ - "versions.yml:md5,6c3351d97e3a99f7a7a3231fc49f92e2" + [ + { + "id": "NA20359" + }, + "NA20359.vcf.gz", + "NA20359.vcf.gz.tbi" ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-07-22T15:45:19.206308102" - }, - "Phasing content": { - "content": [ + ], [ "VcfFile [chromosomes=[chr21, chr22], sampleCount=1, variantCount=1739, phased=true, phasedAutodetect=true]", "VcfFile [chromosomes=[chr21, chr22], sampleCount=1, variantCount=1739, phased=true, phasedAutodetect=true]", @@ -71,9 +34,9 @@ ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-07-18T17:13:33.060063904" + "timestamp": "2024-11-07T14:13:06.801872176" } } \ No newline at end of file diff --git a/workflows/chrcheck/main.nf b/workflows/chrcheck/main.nf index f193e91c..b8e1e912 100644 --- a/workflows/chrcheck/main.nf +++ b/workflows/chrcheck/main.nf @@ -32,13 +32,13 @@ workflow CHRCHECK { // Check if channel is empty chr_vcf_disjoint = Channel.empty() // Extract the contig names from the VCF files - VCF_CHR_EXTRACT(ch_input.vcf.map{ meta, file, index, chr -> [meta, file] }) + VCF_CHR_EXTRACT(ch_input.vcf.map{ meta, file, _index, _chr -> [meta, file] }) ch_versions = ch_versions.mix(VCF_CHR_EXTRACT.out.versions) chr_vcf_disjoint = checkChr(VCF_CHR_EXTRACT.out.chr, ch_input.vcf) chr_bam_disjoint = Channel.empty() // Extract the contig names from the BAM files - BAM_CHR_EXTRACT(ch_input.bam.map{ meta, file, index, chr -> [meta, file] }) + BAM_CHR_EXTRACT(ch_input.bam.map{ meta, file, _index, _chr -> [meta, file] }) ch_versions = ch_versions.mix(BAM_CHR_EXTRACT.out.versions) chr_bam_disjoint = checkChr(BAM_CHR_EXTRACT.out.chr, ch_input.bam) @@ -46,7 +46,7 @@ workflow CHRCHECK { ch_bam_renamed = Channel.empty() // Rename the contigs in the BAM files BAM_CHR_RENAME_SAMTOOLS( - chr_bam_disjoint.to_rename.map{meta, bam, csi, diff, prefix -> [meta, bam, csi, prefix]} + chr_bam_disjoint.to_rename.map{meta, bam, csi, _diff, prefix -> [meta, bam, csi, prefix]} ) ch_versions = ch_versions.mix(BAM_CHR_RENAME_SAMTOOLS.out.versions) ch_bam_renamed = BAM_CHR_RENAME_SAMTOOLS.out.bam_renamed @@ -58,11 +58,11 @@ workflow CHRCHECK { ch_vcf_renamed = VCF_CHR_RENAME_BCFTOOLS.out.vcf_renamed } else { chr_vcf_disjoint.to_rename.map { - chr_names = it[3].size() > params.max_chr_names ? it[3][0..params.max_chr_names - 1] + ['...'] : it[3] + def chr_names = it[3].size() > params.max_chr_names ? it[3][0..params.max_chr_names - 1] + ['...'] : it[3] error "Contig names: ${chr_names} in VCF: ${it[1]} are not present in reference genome with same writing. Please set `rename_chr` to `true` to rename the contigs." } chr_bam_disjoint.to_rename.map { - chr_names = it[3].size() > params.max_chr_names ? it[3][0..params.max_chr_names - 1] + ['...'] : it[3] + def chr_names = it[3].size() > params.max_chr_names ? it[3][0..params.max_chr_names - 1] + ['...'] : it[3] error "Contig names: ${chr_names} in BAM: ${it[1]} are not present in reference genome with same writing. Please set `rename_chr` to `true` to rename the contigs." } ch_vcf_renamed = Channel.empty() diff --git a/workflows/chrcheck/tests/main.nf.test b/workflows/chrcheck/tests/main.nf.test index 367e24c1..c6e063af 100644 --- a/workflows/chrcheck/tests/main.nf.test +++ b/workflows/chrcheck/tests/main.nf.test @@ -26,14 +26,14 @@ nextflow_workflow { input[0] = Channel.fromList([ [ [id: "VCF_chr22"], - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz',checkIfExist:true), - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz.tbi',checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz',checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz.tbi',checkIfExist:true), ["22"] ], [ [id: "BAM_chr22"], - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExist:true), - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExist:true), ["22"] ] ]) @@ -74,8 +74,8 @@ nextflow_workflow { input[0] = Channel.fromList([ [ [id: "BAM_22"], - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExist:true), - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExist:true), "nochr" ] ]) @@ -91,8 +91,8 @@ nextflow_workflow { Channel.fromList([ [ [id: "VCF_AllNoChr"], - file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz",checkIfExist:true), - file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz.tbi",checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz',checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz.tbi',checkIfExist:true), ], ]) ) @@ -131,8 +131,8 @@ nextflow_workflow { input[0] = Channel.fromList([ [ [id: "VCF_chr22"], - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz',checkIfExist:true), - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz.tbi',checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz',checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz.tbi',checkIfExist:true), ["22"] ] ]) @@ -158,8 +158,8 @@ nextflow_workflow { input[0] = Channel.fromList([ [ [id: "BAM_chr22"], - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExist:true), - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExist:true), ["22"] ] ]) @@ -186,8 +186,8 @@ nextflow_workflow { input[0] = Channel.fromList([ [ [id: "VCF_AllNoChr"], - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz',checkIfExist:true), - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz.tbi',checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz',checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz.tbi',checkIfExist:true), lst_chr ], ]) @@ -211,8 +211,8 @@ nextflow_workflow { input[0] = Channel.fromList([ [ [id: "BAM_chr22"], - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExist:true), - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExist:true), ["chr1"] ], ]) diff --git a/workflows/chrcheck/tests/nextflow.config b/workflows/chrcheck/tests/nextflow.config index d454193d..43b74e31 100644 --- a/workflows/chrcheck/tests/nextflow.config +++ b/workflows/chrcheck/tests/nextflow.config @@ -1,5 +1,12 @@ +process { + resourceLimits = [ + cpus: 2, + memory: '7.GB', + time: '1.h' + ] +} + params { - max_memory = '7.GB' rename_chr = false max_chr_names = 4 } diff --git a/workflows/chrcheck/tests/nextflow_rename.config b/workflows/chrcheck/tests/nextflow_rename.config index 65e780a3..bd0e1f3c 100644 --- a/workflows/chrcheck/tests/nextflow_rename.config +++ b/workflows/chrcheck/tests/nextflow_rename.config @@ -1,5 +1,12 @@ +process { + resourceLimits = [ + cpus: 2, + memory: '7.GB', + time: '1.h' + ] +} + params { - max_memory = '7.GB' rename_chr = true max_chr_names = 4 } diff --git a/workflows/phaseimpute/main.nf b/workflows/phaseimpute/main.nf index fe4c1fa9..bc7baefc 100644 --- a/workflows/phaseimpute/main.nf +++ b/workflows/phaseimpute/main.nf @@ -232,11 +232,11 @@ workflow PHASEIMPUTE { .map{ error "Input files must be either BAM/CRAM or VCF/BCF" } // Group BAMs by batch size - def nb_batch = 0 + def nb_batch = -1 ch_input_bams = ch_input_type.bam .toSortedList { it1, it2 -> it1[0]["id"] <=> it2[0]["id"] } .map { list -> list.collate(params.batch_size) - .collect{ [[id: "all", batch: nb_batch++], it] } } + .collect{ nb_batch += 1; [[id: "all", batch: nb_batch], it] } } .map { list -> [list.collect{ it[0] }, list.collect{ it[1] }] } .transpose() .map { metaI, filestuples-> [ @@ -245,7 +245,7 @@ workflow PHASEIMPUTE { ] } LIST_TO_FILE( - ch_input_bams.map{ meta, file, index -> [ + ch_input_bams.map{ meta, file, _index -> [ meta, file, meta.metas.collect { it.id } ] } ) @@ -285,8 +285,7 @@ workflow PHASEIMPUTE { VCF_IMPUTE_GLIMPSE1( ch_input_glimpse1, ch_panel_phased, - ch_chunks_glimpse1, - ch_fasta + ch_chunks_glimpse1 ) ch_versions = ch_versions.mix(VCF_IMPUTE_GLIMPSE1.out.versions) diff --git a/workflows/phaseimpute/tests/main.nf.test.snap b/workflows/phaseimpute/tests/main.nf.test.snap index 5cb0c564..336b9585 100644 --- a/workflows/phaseimpute/tests/main.nf.test.snap +++ b/workflows/phaseimpute/tests/main.nf.test.snap @@ -190,10 +190,10 @@ ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-25T19:14:20.211846091" + "timestamp": "2024-11-06T21:16:53.209347713" }, "Check test_batch": { "content": [ @@ -232,17 +232,17 @@ ], "VcfFile [chromosomes=[chr21, chr22], sampleCount=2, variantCount=1739, phased=true]", [ - "NA19401", - "NA20359" + "NA12878", + "NA19401" ], "VcfFile [chromosomes=[chr21, chr22], sampleCount=2, variantCount=1739, phased=true]", [ - "NA19401", - "NA20359" + "NA12878", + "NA19401" ], "VcfFile [chromosomes=[chr21, chr22], sampleCount=1, variantCount=1739, phased=true]", [ - "NA12878" + "NA20359" ], "VcfFile [chromosomes=[chr21, chr22], sampleCount=1, variantCount=1739, phased=true]", [ @@ -268,10 +268,10 @@ ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-25T19:25:15.563226326" + "timestamp": "2024-11-06T21:03:44.505303287" }, "Check test_quilt": { "content": [