Skip to content
Draft
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
7 changes: 7 additions & 0 deletions .github/workflows/prepare_test_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ jobs:
# OMAP10 for format v0.x.x
curl -o OMAP10_small.zip "https://zenodo.org/api/records/18196366/files-archive"

# -------
# nf-core/mcmicro 2.0.0 `test` profile output (WSI, single sample, mccellpose segmentation).
# Derived from nf-core/test-datasets:mcmicro (lunaphore_example, MIT-licensed; source data
# Wuennemann et al. 2024, syn51471704, CC BY 4.0). Reproduce with:
# nextflow run nf-core/mcmicro -r 2.0.0 -profile test,docker --outdir out
curl -L -o mcmicro-nfcore-wsi-test.zip "https://github.com/mc2-center/spatialdata-io/releases/download/test-data/mcmicro-nfcore-wsi-test.zip"

- name: Unzip files
run: |
cd ./data
Expand Down
16 changes: 16 additions & 0 deletions src/spatialdata_io/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,18 @@ def iss_wrapper(
"--input", "-i", type=click.Path(exists=True), help="Path to the mcmicro project directory.", required=True
)
@click.option("--output", "-o", type=click.Path(), help="Path to the output.zarr file.", required=True)
@click.option(
"--pipeline",
type=click.Choice(["labsyspharm", "nfcore"]),
default=None,
help="Which mcmicro pipeline produced the output. [default: auto-detect]",
)
@click.option(
"--markers-file",
type=click.Path(),
default=None,
help="Path to the markers CSV. [default: auto-detect]",
)
@click.option(
"--imread-kwargs",
type=str,
Expand All @@ -273,6 +285,8 @@ def iss_wrapper(
def mcmicro_wrapper(
input: str,
output: str,
pipeline: str | None = None,
markers_file: str | None = None,
imread_kwargs: str = "{}",
image_models_kwargs: str = "{}",
labels_models_kwargs: str = "{}",
Expand All @@ -282,6 +296,8 @@ def mcmicro_wrapper(

sdata = mcmicro(
input,
pipeline=pipeline,
markers_file=markers_file,
imread_kwargs=_parse_json_param(imread_kwargs, "imread_kwargs"),
image_models_kwargs=_parse_json_param(image_models_kwargs, "image_models_kwargs"),
labels_models_kwargs=_parse_json_param(labels_models_kwargs, "labels_models_kwargs"),
Expand Down
24 changes: 23 additions & 1 deletion src/spatialdata_io/_constants/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,19 @@ class StereoseqKeys(ModeEnum):
RESOLUTION = "resolution"


@unique
class McmicroPipeline(ModeEnum):
"""The two mcmicro pipeline flavors whose output layouts the reader understands."""

LABSYSPHARM = "labsyspharm" # original labsyspharm/mcmicro Nextflow pipeline
NFCORE = "nfcore" # nf-core/mcmicro pipeline


@unique
class McmicroKeys(ModeEnum):
"""Keys for *Mcmicro* formatted dataset."""

# files and directories
# files and directories (labsyspharm/mcmicro layout)
QUANTIFICATION_DIR = "quantification"
MARKERS_FILE = "markers.csv"
IMAGES_DIR_WSI = "registration"
Expand All @@ -292,7 +300,21 @@ class McmicroKeys(ModeEnum):
COREOGRAPH_CENTROIDS = "qc/coreograph/centroidsY-X.txt"
COREOGRAPH_TMA_MAP = "qc/coreograph/TMA_MAP.tif"

# files and directories (nf-core/mcmicro layout)
NFCORE_IMAGES_DIR_WSI = "registration/ashlar"
NFCORE_IMAGES_DIR_TMA = "tma_dearray"
NFCORE_QUANTIFICATION_DIR = "quantification/mcquant"
NFCORE_COREOGRAPH_CENTROIDS = "tma_dearray/centroidsY-X.txt"
NFCORE_PIPELINE_INFO = "pipeline_info"
NFCORE_PARAMS_GLOB = "params*.json"
NFCORE_BACKSUB_DIR = "backsub"
NFCORE_BACKSUB_MARKERS_GLOB = "*_backsub.csv"
NFCORE_MARKERSHEET_GLOBS = "summary/*markersheet*.tsv;prelude/*markersheet*.tsv"
NFCORE_TMA_MAP_STEM = "TMA_MAP"

# metadata
MARKER_NAME = "marker_name"
CHANNEL_NUMBER = "channel_number"
COORDS_X = "X_centroid"
COORDS_Y = "Y_centroid"
INSTANCE_KEY = "CellID"
Expand Down
Loading
Loading