SAMSHEE
A schema-agnostic parser and writer for illumina sample sheets v2 and similar documents.
URL: https://github.com/lit-regensburg/samshee
Example
This wrapper can be used in the following way:
rule test_samshee_csv_to_json:
input:
sample="SampleSheet.csv",
output:
"samples.json",
threads: 1
log:
"test_samshee_csv_to_json.log",
params:
extra="",
wrapper:
"v9.4.2/bio/samshee"
rule test_samshee_json_to_csv:
input:
sample="SampleSheet.json",
output:
"samples.csv",
threads: 1
log:
"test_samshee_json_to_csv.log",
params:
extra=" --output-format sectioned ",
wrapper:
"v9.4.2/bio/samshee"
rule test_samshee_schema_input:
input:
sample="SampleSheet.csv",
schema="schema.json",
output:
"samples_schema.json",
threads: 1
log:
"test_samshee_schema_input.log",
params:
extra="",
wrapper:
"v9.4.2/bio/samshee"
Note that input, output and log file paths can be chosen freely.
When running with
snakemake --use-conda
the software dependencies will be automatically deployed into an isolated environment before execution.
Software dependencies
samshee=0.2.14snakemake-wrapper-utils=0.8.0
Input/Output
Input:
sample: Sample sheet V2, either json or csv formattedschema: Optional json validation schema
Output:
Sample sheet V2, either json or csv formatted
Params
extra: Optional parameters as –schema or –output-format if user expects sectioned format.
Code
# coding: utf-8
"""This snakemake wrapper handles sample sheet conversions"""
__author__ = "Thibault Dayris"
__copyright__ = "Copyright 2025, Thibault Dayris"
__email__ = "thibault.dayris@gustaveroussy.fr"
__license__ = "MIT"
from os.path import realpath
from snakemake.shell import shell
from snakemake_wrapper_utils.snakemake import get_format
log = snakemake.log_fmt_shell(stdout=False, stderr=True)
extra = snakemake.params.get("extra", "")
if get_format(str(snakemake.output)) == "json":
extra += " --output-format json "
if get_format(str(snakemake.input.sample)) == "json":
extra += " --input-format json "
schema = snakemake.input.get("schema")
if schema:
schema = realpath(schema)
extra += f' --schema \'{{"$ref": "file:{schema}"}}\' '
shell("python -m samshee {extra} {snakemake.input.sample} > {snakemake.output} {log}")