samplesheet-parser 2.0.0__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/.github/workflows/ci.yml +2 -3
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/.gitignore +3 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/.pre-commit-config.yaml +6 -2
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/.zenodo.json +1 -1
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/CHANGELOG.md +69 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/CITATION.cff +2 -2
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/PKG-INFO +18 -11
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/README.md +17 -10
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/api.md +41 -3
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/guide/validation.md +8 -4
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/pyproject.toml +1 -1
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/__init__.py +9 -3
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/cli.py +7 -5
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/converter.py +10 -10
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/diff.py +12 -12
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/enums.py +5 -5
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/factory.py +34 -22
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/filter.py +3 -3
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/index_utils.py +3 -3
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/instruments.py +5 -5
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/merger.py +25 -25
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/parsers/v1.py +11 -11
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/parsers/v2.py +71 -35
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/protocol.py +1 -1
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/splitter.py +3 -3
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/validators.py +107 -47
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/writer.py +28 -10
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/conftest.py +2 -2
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_cli.py +6 -6
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_converter.py +4 -4
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_diff.py +101 -41
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_factory.py +72 -4
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_filter.py +11 -11
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_index_utils.py +7 -3
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_instruments.py +1 -1
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_merger.py +111 -84
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_parsers/test_v1.py +10 -10
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_parsers/test_v2.py +32 -5
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_splitter.py +11 -11
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_validators/test_hamming.py +183 -15
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_validators/test_validators.py +39 -11
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_writer.py +62 -9
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/.github/workflows/copilot-instructions.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/.readthedocs.yaml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/CONTRIBUTING.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/LICENSE +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/Makefile +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/changelog.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/ci.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/cli.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/contributing.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/examples.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/guide/conversion.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/guide/diffing.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/guide/filtering.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/guide/index_utils.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/guide/merging.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/guide/parsing.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/guide/quickstart.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/guide/splitting.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/guide/writing.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/index.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/installation.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/docs/requirements.txt +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/demo_converter.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/demo_diff.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/demo_filter.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/demo_index_utils.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/demo_merger.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/demo_splitter.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/demo_writer.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/parse_examples.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/ProjectAlpha_SampleSheet.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/ProjectBeta_SampleSheet.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/ProjectDelta_SampleSheet_collision.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/ProjectGamma_SampleSheet.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/README.md +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/combined_clean.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/combined_collision_forced.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/combined_mixed_formats.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/v1_dual_index.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/v1_multi_lane.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/v1_single_index.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/v1_with_lab_qc_settings.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/v1_with_manifests.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/v2_nextseq_single_index.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/v2_novaseq_x_dual_index.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/v2_with_cloud_settings.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/v2_with_index_umi.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/v2_with_pipeline_settings.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/examples/sample_sheets/v2_with_read_umi.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/images/samplesheet_parser_arch_v03.png +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/images/samplesheet_parser_overview.png +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/mkdocs.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/convert/environment.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/convert/main.nf +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/convert/meta.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/convert/tests/main.nf.test +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/diff/environment.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/diff/main.nf +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/diff/meta.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/diff/tests/main.nf.test +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/diff/tests/main.nf.test.snap +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/filter/environment.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/filter/main.nf +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/filter/meta.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/filter/tests/main.nf.test +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/filter/tests/nextflow.config +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/info/environment.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/info/main.nf +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/info/meta.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/info/tests/main.nf.test +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/info/tests/main.nf.test.snap +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/merge/environment.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/merge/main.nf +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/merge/meta.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/merge/tests/main.nf.test +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/split/environment.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/split/main.nf +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/split/meta.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/split/tests/main.nf.test +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/validate/environment.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/validate/main.nf +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/validate/meta.yml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/validate/tests/main.nf.test +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/modules/nf-core/samplesheetparser/validate/tests/main.nf.test.snap +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/recipes/meta.yaml +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/parsers/__init__.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/samplesheet_parser/py.typed +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/scripts/demo_converter.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/scripts/demo_diff.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/scripts/demo_writer.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/__init__.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/fixtures/SampleSheet_v1_dual_index.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/fixtures/SampleSheet_v2_dual_index.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/fixtures/SampleSheet_v2_modified.csv +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_parsers/__init__.py +0 -0
- {samplesheet_parser-2.0.0 → samplesheet_parser-2.2.0}/tests/test_validators/__init__.py +0 -0
|
@@ -30,11 +30,10 @@ jobs:
|
|
|
30
30
|
run: ruff check samplesheet_parser/
|
|
31
31
|
|
|
32
32
|
- name: Type check with mypy
|
|
33
|
-
run: mypy samplesheet_parser/ --ignore-missing-imports
|
|
34
|
-
continue-on-error: true
|
|
33
|
+
run: mypy samplesheet_parser/ --strict --ignore-missing-imports
|
|
35
34
|
|
|
36
35
|
- name: Run tests
|
|
37
|
-
run: pytest tests/ -v --cov=samplesheet_parser --cov-report=xml
|
|
36
|
+
run: pytest tests/ -v -W error::DeprecationWarning --cov=samplesheet_parser --cov-report=xml
|
|
38
37
|
|
|
39
38
|
- name: Upload coverage to Codecov
|
|
40
39
|
uses: codecov/codecov-action@v4
|
|
@@ -26,5 +26,9 @@ repos:
|
|
|
26
26
|
rev: v1.13.0
|
|
27
27
|
hooks:
|
|
28
28
|
- id: mypy
|
|
29
|
-
additional_dependencies: [
|
|
30
|
-
|
|
29
|
+
additional_dependencies: [typer]
|
|
30
|
+
# Type-check the package only, matching CI. Tests are intentionally
|
|
31
|
+
# exempt (see the tests.* override in pyproject.toml); passing
|
|
32
|
+
# individual test file paths here would bypass that override.
|
|
33
|
+
pass_filenames: false
|
|
34
|
+
args: [--strict, --ignore-missing-imports, samplesheet_parser/]
|
|
@@ -10,6 +10,75 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
10
10
|
|
|
11
11
|
_No unreleased changes._
|
|
12
12
|
|
|
13
|
+
## [2.2.0] - 2026-06-10
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **Index-free libraries are no longer dropped silently by the writer.** When
|
|
18
|
+
loading a parsed sheet with `SampleSheetWriter.from_sheet()`, a sample with a
|
|
19
|
+
valid `Sample_ID` but no index was skipped without notice (the writer
|
|
20
|
+
requires an index per sample). Such samples are still dropped, but now a
|
|
21
|
+
warning is logged naming the sample, so the loss is visible. This aligns the
|
|
22
|
+
writer with the validator, which treats index-free libraries as legitimate.
|
|
23
|
+
- **Index-distance check now accepts V2-style index keys.** The combined
|
|
24
|
+
index-distance check read only the lowercase `index`/`index2` keys, so
|
|
25
|
+
hand-built sample dicts (or the output of `normalize_index_lengths`) keyed
|
|
26
|
+
with `Index`/`Index2` were silently skipped. It now accepts both casings,
|
|
27
|
+
consistent with the duplicate-index and character checks.
|
|
28
|
+
|
|
29
|
+
## [2.1.0] - 2026-06-09
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- **Format auto-detection now scans the whole file.** The V2 fallback that
|
|
34
|
+
looks for `[BCLConvert_Settings]` / `[BCLConvert_Data]` previously stopped
|
|
35
|
+
reading at the first section after `[Header]`, so a V2 sheet that lacked
|
|
36
|
+
`FileFormatVersion` and placed those sections after `[Reads]` was misdetected
|
|
37
|
+
as V1. Detection now reads the full file (sheets are small) before falling
|
|
38
|
+
back, and matches the BCLConvert section names case-insensitively so a sheet
|
|
39
|
+
using e.g. `[bclconvert_data]` is detected as V2.
|
|
40
|
+
- **Index-free libraries no longer raise `DUPLICATE_INDEX`.** A full-lane
|
|
41
|
+
library where every sample has an empty index was incorrectly flagged as a
|
|
42
|
+
duplicate. Samples with no index are now skipped in the duplicate-index
|
|
43
|
+
check.
|
|
44
|
+
- **Duplicate-index detection is now case-insensitive.** Indexes are
|
|
45
|
+
upper-cased before comparison, so the same barcode written with different
|
|
46
|
+
casing is correctly flagged as a duplicate, consistent with the index
|
|
47
|
+
distance and character checks.
|
|
48
|
+
- **`mypy --strict` passes again.** The `info` CLI command accessed
|
|
49
|
+
V2-only attributes on the parser protocol without narrowing; it now narrows
|
|
50
|
+
with `isinstance`.
|
|
51
|
+
- **CLI no longer emits Typer deprecation warnings.** Removed the deprecated
|
|
52
|
+
`is_flag=True` from the `--version` option, clearing the warnings that were
|
|
53
|
+
raised on every CLI invocation.
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
|
|
57
|
+
- **Index distance checking is now a sum of per-index distances.** For dual
|
|
58
|
+
index sheets the validator adds the I7 mismatch count to the I5 mismatch
|
|
59
|
+
count instead of comparing the two indexes concatenated into one string.
|
|
60
|
+
The result is the same for uniform-length indexes but correct when samples
|
|
61
|
+
use different index lengths, and it keeps I7 and I5 positions aligned. The
|
|
62
|
+
`INDEX_DISTANCE_TOO_LOW` message now refers to a "combined distance" and the
|
|
63
|
+
`index_a` / `index_b` context values use an `I7+I5` separator.
|
|
64
|
+
- **`N` is treated as a wildcard in collision detection.** Index distance
|
|
65
|
+
checks now treat an `N` cycle as matching any base, so two indexes that
|
|
66
|
+
differ only at an `N` are reported as colliding. The pure `hamming_distance`
|
|
67
|
+
helper is unchanged.
|
|
68
|
+
|
|
69
|
+
### Added
|
|
70
|
+
|
|
71
|
+
- **`index_collision_distance(a, b)`** public helper: the wildcard-aware,
|
|
72
|
+
per-index distance the validator uses for collision detection.
|
|
73
|
+
|
|
74
|
+
### Documentation
|
|
75
|
+
|
|
76
|
+
- Formalised the `OverrideCycles` grammar in `SampleSheetV2._parse_override_cycles`,
|
|
77
|
+
documented how a `U` token is attributed to an index versus a read, clarified
|
|
78
|
+
that `umi_length` is the largest single UMI segment (not the sum), and made
|
|
79
|
+
malformed segments log a warning and decode on a best-effort basis instead of
|
|
80
|
+
being silently dropped.
|
|
81
|
+
|
|
13
82
|
---
|
|
14
83
|
|
|
15
84
|
## [2.0.0] - 2026-06-06
|
|
@@ -8,8 +8,8 @@ abstract: >
|
|
|
8
8
|
Provides format auto-detection, bidirectional V1/V2 conversion,
|
|
9
9
|
structural and index validation, sheet diffing, and cross-project
|
|
10
10
|
merging with Hamming-distance collision detection.
|
|
11
|
-
version: 2.
|
|
12
|
-
date-released: 2026-06-
|
|
11
|
+
version: 2.2.0
|
|
12
|
+
date-released: 2026-06-10
|
|
13
13
|
license: Apache-2.0
|
|
14
14
|
url: "https://github.com/chaitanyakasaraneni/samplesheet-parser"
|
|
15
15
|
repository-code: "https://github.com/chaitanyakasaraneni/samplesheet-parser"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: samplesheet-parser
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Format-agnostic parser for Illumina SampleSheet.csv files — supports IEM V1 and BCLConvert V2
|
|
5
5
|
Project-URL: Homepage, https://github.com/chaitanyakasaraneni/samplesheet-parser
|
|
6
6
|
Project-URL: Documentation, https://illumina-samplesheet.readthedocs.io
|
|
@@ -369,20 +369,27 @@ The detector reads only as much of the file as needed — stopping after `[Heade
|
|
|
369
369
|
| `NO_ADAPTERS` | warning | No adapter sequences configured |
|
|
370
370
|
| `ADAPTER_MISMATCH` | warning | Adapter is non-standard |
|
|
371
371
|
|
|
372
|
-
###
|
|
372
|
+
### Index distance checking
|
|
373
373
|
|
|
374
374
|
Indexes that are too similar cause read bleed-through between samples during
|
|
375
|
-
demultiplexing
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
For dual-index sheets
|
|
381
|
-
|
|
382
|
-
|
|
375
|
+
demultiplexing, a common cause of low-quality runs that a simple duplicate
|
|
376
|
+
check does not catch. For every pair of samples within a lane the validator
|
|
377
|
+
computes a combined distance and warns when it falls below the recommended
|
|
378
|
+
minimum of 3.
|
|
379
|
+
|
|
380
|
+
For dual-index sheets the combined distance is the sum of the per-index
|
|
381
|
+
mismatch counts: the I7 distance plus the I5 distance. This equals the minimum
|
|
382
|
+
number of sequencing errors needed to read one sample's barcodes as another's
|
|
383
|
+
across both index reads, and summing per index (rather than concatenating the
|
|
384
|
+
two indexes into one string) keeps the I7 and I5 positions aligned even when
|
|
385
|
+
samples use different index lengths. So a pair that is close on I7 but
|
|
386
|
+
well-separated on I5, as most dual-index kits are designed, is not flagged.
|
|
387
|
+
|
|
388
|
+
Each per-index distance treats an `N` cycle as a wildcard that matches any
|
|
389
|
+
base, so two indexes that differ only at an `N` are reported as colliding.
|
|
383
390
|
|
|
384
391
|
```python
|
|
385
|
-
# Custom threshold
|
|
392
|
+
# Custom threshold: stricter than the default of 3
|
|
386
393
|
from samplesheet_parser.validators import SampleSheetValidator, ValidationResult
|
|
387
394
|
|
|
388
395
|
samples = sheet.samples()
|
|
@@ -313,20 +313,27 @@ The detector reads only as much of the file as needed — stopping after `[Heade
|
|
|
313
313
|
| `NO_ADAPTERS` | warning | No adapter sequences configured |
|
|
314
314
|
| `ADAPTER_MISMATCH` | warning | Adapter is non-standard |
|
|
315
315
|
|
|
316
|
-
###
|
|
316
|
+
### Index distance checking
|
|
317
317
|
|
|
318
318
|
Indexes that are too similar cause read bleed-through between samples during
|
|
319
|
-
demultiplexing
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
For dual-index sheets
|
|
325
|
-
|
|
326
|
-
|
|
319
|
+
demultiplexing, a common cause of low-quality runs that a simple duplicate
|
|
320
|
+
check does not catch. For every pair of samples within a lane the validator
|
|
321
|
+
computes a combined distance and warns when it falls below the recommended
|
|
322
|
+
minimum of 3.
|
|
323
|
+
|
|
324
|
+
For dual-index sheets the combined distance is the sum of the per-index
|
|
325
|
+
mismatch counts: the I7 distance plus the I5 distance. This equals the minimum
|
|
326
|
+
number of sequencing errors needed to read one sample's barcodes as another's
|
|
327
|
+
across both index reads, and summing per index (rather than concatenating the
|
|
328
|
+
two indexes into one string) keeps the I7 and I5 positions aligned even when
|
|
329
|
+
samples use different index lengths. So a pair that is close on I7 but
|
|
330
|
+
well-separated on I5, as most dual-index kits are designed, is not flagged.
|
|
331
|
+
|
|
332
|
+
Each per-index distance treats an `N` cycle as a wildcard that matches any
|
|
333
|
+
base, so two indexes that differ only at an `N` are reported as colliding.
|
|
327
334
|
|
|
328
335
|
```python
|
|
329
|
-
# Custom threshold
|
|
336
|
+
# Custom threshold: stricter than the default of 3
|
|
330
337
|
from samplesheet_parser.validators import SampleSheetValidator, ValidationResult
|
|
331
338
|
|
|
332
339
|
samples = sheet.samples()
|
|
@@ -5,6 +5,7 @@ All public classes are importable directly from the top-level package:
|
|
|
5
5
|
```python
|
|
6
6
|
from samplesheet_parser import (
|
|
7
7
|
SampleSheetFactory,
|
|
8
|
+
SampleSheetParser,
|
|
8
9
|
SampleSheetV1,
|
|
9
10
|
SampleSheetV2,
|
|
10
11
|
SampleSheetConverter,
|
|
@@ -15,6 +16,7 @@ from samplesheet_parser import (
|
|
|
15
16
|
SampleSheetSplitter,
|
|
16
17
|
SampleSheetFilter,
|
|
17
18
|
normalize_index_lengths,
|
|
19
|
+
hamming_distance,
|
|
18
20
|
)
|
|
19
21
|
```
|
|
20
22
|
|
|
@@ -24,19 +26,37 @@ from samplesheet_parser import (
|
|
|
24
26
|
|
|
25
27
|
| Method / attribute | Returns | Description |
|
|
26
28
|
|---|---|---|
|
|
27
|
-
| `create_parser(path, *, clean, experiment_id, parse)` | `
|
|
29
|
+
| `create_parser(path, *, clean, experiment_id, parse)` | `SampleSheetParser` | Auto-detect format and return the appropriate parser |
|
|
28
30
|
| `get_umi_length()` | `int` | UMI length from the current parser |
|
|
31
|
+
| `register(detector, parser_class, version)` | `None` | Register a custom format detector; tried before built-in detection in LIFO order |
|
|
32
|
+
| `clear_registry()` | `None` | Remove all custom registrations (useful in tests) |
|
|
29
33
|
| `.version` | `SampleSheetVersion \| None` | Detected format version |
|
|
30
34
|
|
|
31
35
|
---
|
|
32
36
|
|
|
37
|
+
## SampleSheetParser Protocol
|
|
38
|
+
|
|
39
|
+
`SampleSheetParser` is a `runtime_checkable` structural protocol satisfied by both `SampleSheetV1` and `SampleSheetV2`. Use it as a type hint wherever either parser is accepted, or implement it in a third-party parser and register it with the factory.
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from samplesheet_parser import SampleSheetParser
|
|
43
|
+
|
|
44
|
+
isinstance(sheet, SampleSheetParser) # True for V1 and V2 instances
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
33
49
|
## SampleSheetV1 / SampleSheetV2 (shared interface)
|
|
34
50
|
|
|
51
|
+
Both parsers satisfy `SampleSheetParser` and expose:
|
|
52
|
+
|
|
35
53
|
| Method / attribute | Returns | Description |
|
|
36
54
|
|---|---|---|
|
|
37
55
|
| `parse(do_clean=True)` | `None` | Parse all sections |
|
|
38
|
-
| `
|
|
56
|
+
| `clean()` | `str` | Return cleaned content as a string — source file is **never** modified |
|
|
57
|
+
| `samples()` | `list[dict]` | One record per unique `(sample_id, lane)` pair |
|
|
39
58
|
| `index_type()` | `str` | `"dual"`, `"single"`, or `"none"` |
|
|
59
|
+
| `parse_custom_section(name, *, required=False)` | `dict[str, str]` | Parse any non-standard section as key/value pairs |
|
|
40
60
|
| `.adapters` | `list[str]` | Adapter sequences |
|
|
41
61
|
| `.experiment_name` | `str \| None` | Run/experiment name |
|
|
42
62
|
|
|
@@ -87,7 +107,7 @@ from samplesheet_parser.instruments import (
|
|
|
87
107
|
|
|
88
108
|
| Name | Kind | Description |
|
|
89
109
|
|---|---|---|
|
|
90
|
-
| `Workflow` | `
|
|
110
|
+
| `Workflow` | `str, Enum` | `Workflow.A` (i5 forward) / `Workflow.B` (i5 RC'd on chip) |
|
|
91
111
|
| `detect_workflow(name)` | `Workflow \| None` | Classify an instrument name; `None` for unknown or ambiguous (e.g. `NovaSeq 6000`) |
|
|
92
112
|
| `parse_workflow(value)` | `Workflow \| None` | Coerce a CLI string (`"a"` / `"b"`) to `Workflow` |
|
|
93
113
|
| `reverse_complement(seq)` | `str` | Reverse-complement a DNA sequence (preserves `N`, case-preserving) |
|
|
@@ -243,6 +263,24 @@ Normalizes index sequence lengths across a list of sample dicts. See [Index Util
|
|
|
243
263
|
|
|
244
264
|
---
|
|
245
265
|
|
|
266
|
+
## hamming_distance
|
|
267
|
+
|
|
268
|
+
```python
|
|
269
|
+
from samplesheet_parser import hamming_distance
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Computes the Hamming distance between two equal-length index sequences, counting `N` wildcards as matches:
|
|
273
|
+
|
|
274
|
+
```python
|
|
275
|
+
hamming_distance("ATTACTCG", "ATTACTCG") # 0
|
|
276
|
+
hamming_distance("ATTACTCG", "ATTACTCC") # 1
|
|
277
|
+
hamming_distance("ATTNCNCG", "ATTACTCG") # 0 — N matches anything
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Used internally by `SampleSheetValidator` when checking index collision thresholds. Accepts sequences of different lengths (returns `None`) but in practice all samples in a valid sheet have uniform index lengths after normalization.
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
246
284
|
## Enums
|
|
247
285
|
|
|
248
286
|
```python
|
|
@@ -32,20 +32,24 @@ for w in result.warnings:
|
|
|
32
32
|
| `NO_ADAPTERS` | warning | No adapter sequences configured |
|
|
33
33
|
| `ADAPTER_MISMATCH` | warning | Adapter is non-standard |
|
|
34
34
|
|
|
35
|
-
##
|
|
35
|
+
## Index distance checking
|
|
36
36
|
|
|
37
|
-
Indexes that are too similar cause read bleed-through between samples during demultiplexing
|
|
37
|
+
Indexes that are too similar cause read bleed-through between samples during demultiplexing, a common cause of low-quality runs that a simple duplicate check does not catch.
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
For every pair of samples within a lane, the validator computes a combined distance: the I7 (index) mismatch count plus the I5 (index2) mismatch count. This sum equals the minimum number of sequencing errors needed to read one sample's barcodes as another's across both index reads, which is the quantity that governs misassignment risk. Summing the per-index distances (rather than concatenating the two indexes into one string) keeps the I7 and I5 positions aligned even when samples use different index lengths. A pair is flagged when the combined distance is below the threshold.
|
|
40
|
+
|
|
41
|
+
Each per-index distance treats an `N` cycle as a wildcard that matches any base, matching how demultiplexers handle `N`. Two indexes that differ only where one carries an `N` are therefore reported as colliding. Sequences of different lengths are compared up to the length of the shorter sequence.
|
|
40
42
|
|
|
41
43
|
```python
|
|
42
44
|
# Default threshold: 3
|
|
43
45
|
result = SampleSheetValidator().validate(sheet)
|
|
44
46
|
|
|
45
|
-
# Custom threshold
|
|
47
|
+
# Custom threshold: stricter for longer indexes
|
|
46
48
|
result = SampleSheetValidator().validate(sheet, min_hamming_distance=4)
|
|
47
49
|
```
|
|
48
50
|
|
|
51
|
+
The standalone helpers are also available: `hamming_distance(a, b)` for the literal Hamming distance and `index_collision_distance(a, b)` for the wildcard-aware per-index distance the validator uses.
|
|
52
|
+
|
|
49
53
|
## Structured results
|
|
50
54
|
|
|
51
55
|
```python
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "samplesheet-parser"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.2.0"
|
|
8
8
|
description = "Format-agnostic parser for Illumina SampleSheet.csv files — supports IEM V1 and BCLConvert V2"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { file = "LICENSE" }
|
|
@@ -5,8 +5,8 @@ samplesheet-parser
|
|
|
5
5
|
Format-agnostic parser for Illumina SampleSheet.csv files.
|
|
6
6
|
|
|
7
7
|
Supports:
|
|
8
|
-
- Illumina Experiment Manager (IEM) V1 format
|
|
9
|
-
- BCLConvert V2 format
|
|
8
|
+
- Illumina Experiment Manager (IEM) V1 format - bcl2fastq era
|
|
9
|
+
- BCLConvert V2 format - NovaSeq X / modern era
|
|
10
10
|
|
|
11
11
|
Quickstart
|
|
12
12
|
----------
|
|
@@ -43,7 +43,12 @@ from samplesheet_parser.parsers.v1 import SampleSheetV1
|
|
|
43
43
|
from samplesheet_parser.parsers.v2 import SampleSheetV2
|
|
44
44
|
from samplesheet_parser.protocol import SampleSheetParser
|
|
45
45
|
from samplesheet_parser.splitter import SampleSheetSplitter, SplitResult
|
|
46
|
-
from samplesheet_parser.validators import
|
|
46
|
+
from samplesheet_parser.validators import (
|
|
47
|
+
SampleSheetValidator,
|
|
48
|
+
ValidationResult,
|
|
49
|
+
hamming_distance,
|
|
50
|
+
index_collision_distance,
|
|
51
|
+
)
|
|
47
52
|
from samplesheet_parser.writer import SampleSheetWriter
|
|
48
53
|
|
|
49
54
|
__all__ = [
|
|
@@ -58,6 +63,7 @@ __all__ = [
|
|
|
58
63
|
"SampleSheetValidator",
|
|
59
64
|
"ValidationResult",
|
|
60
65
|
"hamming_distance",
|
|
66
|
+
"index_collision_distance",
|
|
61
67
|
"SampleSheetConverter",
|
|
62
68
|
"SampleSheetDiff",
|
|
63
69
|
"DiffResult",
|
|
@@ -6,9 +6,9 @@ Entry point: ``samplesheet`` (configured in ``pyproject.toml``).
|
|
|
6
6
|
Commands
|
|
7
7
|
--------
|
|
8
8
|
info Show a quick summary of a sample sheet.
|
|
9
|
-
validate Validate a sheet
|
|
9
|
+
validate Validate a sheet - exit 0 if clean, exit 1 if errors.
|
|
10
10
|
convert Convert between V1 and V2 formats.
|
|
11
|
-
diff Diff two sheets
|
|
11
|
+
diff Diff two sheets - exit 1 if changes detected.
|
|
12
12
|
merge Merge multiple project sheets into one combined sheet.
|
|
13
13
|
split Split a combined sheet into per-project or per-lane files.
|
|
14
14
|
filter Extract a subset of samples by project, lane, or sample ID.
|
|
@@ -99,7 +99,6 @@ if _TYPER_AVAILABLE:
|
|
|
99
99
|
help="Show version and exit.",
|
|
100
100
|
callback=_version_callback,
|
|
101
101
|
is_eager=True,
|
|
102
|
-
is_flag=True,
|
|
103
102
|
),
|
|
104
103
|
] = False,
|
|
105
104
|
) -> None:
|
|
@@ -179,6 +178,7 @@ if _TYPER_AVAILABLE:
|
|
|
179
178
|
"""
|
|
180
179
|
from samplesheet_parser.factory import SampleSheetFactory
|
|
181
180
|
from samplesheet_parser.parsers.v1 import SampleSheetV1
|
|
181
|
+
from samplesheet_parser.parsers.v2 import SampleSheetV2
|
|
182
182
|
|
|
183
183
|
_validate_fmt(fmt)
|
|
184
184
|
if not path.exists():
|
|
@@ -201,10 +201,12 @@ if _TYPER_AVAILABLE:
|
|
|
201
201
|
adapters: list[str] = getattr(sheet, "adapters", []) or []
|
|
202
202
|
experiment_name: str | None = getattr(sheet, "experiment_name", None)
|
|
203
203
|
|
|
204
|
+
read_lengths: list[str] = []
|
|
205
|
+
instrument: str | None = None
|
|
204
206
|
if isinstance(sheet, SampleSheetV1):
|
|
205
207
|
read_lengths = [str(r) for r in (sheet.read_lengths or [])]
|
|
206
208
|
instrument = sheet.instrument_type
|
|
207
|
-
|
|
209
|
+
elif isinstance(sheet, SampleSheetV2):
|
|
208
210
|
reads_dict = sheet.reads or {}
|
|
209
211
|
read_lengths = [
|
|
210
212
|
str(reads_dict[k]) for k in ("Read1Cycles", "Read2Cycles") if k in reads_dict
|
|
@@ -720,7 +722,7 @@ if _TYPER_AVAILABLE:
|
|
|
720
722
|
) -> None:
|
|
721
723
|
"""Extract a subset of samples from a sheet by project, lane, or sample ID.
|
|
722
724
|
|
|
723
|
-
Multiple criteria are ANDed
|
|
725
|
+
Multiple criteria are ANDed - a sample must match all provided
|
|
724
726
|
criteria. ``--sample-id`` supports glob patterns (e.g. ``'CTRL_*'``).
|
|
725
727
|
|
|
726
728
|
Exits 0 if at least one sample matched.
|
|
@@ -45,7 +45,7 @@ Examples
|
|
|
45
45
|
--------
|
|
46
46
|
>>> from samplesheet_parser import SampleSheetConverter
|
|
47
47
|
>>>
|
|
48
|
-
>>> # V1 → V2
|
|
48
|
+
>>> # V1 → V2 - workflow auto-detected from [Header] Instrument Type
|
|
49
49
|
>>> SampleSheetConverter("SampleSheet_v1.csv").to_v2("SampleSheet_v2.csv")
|
|
50
50
|
>>>
|
|
51
51
|
>>> # V2 → V1 with explicit workflow override (e.g. NovaSeq 6000 v1.5)
|
|
@@ -74,7 +74,7 @@ logger = logging.getLogger(__name__)
|
|
|
74
74
|
# Field mappings
|
|
75
75
|
# ---------------------------------------------------------------------------
|
|
76
76
|
|
|
77
|
-
# V2-only fields that have no V1 equivalent
|
|
77
|
+
# V2-only fields that have no V1 equivalent - dropped on V2 → V1
|
|
78
78
|
_V2_ONLY_SETTINGS: set[str] = {
|
|
79
79
|
"OverrideCycles",
|
|
80
80
|
"FastqCompressionFormat",
|
|
@@ -128,7 +128,7 @@ class SampleSheetConverter:
|
|
|
128
128
|
>>> conv = SampleSheetConverter("SampleSheet_v2.csv")
|
|
129
129
|
>>> conv.to_v1("SampleSheet_v1.csv") # emits warnings for dropped fields
|
|
130
130
|
|
|
131
|
-
>>> # NovaSeq 6000 with v1.5 chemistry
|
|
131
|
+
>>> # NovaSeq 6000 with v1.5 chemistry - must override (ambiguous)
|
|
132
132
|
>>> SampleSheetConverter("SampleSheet.csv", workflow="b").to_v2("out.csv")
|
|
133
133
|
"""
|
|
134
134
|
|
|
@@ -178,7 +178,7 @@ class SampleSheetConverter:
|
|
|
178
178
|
f"got {type(sheet).__name__!r}."
|
|
179
179
|
)
|
|
180
180
|
|
|
181
|
-
# Resolve workflow before writing any output
|
|
181
|
+
# Resolve workflow before writing any output - fail fast if the
|
|
182
182
|
# sheet has a non-empty Index2 column and we cannot tell whether
|
|
183
183
|
# to RC it. See _needs_i5_rc().
|
|
184
184
|
needs_rc = self._needs_i5_rc(
|
|
@@ -220,7 +220,7 @@ class SampleSheetConverter:
|
|
|
220
220
|
lines.append(f"AdapterRead1,{sheet.adapter_read1}")
|
|
221
221
|
if sheet.adapter_read2:
|
|
222
222
|
lines.append(f"AdapterRead2,{sheet.adapter_read2}")
|
|
223
|
-
# Emit empty OverrideCycles
|
|
223
|
+
# Emit empty OverrideCycles - caller should fill in if using UMIs or custom cycle counts
|
|
224
224
|
lines.append("OverrideCycles,")
|
|
225
225
|
lines.append("")
|
|
226
226
|
|
|
@@ -305,7 +305,7 @@ class SampleSheetConverter:
|
|
|
305
305
|
lines.append(f"Description,{run_desc}")
|
|
306
306
|
|
|
307
307
|
# Preserve instrument so the workflow signal survives a round trip.
|
|
308
|
-
# V2 may declare InstrumentType, InstrumentPlatform, or both
|
|
308
|
+
# V2 may declare InstrumentType, InstrumentPlatform, or both -
|
|
309
309
|
# prefer the more specific InstrumentType when present.
|
|
310
310
|
v2_instrument = (sheet.header.get("InstrumentType") if sheet.header else None) or (
|
|
311
311
|
sheet.header.get("InstrumentPlatform") if sheet.header else None
|
|
@@ -371,7 +371,7 @@ class SampleSheetConverter:
|
|
|
371
371
|
# Warn about dropped fields
|
|
372
372
|
# Check cloud_data first so the warning fires even when it is the only lossy part
|
|
373
373
|
if sheet.cloud_data:
|
|
374
|
-
dropped.append("[Cloud_Data] section (entire section
|
|
374
|
+
dropped.append("[Cloud_Data] section (entire section - no V1 equivalent)")
|
|
375
375
|
if dropped:
|
|
376
376
|
logger.warning(
|
|
377
377
|
f"V2 → V1 conversion dropped {len(dropped)} field(s) with no V1 equivalent:"
|
|
@@ -450,7 +450,7 @@ class SampleSheetConverter:
|
|
|
450
450
|
result = []
|
|
451
451
|
for col in v2_columns:
|
|
452
452
|
if col in _V2_ONLY_DATA_COLUMNS:
|
|
453
|
-
continue # drop silently
|
|
453
|
+
continue # drop silently - already warned above
|
|
454
454
|
mapped = mapping.get(col, col)
|
|
455
455
|
result.append(mapped)
|
|
456
456
|
return result
|
|
@@ -502,7 +502,7 @@ class SampleSheetConverter:
|
|
|
502
502
|
1. Explicit ``workflow=`` constructor override wins.
|
|
503
503
|
2. Otherwise auto-detect from *instrument*.
|
|
504
504
|
3. If detection fails and any record carries a non-empty
|
|
505
|
-
``index2_key``, raise ``ValueError``
|
|
505
|
+
``index2_key``, raise ``ValueError`` - silently passing the
|
|
506
506
|
i5 through would produce a wrong sheet for workflow-B
|
|
507
507
|
instruments.
|
|
508
508
|
4. If no Index2 values are present, return ``False`` (no-op).
|
|
@@ -534,7 +534,7 @@ class SampleSheetConverter:
|
|
|
534
534
|
f"samplesheet_parser.instruments for the full instrument table."
|
|
535
535
|
)
|
|
536
536
|
|
|
537
|
-
# No Index2 to convert
|
|
537
|
+
# No Index2 to convert - silent pass-through is safe.
|
|
538
538
|
logger.debug(f"{direction}: no Index2 values, skipping workflow detection.")
|
|
539
539
|
return False
|
|
540
540
|
|
|
@@ -4,10 +4,10 @@ Diff engine for Illumina sample sheets.
|
|
|
4
4
|
Compares two sample sheets (any combination of V1 / V2) and reports
|
|
5
5
|
structured differences across four dimensions:
|
|
6
6
|
|
|
7
|
-
- **Header**
|
|
8
|
-
- **Reads**
|
|
9
|
-
- **Samples added / removed**
|
|
10
|
-
- **Sample fields changed**
|
|
7
|
+
- **Header** - key/value changes in [Header] / [BCLConvert_Settings]
|
|
8
|
+
- **Reads** - changes in read lengths or cycle counts
|
|
9
|
+
- **Samples added / removed** - keyed on ``Sample_ID`` + ``Lane``
|
|
10
|
+
- **Sample fields changed** - per-sample field-level diffs (index
|
|
11
11
|
changes, project reassignment, etc.)
|
|
12
12
|
|
|
13
13
|
The comparison is format-aware: V1 ``index`` is compared against V2
|
|
@@ -58,13 +58,13 @@ _FIELD_ALIASES: dict[str, str] = {
|
|
|
58
58
|
"sample_name": "Sample_Name",
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
# Fields to skip when comparing samples
|
|
61
|
+
# Fields to skip when comparing samples - these are metadata that differ
|
|
62
62
|
# between formats by design and do not represent meaningful changes.
|
|
63
63
|
#
|
|
64
64
|
# V1-only fields (no V2 equivalent):
|
|
65
|
-
# I7_Index_ID / I5_Index_ID
|
|
66
|
-
# Sample_Name
|
|
67
|
-
# Sample_Plate / Sample_Well / Description
|
|
65
|
+
# I7_Index_ID / I5_Index_ID - index name columns; V2 stores index values only
|
|
66
|
+
# Sample_Name - V1 carries a display name; V2 omits it
|
|
67
|
+
# Sample_Plate / Sample_Well / Description - IEM metadata not present in V2
|
|
68
68
|
_SKIP_FIELDS: frozenset[str] = frozenset(
|
|
69
69
|
{
|
|
70
70
|
"experiment_name",
|
|
@@ -118,8 +118,8 @@ class HeaderChange:
|
|
|
118
118
|
section: str = "header" # "header" | "reads" | "settings"
|
|
119
119
|
|
|
120
120
|
def __str__(self) -> str:
|
|
121
|
-
old = repr(self.old_value) if self.old_value is not None else "
|
|
122
|
-
new = repr(self.new_value) if self.new_value is not None else "
|
|
121
|
+
old = repr(self.old_value) if self.old_value is not None else "-"
|
|
122
|
+
new = repr(self.new_value) if self.new_value is not None else "-"
|
|
123
123
|
return f"[{self.section}] {self.field}: {old} → {new}"
|
|
124
124
|
|
|
125
125
|
|
|
@@ -135,8 +135,8 @@ class SampleChange:
|
|
|
135
135
|
def __str__(self) -> str:
|
|
136
136
|
lines = [f"Sample {self.sample_id!r} (lane {self.lane}):"]
|
|
137
137
|
for f, (old, new) in self.changes.items():
|
|
138
|
-
old_s = repr(old) if old is not None else "
|
|
139
|
-
new_s = repr(new) if new is not None else "
|
|
138
|
+
old_s = repr(old) if old is not None else "-"
|
|
139
|
+
new_s = repr(new) if new is not None else "-"
|
|
140
140
|
lines.append(f" {f}: {old_s} → {new_s}")
|
|
141
141
|
return "\n".join(lines)
|
|
142
142
|
|
|
@@ -8,10 +8,10 @@ from enum import Enum
|
|
|
8
8
|
class SampleSheetVersion(str, Enum):
|
|
9
9
|
"""Illumina sample sheet format version.
|
|
10
10
|
|
|
11
|
-
V1
|
|
11
|
+
V1 - Illumina Experiment Manager (IEM) format, used with bcl2fastq.
|
|
12
12
|
Identified by ``IEMFileVersion`` in the [Header] section.
|
|
13
13
|
|
|
14
|
-
V2
|
|
14
|
+
V2 - BCLConvert format, used with BCLConvert and required for
|
|
15
15
|
NovaSeq X series instruments.
|
|
16
16
|
Identified by ``FileFormatVersion`` in the [Header] section,
|
|
17
17
|
or by the presence of ``[BCLConvert_Settings]`` / ``[BCLConvert_Data]``
|
|
@@ -25,9 +25,9 @@ class SampleSheetVersion(str, Enum):
|
|
|
25
25
|
class IndexType(str, Enum):
|
|
26
26
|
"""Sequencing index configuration.
|
|
27
27
|
|
|
28
|
-
SINGLE
|
|
29
|
-
DUAL
|
|
30
|
-
NONE
|
|
28
|
+
SINGLE - I7 index only (single-index libraries).
|
|
29
|
+
DUAL - I7 + I5 indexes (dual-index libraries, standard for modern workflows).
|
|
30
|
+
NONE - No index (rare; full-lane libraries).
|
|
31
31
|
"""
|
|
32
32
|
|
|
33
33
|
SINGLE = "single"
|