diff --git a/.gitignore b/.gitignore index cc2b1a7..5516a06 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ testing* *.pyc null/ .lineage/ +.nf-test* diff --git a/CHANGELOG.md b/CHANGELOG.md index 60dad40..36d6f40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ Initial release of nf-core/datasync, created with the [nf-core](https://nf-co.re ### `Added` +- [[#31](https://github.com/nf-core/datasync/pull/31)] - Compute checksum for each input file ([@delfiterradas](https://github.com/delfiterradas), review by [@atrigila](https://github.com/atrigila)). + ### `Fixed` ### `Dependencies` diff --git a/assets/samplesheet.csv b/assets/samplesheet.csv index 5f653ab..55cd8f9 100644 --- a/assets/samplesheet.csv +++ b/assets/samplesheet.csv @@ -1,3 +1,3 @@ -sample,fastq_1,fastq_2 -SAMPLE_PAIRED_END,/path/to/fastq/files/AEG588A1_S1_L002_R1_001.fastq.gz,/path/to/fastq/files/AEG588A1_S1_L002_R2_001.fastq.gz -SAMPLE_SINGLE_END,/path/to/fastq/files/AEG588A4_S4_L003_R1_001.fastq.gz, +sample,input +human_grch38_sequence,s3://ngi-igenomes/igenomes/Homo_sapiens/NCBI/GRCh38/Sequence/WholeGenomeFasta/ +test_fastq,https://github.com/nf-core/test-datasets/raw/71ac9e72555f901d2864ccb27d534933411e3ed4/data/genomics/sarscov2/illumina/fastq/test2_1.fastq.gz diff --git a/assets/schema_input.json b/assets/schema_input.json index 248b66e..4afb584 100644 --- a/assets/schema_input.json +++ b/assets/schema_input.json @@ -13,21 +13,12 @@ "errorMessage": "Sample name must be provided and cannot contain spaces", "meta": ["id"] }, - "fastq_1": { + "input": { "type": "string", - "format": "file-path", - "exists": true, - "pattern": "^([\\S\\s]*\\/)?[^\\s\\/]+\\.f(ast)?q\\.gz$", - "errorMessage": "FastQ file for reads 1 must be provided, cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'" - }, - "fastq_2": { - "type": "string", - "format": "file-path", - "exists": true, - "pattern": "^([\\S\\s]*\\/)?[^\\s\\/]+\\.f(ast)?q\\.gz$", - "errorMessage": "FastQ file for reads 2 cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'" + "pattern": "^\\S+$", + "errorMessage": "Input path must be provided and cannot contain spaces" } }, - "required": ["sample", "fastq_1"] + "required": ["sample", "input"] } } diff --git a/conf/test.config b/conf/test.config index 7b7af9e..3f62cb0 100644 --- a/conf/test.config +++ b/conf/test.config @@ -25,6 +25,6 @@ params { // Input data // TODO nf-core: Specify the paths to your test data on nf-core/test-datasets // TODO nf-core: Give any required params for the test so that command line flags are not needed - input = params.pipelines_testdata_base_path + 'viralrecon/samplesheet/samplesheet_test_illumina_amplicon.csv'// Genome references + input = "${projectDir}/assets/samplesheet.csv" genome = 'R64-1-1' } diff --git a/modules.json b/modules.json index 578acbb..13a67eb 100644 --- a/modules.json +++ b/modules.json @@ -10,10 +10,20 @@ "git_sha": "6d46786420b4d7bc88eba026eb389c0c5535d120", "installed_by": ["modules"] }, + "md5sum": { + "branch": "master", + "git_sha": "6d46786420b4d7bc88eba026eb389c0c5535d120", + "installed_by": ["modules"] + }, "multiqc": { "branch": "master", "git_sha": "008f9d3e61209bf995edac3ba531f54e269e1215", "installed_by": ["modules"] + }, + "shasum": { + "branch": "master", + "git_sha": "ef2ee0358c7d03231834aeac816991aeb20debd7", + "installed_by": ["modules"] } } }, diff --git a/modules/nf-core/md5sum/environment.yml b/modules/nf-core/md5sum/environment.yml new file mode 100644 index 0000000..9b926b1 --- /dev/null +++ b/modules/nf-core/md5sum/environment.yml @@ -0,0 +1,12 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - conda-forge::coreutils=9.5 + - conda-forge::grep=3.11 + - conda-forge::gzip=1.13 + - conda-forge::lbzip2=2.5 + - conda-forge::sed=4.8 + - conda-forge::tar=1.34 diff --git a/modules/nf-core/md5sum/main.nf b/modules/nf-core/md5sum/main.nf new file mode 100644 index 0000000..7dafd75 --- /dev/null +++ b/modules/nf-core/md5sum/main.nf @@ -0,0 +1,55 @@ +process MD5SUM { + tag "${meta.id}" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container + ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/52/52ccce28d2ab928ab862e25aae26314d69c8e38bd41ca9431c67ef05221348aa/data' + : 'community.wave.seqera.io/library/coreutils_grep_gzip_lbzip2_pruned:838ba80435a629f8'}" + + input: + tuple val(meta), path(files) + val as_separate_files + + output: + tuple val(meta), path("*.md5"), emit: checksum + tuple val("${task.process}"), val('md5sum'), eval("md5sum --version | sed '1!d; s/.* //'"), topic: versions, emit: versions_md5sum + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + // will only use when as_separate_files = false + if (as_separate_files) { + """ + find -L * -maxdepth 0 -type f \\ + ! -name '*.md5' \\ + -exec sh -c 'md5sum ${args} "\$1" > "\$1.md5"' _ "{}" \\; + """ + } + else { + """ + find -L * -type f \\ + ! -name '*.md5' \\ + -exec md5sum ${args} "{}" + \\ + > ${prefix}.md5 + """ + } + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + if (as_separate_files) { + """ + find -L * -type f \\ + ! -name '*.md5' \\ + -exec sh -c 'touch "\$1.md5"' _ "{}" \\; + """ + } + else { + """ + touch ${prefix}.md5 + """ + } +} diff --git a/modules/nf-core/md5sum/meta.yml b/modules/nf-core/md5sum/meta.yml new file mode 100644 index 0000000..71066a8 --- /dev/null +++ b/modules/nf-core/md5sum/meta.yml @@ -0,0 +1,68 @@ +name: "md5sum" +description: Create MD5 (128-bit) checksums +keywords: + - checksum + - MD5 + - 128 bit +tools: + - "md5sum": + description: Create MD5 (128-bit) checksums for each file + homepage: "https://www.gnu.org" + documentation: "https://man7.org/linux/man-pages/man1/md5sum.1.html" + licence: + - "GPL-3.0-or-later" + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - files: + type: file + description: Any number of files. One md5sum file will be generated for + each. + pattern: "*.*" + ontologies: [] + - as_separate_files: + type: boolean + description: | + If true, each file will have its own md5sum file. If false, all files will be + checksummed into a single md5sum file. +output: + checksum: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.md5": + type: file + description: File containing checksum + pattern: "*.md5" + ontologies: [] + versions_md5sum: + - - ${task.process}: + type: string + description: The name of the process + - md5sum: + type: string + description: The name of the tool + - md5sum --version | sed '1!d; s/.* //': + type: eval + description: The expression to obtain the version of the tool +topics: + versions: + - - ${task.process}: + type: string + description: The name of the process + - md5sum: + type: string + description: The name of the tool + - md5sum --version | sed '1!d; s/.* //': + type: eval + description: The expression to obtain the version of the tool +authors: + - "@matthdsm" +maintainers: + - "@matthdsm" diff --git a/modules/nf-core/md5sum/tests/main.nf.test b/modules/nf-core/md5sum/tests/main.nf.test new file mode 100644 index 0000000..a6f7cf8 --- /dev/null +++ b/modules/nf-core/md5sum/tests/main.nf.test @@ -0,0 +1,180 @@ +nextflow_process { + + name "Test Process MD5SUM" + script "../main.nf" + process "MD5SUM" + + tag "modules" + tag "modules_nfcore" + tag "md5sum" + + test("md5sum on hello.txt") { + + when { + process { + """ + input[0] = [ + [ id: 'hello' ], + [ file(params.modules_testdata_base_path + 'generic/txt/hello.txt', checkIfExists: true) ] + ] + input[1] = true + """ + } + } + + then { + assertAll { + { assert process.success } + { assert snapshot(process.out).match() } + } + } + } + + test("md5sum on hello.txt (BSD-style)") { + + config './nextflow.config' + + when { + process { + """ + input[0] = [ + [ id: 'hello' ], + [ file(params.modules_testdata_base_path + 'generic/txt/hello.txt', checkIfExists: true) ] + ] + input[1] = true + """ + } + } + + then { + assertAll { + { assert process.success } + { assert snapshot(process.out).match() } + } + } + } + + test("md5sum on hello.txt - stub") { + options "-stub" + when { + process { + """ + input[0] = [ + [ id: 'hello' ], + [ file(params.modules_testdata_base_path + 'generic/txt/hello.txt', checkIfExists: true) ] + ] + input[1] = true + """ + } + } + + then { + assertAll { + { assert process.success } + { assert snapshot(process.out).match() } + } + } + } + + test("md5sum on paired fastq, combined") { + + when { + process { + """ + input[0] = [ + [ id: 'test' ], + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ] + input[1] = false + """ + } + } + + then { + assertAll { + { assert process.success } + { assert snapshot(process.out).match() } + } + } + } + + test("md5sum on paired fastq, combined - stub") { + options "-stub" + when { + process { + """ + input[0] = [ + [ id: 'test' ], + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ] + input[1] = false + """ + } + } + + then { + assertAll { + { assert process.success } + { assert snapshot(process.out).match() } + } + } + } + + + test("md5sum on paired fastq, separate") { + + when { + process { + """ + input[0] = [ + [ id: 'test' ], + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ] + input[1] = true + """ + } + } + + then { + assertAll { + { assert process.success } + { assert snapshot(process.out).match() } + } + } + } + + test("md5sum on paired fastq, separate - stub") { + options "-stub" + when { + process { + """ + input[0] = [ + [ id: 'test' ], + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ] + input[1] = true + """ + } + } + + then { + assertAll { + { assert process.success } + { assert snapshot(process.out).match() } + } + } + } + +} diff --git a/modules/nf-core/md5sum/tests/main.nf.test.snap b/modules/nf-core/md5sum/tests/main.nf.test.snap new file mode 100644 index 0000000..bf78c29 --- /dev/null +++ b/modules/nf-core/md5sum/tests/main.nf.test.snap @@ -0,0 +1,301 @@ +{ + "md5sum on paired fastq, separate - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "test_1.fastq.gz.md5:md5,d41d8cd98f00b204e9800998ecf8427e", + "test_2.fastq.gz.md5:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "1": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ], + "checksum": [ + [ + { + "id": "test" + }, + [ + "test_1.fastq.gz.md5:md5,d41d8cd98f00b204e9800998ecf8427e", + "test_2.fastq.gz.md5:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "versions_md5sum": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ] + } + ], + "timestamp": "2026-02-18T14:31:17.339668", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "md5sum on paired fastq, separate": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "test_1.fastq.gz.md5:md5,63a3f187d06ae5cffe77fcd39bbdd63a", + "test_2.fastq.gz.md5:md5,055dc46636836dbd1d9ede2e6ce8cd4e" + ] + ] + ], + "1": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ], + "checksum": [ + [ + { + "id": "test" + }, + [ + "test_1.fastq.gz.md5:md5,63a3f187d06ae5cffe77fcd39bbdd63a", + "test_2.fastq.gz.md5:md5,055dc46636836dbd1d9ede2e6ce8cd4e" + ] + ] + ], + "versions_md5sum": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ] + } + ], + "timestamp": "2026-02-18T14:31:11.522274", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "md5sum on hello.txt - stub": { + "content": [ + { + "0": [ + [ + { + "id": "hello" + }, + "hello.txt.md5:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ], + "checksum": [ + [ + { + "id": "hello" + }, + "hello.txt.md5:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_md5sum": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ] + } + ], + "timestamp": "2026-02-18T14:30:52.301881", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "md5sum on hello.txt": { + "content": [ + { + "0": [ + [ + { + "id": "hello" + }, + "hello.txt.md5:md5,5c18e1db5460fb32fed66966483165fd" + ] + ], + "1": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ], + "checksum": [ + [ + { + "id": "hello" + }, + "hello.txt.md5:md5,5c18e1db5460fb32fed66966483165fd" + ] + ], + "versions_md5sum": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ] + } + ], + "timestamp": "2026-02-18T14:30:41.089186", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "md5sum on paired fastq, combined": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.md5:md5,dfb98e45cbb77a9a63ae7029aee38bd1" + ] + ], + "1": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ], + "checksum": [ + [ + { + "id": "test" + }, + "test.md5:md5,dfb98e45cbb77a9a63ae7029aee38bd1" + ] + ], + "versions_md5sum": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ] + } + ], + "timestamp": "2026-02-18T14:30:58.611754", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "md5sum on paired fastq, combined - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.md5:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ], + "checksum": [ + [ + { + "id": "test" + }, + "test.md5:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_md5sum": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ] + } + ], + "timestamp": "2026-02-18T14:31:06.064053", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "md5sum on hello.txt (BSD-style)": { + "content": [ + { + "0": [ + [ + { + "id": "hello" + }, + "hello.txt.md5:md5,152a03f5dc7aa8db6612f63154ecbca2" + ] + ], + "1": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ], + "checksum": [ + [ + { + "id": "hello" + }, + "hello.txt.md5:md5,152a03f5dc7aa8db6612f63154ecbca2" + ] + ], + "versions_md5sum": [ + [ + "MD5SUM", + "md5sum", + "9.5" + ] + ] + } + ], + "timestamp": "2026-02-18T14:30:46.389675", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + } +} \ No newline at end of file diff --git a/modules/nf-core/md5sum/tests/nextflow.config b/modules/nf-core/md5sum/tests/nextflow.config new file mode 100644 index 0000000..4acada5 --- /dev/null +++ b/modules/nf-core/md5sum/tests/nextflow.config @@ -0,0 +1,2 @@ + +process.ext.args = '--tag' diff --git a/modules/nf-core/shasum/environment.yml b/modules/nf-core/shasum/environment.yml new file mode 100644 index 0000000..9b926b1 --- /dev/null +++ b/modules/nf-core/shasum/environment.yml @@ -0,0 +1,12 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - conda-forge::coreutils=9.5 + - conda-forge::grep=3.11 + - conda-forge::gzip=1.13 + - conda-forge::lbzip2=2.5 + - conda-forge::sed=4.8 + - conda-forge::tar=1.34 diff --git a/modules/nf-core/shasum/main.nf b/modules/nf-core/shasum/main.nf new file mode 100644 index 0000000..2fa689d --- /dev/null +++ b/modules/nf-core/shasum/main.nf @@ -0,0 +1,33 @@ +process SHASUM { + tag "${meta.id}" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container + ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/52/52ccce28d2ab928ab862e25aae26314d69c8e38bd41ca9431c67ef05221348aa/data' + : 'community.wave.seqera.io/library/coreutils_grep_gzip_lbzip2_pruned:838ba80435a629f8'}" + + input: + tuple val(meta), path(file) + + output: + tuple val(meta), path("*.sha256"), emit: checksum + tuple val("${task.process}"), val('sha256sum'), eval("sha256sum --version 2>&1 | head -n 1 | sed 's/.* //'"), emit: versions_sha256sum, topic: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + """ + sha256sum \\ + ${args} \\ + ${file} \\ + > ${file}.sha256 + """ + + stub: + """ + touch ${file}.sha256 + """ +} diff --git a/modules/nf-core/shasum/meta.yml b/modules/nf-core/shasum/meta.yml new file mode 100644 index 0000000..327a4f0 --- /dev/null +++ b/modules/nf-core/shasum/meta.yml @@ -0,0 +1,62 @@ +name: "shasum" +description: Print SHA256 (256-bit) checksums. +keywords: + - checksum + - sha256 + - 256 bit +tools: + - "md5sum": + description: Create an SHA256 (256-bit) checksum. + homepage: "https://www.gnu.org" + documentation: "https://linux.die.net/man/1/shasum" + licence: + - "GPLv3+" + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - file: + type: file + description: Any file + pattern: "*.*" + ontologies: [] +output: + checksum: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.sha256": + type: file + description: File containing checksum + pattern: "*.sha256" + ontologies: [] + versions_sha256sum: + - - ${task.process}: + type: string + description: Process name + - sha256sum: + type: string + description: Tool name + - "sha256sum --version 2>&1 | head -n 1 | sed 's/.* //'": + type: eval + description: Software version +topics: + versions: + - - ${task.process}: + type: string + description: Process name + - sha256sum: + type: string + description: Tool name + - "sha256sum --version 2>&1 | head -n 1 | sed 's/.* //'": + type: eval + description: Software version +authors: + - "@matthdsm" +maintainers: + - "@matthdsm" diff --git a/modules/nf-core/shasum/tests/main.nf.test b/modules/nf-core/shasum/tests/main.nf.test new file mode 100644 index 0000000..02d2ac0 --- /dev/null +++ b/modules/nf-core/shasum/tests/main.nf.test @@ -0,0 +1,58 @@ + +nextflow_process { + + name "Test Process SHASUM" + script "../main.nf" + process "SHASUM" + + tag "modules" + tag "modules_nfcore" + tag "shasum" + + test("test-shasum") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true) + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(sanitizeOutput(process.out)).match() } + ) + } + } + + test("test-shasum - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true) + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(sanitizeOutput(process.out)).match() } + ) + } + } + +} diff --git a/modules/nf-core/shasum/tests/main.nf.test.snap b/modules/nf-core/shasum/tests/main.nf.test.snap new file mode 100644 index 0000000..a86583b --- /dev/null +++ b/modules/nf-core/shasum/tests/main.nf.test.snap @@ -0,0 +1,56 @@ +{ + "test-shasum": { + "content": [ + { + "checksum": [ + [ + { + "id": "test", + "single_end": false + }, + "test.paired_end.bam.sha256:md5,138a19e100f09fc975ea1b717da9b6dd" + ] + ], + "versions_sha256sum": [ + [ + "SHASUM", + "sha256sum", + "9.5" + ] + ] + } + ], + "timestamp": "2026-05-03T20:43:40.688253838", + "meta": { + "nf-test": "0.9.5", + "nextflow": "24.10.4" + } + }, + "test-shasum - stub": { + "content": [ + { + "checksum": [ + [ + { + "id": "test", + "single_end": false + }, + "test.paired_end.bam.sha256:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_sha256sum": [ + [ + "SHASUM", + "sha256sum", + "9.5" + ] + ] + } + ], + "timestamp": "2026-05-03T20:43:46.125782074", + "meta": { + "nf-test": "0.9.5", + "nextflow": "24.10.4" + } + } +} \ No newline at end of file diff --git a/subworkflows/local/utils_nfcore_datasync_pipeline/main.nf b/subworkflows/local/utils_nfcore_datasync_pipeline/main.nf index e9e92f3..db1f6d4 100644 --- a/subworkflows/local/utils_nfcore_datasync_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_datasync_pipeline/main.nf @@ -110,21 +110,15 @@ workflow PIPELINE_INITIALISATION { channel .fromList(samplesheetToList(input, "${projectDir}/assets/schema_input.json")) .map { - meta, fastq_1, fastq_2 -> - if (!fastq_2) { - return [ meta.id, meta + [ single_end:true ], [ fastq_1 ] ] + meta, input_path -> + def target = file(input_path) + if (target.isDirectory()) { + def all_files = files("${input_path}/**", type: 'file') + [meta, all_files] } else { - return [ meta.id, meta + [ single_end:false ], [ fastq_1, fastq_2 ] ] + [meta, [target]] } } - .groupTuple() - .map { samplesheet -> - validateInputSamplesheet(samplesheet) - } - .map { - meta, fastqs -> - return [ meta, fastqs.flatten() ] - } .set { ch_samplesheet } emit: @@ -189,20 +183,6 @@ def validateInputParameters() { genomeExistsError() } -// -// Validate channels from input samplesheet -// -def validateInputSamplesheet(input) { - def (metas, fastqs) = input[1..2] - - // Check that multiple runs of the same sample are of the same datatype i.e. single-end / paired-end - def endedness_ok = metas.collect{ meta -> meta.single_end }.unique().size == 1 - if (!endedness_ok) { - error("Please check input samplesheet -> Multiple runs of a sample must be of the same datatype i.e. single-end or paired-end: ${metas[0].id}") - } - - return [ metas[0], fastqs ] -} // // Get attribute from genome config file e.g. fasta // diff --git a/tests/default.nf.test.snap b/tests/default.nf.test.snap index 466aab7..f48ad94 100644 --- a/tests/default.nf.test.snap +++ b/tests/default.nf.test.snap @@ -2,11 +2,20 @@ "-profile test": { "content": [ { + "MD5SUM": { + "md5sum": 9.5 + }, + "SHASUM": { + "sha256sum": 9.5 + }, "Workflow": { "nf-core/datasync": "v1.0dev" } }, [ + "md5sum", + "md5sum/human_grch38_sequence.md5", + "md5sum/test_fastq.md5", "multiqc", "multiqc/multiqc_data", "multiqc/multiqc_data/llms-full.txt", @@ -18,16 +27,33 @@ "multiqc/multiqc_data/multiqc_sources.txt", "multiqc/multiqc_report.html", "pipeline_info", - "pipeline_info/nf_core_datasync_software_mqc_versions.yml" + "pipeline_info/nf_core_datasync_software_mqc_versions.yml", + "shasum", + "shasum/GenomeSize.xml.old.sha256", + "shasum/GenomeSize.xml.sha256", + "shasum/genome.dict.old.sha256", + "shasum/genome.dict.sha256", + "shasum/genome.fa.fai.sha256", + "shasum/genome.fa.sha256", + "shasum/test2_1.fastq.gz.sha256" ], [ - "multiqc_citations.txt:md5,4c806e63a283ec1b7e78cdae3a923d4f" + "human_grch38_sequence.md5:md5,0547c2f89caeb0e8e7d67da583e09d90", + "test_fastq.md5:md5,145df327e566f16b545fbca236f9bb62", + "multiqc_citations.txt:md5,4c806e63a283ec1b7e78cdae3a923d4f", + "GenomeSize.xml.old.sha256:md5,068e91cdcc084710caf61a0859ac2be9", + "GenomeSize.xml.sha256:md5,e7a175f04cab11ce0a245133d70de9fb", + "genome.dict.old.sha256:md5,77492c77f911887b269de347e157d4ca", + "genome.dict.sha256:md5,0021eaba625d4dc9fcec55eb7384426e", + "genome.fa.fai.sha256:md5,99f227079c0fd354f272c0046482ff1a", + "genome.fa.sha256:md5,9bdb272c4b51342a0f139fbc14d0a57e", + "test2_1.fastq.gz.sha256:md5,3407e7acd19b8bb0f0b731a046e7943f" ] ], + "timestamp": "2026-06-16T18:04:56.374326627", "meta": { - "nf-test": "0.9.2", - "nextflow": "26.04.3" - }, - "timestamp": "2026-06-12T19:01:37.766797147" + "nf-test": "0.9.5", + "nextflow": "26.04.1" + } } } \ No newline at end of file diff --git a/workflows/datasync.nf b/workflows/datasync.nf index ee20e12..6e6c910 100644 --- a/workflows/datasync.nf +++ b/workflows/datasync.nf @@ -3,7 +3,9 @@ IMPORT MODULES / SUBWORKFLOWS / FUNCTIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +include { MD5SUM } from '../modules/nf-core/md5sum/main' include { MULTIQC } from '../modules/nf-core/multiqc/main' +include { SHASUM } from '../modules/nf-core/shasum/main' include { paramsSummaryMap } from 'plugin/nf-schema' include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline' include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline' @@ -29,6 +31,15 @@ workflow DATASYNC { ch_versions = channel.empty() ch_multiqc_files = channel.empty() + MD5SUM( + ch_samplesheet, + false + ) + + SHASUM( + ch_samplesheet.transpose() + ) + // // Collate and save software versions //