Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions modules/nf-core/samplesheetparser/diff/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bioconda::samplesheet-parser=1.2.0
34 changes: 34 additions & 0 deletions modules/nf-core/samplesheetparser/diff/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
process SAMPLESHEETPARSER_DIFF {
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/samplesheet-parser:1.2.0--pyhdfd78af_0' :
'quay.io/biocontainers/samplesheet-parser:1.2.0--pyhdfd78af_0' }"

input:
tuple val(meta), path(old_sheet, stageAs: "old/*"), path(new_sheet, stageAs: "new/*")

output:
tuple val(meta), path("*.diff.json"), emit: json
tuple val("${task.process}"), val('samplesheet-parser'), eval("samplesheet --version | sed 's/samplesheet-parser //'"), topic: versions, emit: versions_samplesheetparser

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
samplesheet diff \\
${args} \\
${old_sheet} ${new_sheet} > ${prefix}.diff.json || true
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.diff.json
"""
}
84 changes: 84 additions & 0 deletions modules/nf-core/samplesheetparser/diff/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: samplesheetparser_diff
description: |
Compare two Illumina SampleSheet.csv files (any combination of V1 and V2)
and emit a structured JSON diff covering header changes, added/removed
samples, and per-sample field changes. Exits 0 if identical, 1 if
differences are detected — useful as a CI pre-run guard.
keywords:
- illumina
- samplesheet
- diff
- comparison
- bclconvert
- bcl2fastq
- genomics
tools:
- samplesheet-parser:
description: |
Format-agnostic parser for Illumina SampleSheet.csv files.
Supports IEM V1 (bcl2fastq) and BCLConvert V2 with auto-detection,
bidirectional conversion, index validation, and Hamming distance checking.
homepage: https://github.com/chaitanyakasaraneni/samplesheet-parser
documentation: https://illumina-samplesheet.readthedocs.io
tool_dev_url: https://github.com/chaitanyakasaraneni/samplesheet-parser
doi: "10.5281/zenodo.18989694"
licence:
- "Apache-2.0"
identifier: biotools:samplesheet-parser
input:
- - meta:
type: map
description: |
Groovy Map containing sample information.
Use [ id:'run_id' ] to identify the sheet pair.
- old_sheet:
type: file
description: Original (reference) SampleSheet.csv (V1 or V2)
pattern: "*.{csv,CSV}"
ontologies:
- edam: "http://edamontology.org/format_3752"
- new_sheet:
type: file
description: Updated SampleSheet.csv to compare against the original (V1 or V2)
pattern: "*.{csv,CSV}"
ontologies:
- edam: "http://edamontology.org/format_3752"
output:
json:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.diff.json":
type: file
description: |
Structured JSON diff report with has_changes, source_version,
target_version, header_changes, samples_added, samples_removed,
and sample_changes fields.
pattern: "*.diff.json"
ontologies:
- edam: http://edamontology.org/format_3464
versions_samplesheetparser:
- - ${task.process}:
type: string
description: The name of the process
- samplesheet-parser:
type: string
description: The name of the tool
- samplesheet --version | sed 's/samplesheet-parser //':
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The name of the process
- samplesheet-parser:
type: string
description: The name of the tool
- samplesheet --version | sed 's/samplesheet-parser //':
type: eval
description: The expression to obtain the version of the tool
authors:
- "@chaitanyakasaraneni"
maintainers:
- "@chaitanyakasaraneni"
79 changes: 79 additions & 0 deletions modules/nf-core/samplesheetparser/diff/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
nextflow_process {

name "Test Process SAMPLESHEETPARSER_DIFF"
script "../main.nf"
process "SAMPLESHEETPARSER_DIFF"

tag "samplesheetparser"
tag "samplesheetparser/diff"
tag "modules"
tag "modules_nfcore"

test("V1 vs V1 - identical sheets") {

when {
process {
"""
input[0] = [
[ id: 'test_identical' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bcl/flowcell_samplesheet.v1.csv', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bcl/flowcell_samplesheet.v1.csv', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(sanitizeOutput(process.out)).match() }
)
}
}

test("V1 vs V2 - cross-format diff") {

when {
process {
"""
input[0] = [
[ id: 'test_cross_format' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bcl/flowcell_samplesheet.v1.csv', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bcl/flowcell_samplesheet.v2.csv', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(sanitizeOutput(process.out)).match() }
)
}
}

test("V1 vs V1 - identical sheets - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id: 'test_stub' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bcl/flowcell_samplesheet.v1.csv', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bcl/flowcell_samplesheet.v1.csv', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(sanitizeOutput(process.out)).match() }
)
}
}
}
80 changes: 80 additions & 0 deletions modules/nf-core/samplesheetparser/diff/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"V1 vs V2 - cross-format diff": {
"content": [
{
"json": [
[
{
"id": "test_cross_format"
},
"test_cross_format.diff.json:md5,28c77c09c5cb8262e548d17ae9cdbf8f"
]
],
"versions_samplesheetparser": [
[
"SAMPLESHEETPARSER_DIFF",
"samplesheet-parser",
"1.2.0"
]
]
}
],
"timestamp": "2026-05-19T23:04:40.305466",
"meta": {
"nf-test": "0.9.5",
"nextflow": "25.10.4"
}
},
"V1 vs V1 - identical sheets - stub": {
"content": [
{
"json": [
[
{
"id": "test_stub"
},
"test_stub.diff.json:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions_samplesheetparser": [
[
"SAMPLESHEETPARSER_DIFF",
"samplesheet-parser",
"1.2.0"
]
]
}
],
"timestamp": "2026-05-19T23:04:48.524679",
"meta": {
"nf-test": "0.9.5",
"nextflow": "25.10.4"
}
},
"V1 vs V1 - identical sheets": {
"content": [
{
"json": [
[
{
"id": "test_identical"
},
"test_identical.diff.json:md5,1f9b7684e8099e278e0abdf0b533d1e9"
]
],
"versions_samplesheetparser": [
[
"SAMPLESHEETPARSER_DIFF",
"samplesheet-parser",
"1.2.0"
]
]
}
],
"timestamp": "2026-05-19T23:04:30.568751",
"meta": {
"nf-test": "0.9.5",
"nextflow": "25.10.4"
}
}
}
Loading