CLI#

This section documents the Command Line Interface (CLI) for the spatialdata_io package.

spatialdata_io#

Convert standard technology data formats to SpatialData object.

Usage:

python -m spatialdata_io <Command> -i <input> -o <output>

For help on how to use a specific command, run:

python -m spatialdata_io <Command> –help

Usage

spatialdata_io [OPTIONS] COMMAND [ARGS]...

codex#

Codex conversion to SpatialData.

Usage

spatialdata_io codex [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

--fcs <fcs>#

Whether the .fcs file is provided if False a .csv file is expected. [default: True]

--imread-kwargs <imread_kwargs>#

JSON string of keyword arguments passed to imread. [default: {}]

cosmx#

Cosmic conversion to SpatialData.

Usage

spatialdata_io cosmx [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

--dataset-id <dataset_id>#

Name of the dataset [default: None]

--transcripts <transcripts>#

Whether to load transcript information. [default: True]

--imread-kwargs <imread_kwargs>#

JSON string of keyword arguments passed to imread. [default: {}]

--image-models-kwargs <image_models_kwargs>#

JSON string of keyword arguments passed to Image2DModel. [default: {}]

curio#

Curio conversion to SpatialData.

Usage

spatialdata_io curio [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

dbit#

Conversion of DBit-seq to SpatialData.

Usage

spatialdata_io dbit [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

--anndata-path <anndata_path>#

Path to the counts and metadata file. [default: None]

--barcode-position <barcode_position>#

Path to the barcode coordinates file. [default: None]

--image-path <image_path>#

Path to the low resolution image file. [default: None]

--dataset-id <dataset_id>#

Dataset ID. [default: None]

--border <border>#

Value pass internally to _xy2edges. [default: True]

--border-scale <border_scale>#

The factor by which the border is scaled. [default: 1]

generic#

Read generic data to SpatialData.

Usage

spatialdata_io generic [OPTIONS]

Options

-i, --input <input>#

Required Path to the image/shapes input file. Supported extensions: [‘.tif’, ‘.tiff’, ‘.png’, ‘.jpg’, ‘.jpeg’, ‘.geojson’]

-o, --output <output>#

Required Path to zarr store to write to. If it does not exist yet, create new zarr store from input

-n, --name <name>#

name of the element to be stored

--data-axes <data_axes>#

Axes of the data for image files. Valid values are permutations of ‘cyx’ and ‘czyx’.

-c, --coordinate-system <coordinate_system>#

Coordinate system in spatialdata object to which an element should belong

iss#

ISS conversion to SpatialData.

Usage

spatialdata_io iss [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

--raw-relative-path <raw_relative_path>#

Required Relative path to raw raster image file.

--labels-relative-path <labels_relative_path>#

Required Relative path to label image file.

--h5ad-relative-path <h5ad_relative_path>#

Required Relative path to counts and metadata file.

--instance-key <instance_key>#

Which column of the AnnData table contains the CellID. [default: None]

--dataset-id <dataset_id>#

Dataset ID [default: region]

--multiscale-image <multiscale_image>#

Whether to process the image into a multiscale image [default: True]

--multiscale-labels <multiscale_labels>#

Whether to process the label image into a multiscale image [default: True]

--imread-kwargs <imread_kwargs>#

JSON string of keyword arguments passed to imread. [default: {}]

--image-models-kwargs <image_models_kwargs>#

JSON string of keyword arguments passed to Image2DModel. [default: {}]

--labels-models-kwargs <labels_models_kwargs>#

JSON string of keyword arguments passed to Labels2DModel. [default: {}]

macsima#

Read MACSima formatted dataset and convert to SpatialData.

Usage

spatialdata_io macsima [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

--parsing-style <parsing_style>#

Parsing style for MACSima data. [default: auto]

Options:

auto | processed_single_folder | processed_multiple_folders | raw

--filter-folder-names <filter_folder_names>#

List of folder names to filter out when parsing multiple folders. [default: None]

--subset <subset>#

Subset the image to the first ‘subset’ pixels in x and y dimensions. [default: None]

--c-subset <c_subset>#

Subset the image to the first ‘c-subset’ channels. [default: None]

--max-chunk-size <max_chunk_size>#

Maximum chunk size for x and y dimensions. [default: 1024]

--c-chunks-size <c_chunks_size>#

Chunk size for c dimension. [default: 1]

--multiscale <multiscale>#

Whether to create a multiscale image. [default: True]

--transformations <transformations>#

Whether to add a transformation from pixels to microns to the image. [default: True]

--scale-factors <scale_factors>#

Scale factors to use for downsampling. If None, scale factors are calculated based on image size. [default: None]

--default-scale-factor <default_scale_factor>#

Default scale factor to use for downsampling. [default: 2]

--nuclei-channel-name <nuclei_channel_name>#

Common string of the nuclei channel to separate nuclei from other channels. [default: ‘DAPI’]

--split-threshold-nuclei-channel <split_threshold_nuclei_channel>#

Threshold for splitting nuclei channels. [default: 2]

--skip-rounds <skip_rounds>#

List of round numbers to skip when parsing the data. [default: None]

--include-cycle-in-channel-name <include_cycle_in_channel_name>#

Whether to include the cycle number in the channel name. [default: False]

--imread-kwargs <imread_kwargs>#

JSON string of keyword arguments passed to imread. [default: {}]

mcmicro#

Conversion of MCMicro to SpatialData.

Usage

spatialdata_io mcmicro [OPTIONS]

Options

-i, --input <input>#

Required Path to the mcmicro project directory.

-o, --output <output>#

Required Path to the output.zarr file.

--imread-kwargs <imread_kwargs>#

JSON string of keyword arguments passed to imread. [default: {}]

--image-models-kwargs <image_models_kwargs>#

JSON string of keyword arguments passed to Image2DModel. [default: {}]

--labels-models-kwargs <labels_models_kwargs>#

JSON string of keyword arguments passed to Labels2DModel. [default: {}]

merscope#

Merscope conversion to SpatialData.

Usage

spatialdata_io merscope [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

--vpt-outputs <vpt_outputs>#

Optional argument to specify the path to the Vizgen postprocessing tool. [default: None]

--z-layers <z_layers>#

Indices of the z-layers to consider. [default: 3]

--region-name <region_name>#

Name of the ROI. [default: None]

--slide-name <slide_name>#

Name of the slide/run [default: None]

--backend <backend>#

Either ‘dask_image’ or ‘rioxarray’. [default: None]

Options:

dask_image | rioxarray

--transcripts <transcripts>#

Whether to read transcripts. [default: True]

--cells-boundaries <cells_boundaries>#

Whether to read cells boundaries. [default: True]

--cells-table <cells_table>#

Whether to read cells table. [default: True]

--mosaic-images <mosaic_images>#

Whether to read the mosaic images. [default: True]

--imread-kwargs <imread_kwargs>#

JSON string of keyword arguments passed to imread. [default: {}]

--image-models-kwargs <image_models_kwargs>#

JSON string of keyword arguments passed to Image2DModel. [default: {}]

seqfish#

Seqfish conversion to SpatialData.

Usage

spatialdata_io seqfish [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

--load-images <load_images>#

Whether to load images. [default: True]

--load-labels <load_labels>#

Whether to load labels. [default: True]

--load-points <load_points>#

Whether to load points. [default: True]

--load-shapes <load_shapes>#

Whether to load shapes. [default: True]

--cells-as-circles <cells_as_circles>#

Whether to read cells as circles. [default: False]

--rois <rois>#

Which sections to load. Provide one or more ROI identifiers. [default: All sections are loaded]

--raster-models-scale-factors <raster_models_scale_factors>#

Scale factors for raster models. [default: None]

--imread-kwargs <imread_kwargs>#

JSON string of keyword arguments passed to imread. [default: {}]

steinbock#

Steinbock conversion to SpatialData.

Usage

spatialdata_io steinbock [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

--labels-kind <labels_kind>#

What kind of labels to use. [default: ‘deepcell’]

Options:

deepcell | ilastik

--imread-kwargs <imread_kwargs>#

JSON string of keyword arguments passed to imread. [default: {}]

--image-models-kwargs <image_models_kwargs>#

JSON string of keyword arguments passed to Image2DModel. [default: {}]

stereoseq#

Stereoseq conversion to SpatialData.

Usage

spatialdata_io stereoseq [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

--dataset-id <dataset_id>#

Dataset ID. [default: None]

--read-square-bin <read_square_bin>#

If True, will read the square bin {xx.GEF_FILE!r} file and build corresponding points element. [default: True]

--optional-tif <optional_tif>#

If True, will read {xx.TISSUE_TIF!r} files. [default: False]

--imread-kwargs <imread_kwargs>#

JSON string of keyword arguments passed to imread. [default: {}]

--image-models-kwargs <image_models_kwargs>#

JSON string of keyword arguments passed to Image2DModel. [default: {}]

visium#

Visium conversion to SpatialData.

Usage

spatialdata_io visium [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

--dataset-id <dataset_id>#

Dataset ID. [default: None]

--counts-file <counts_file>#

Name of the counts file, defaults to {vx.FILTERED_COUNTS_FILE!r}. [default: None]

--fullres-image-file <fullres_image_file>#

Path to the full resolution image. [default: None]

--tissue-positions-file <tissue_positions_file>#

Path to the tissue positions file. [default: None]

--scalefactors-file <scalefactors_file>#

Path to the scalefactors file. [default: None]

--var-names-make-unique <var_names_make_unique>#

Whether to make variable names unique. [default: True]

--imread-kwargs <imread_kwargs>#

JSON string of keyword arguments passed to imread. [default: {}]

--image-models-kwargs <image_models_kwargs>#

JSON string of keyword arguments passed to Image2DModel. [default: {}]

visium-hd#

Visium HD conversion to SpatialData.

Usage

spatialdata_io visium-hd [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

--dataset-id <dataset_id>#

Dataset ID. [default: None]

--filtered-counts-file <filtered_counts_file>#

It sets the value of counts_file to {vx.FILTERED_COUNTS_FILE!r} (when True) or to``{vx.RAW_COUNTS_FILE!r}`` (when False). [default: True]

--bin-size <bin_size>#

When specified, load the data of a specific bin size, or a list of bin sizes. By default, it loads all the available bin sizes. [default: None]

--bins-as-squares <bins_as_squares>#

If true, bins are represented as squares otherwise as circles. [default: True]

--fullres-image-file <fullres_image_file>#

Path to the full resolution image. [default: None]

--load-all-images <load_all_images>#

If False, load only the full resolution, high resolution, and low resolution images. If True, also the following images: {vx.IMAGE_CYTASSIST!r}. [default: False]

--annotate-table-by-labels <annotate_table_by_labels>#

If true, annotates the table by labels. [default: False]

--load-segmentations-only <load_segmentations_only>#

If True, only the segmented cell boundaries and their associated counts will be loaded. All binned data will be skipped. [default: None, which will fall back to False with a deprecation warning]

--load-nucleus-segmentations <load_nucleus_segmentations>#

If True and nucleus segmentation files are present, load nucleus segmentation polygons and the corresponding nucleus-filtered count table. [default: False]

--var-names-make-unique <var_names_make_unique>#

Whether to make variable names unique. [default: True]

--gex-only <gex_only>#

If True, only load gene expression features. [default: False]

--imread-kwargs <imread_kwargs>#

JSON string of keyword arguments passed to imread. [default: {}]

--image-models-kwargs <image_models_kwargs>#

JSON string of keyword arguments passed to Image2DModel. [default: {}]

--anndata-kwargs <anndata_kwargs>#

JSON string of keyword arguments passed to anndata. [default: {}]

xenium#

Xenium conversion to SpatialData.

Usage

spatialdata_io xenium [OPTIONS]

Options

-o, --output <output>#

Required Path to the output file.

-i, --input <input>#

Required Path to the input file.

--cells-boundaries <cells_boundaries>#

Whether to read cells boundaries. [default: True]

--nucleus-boundaries <nucleus_boundaries>#

Whether to read Nucleus boundaries. [default: True]

--cells-as-circles <cells_as_circles>#

Whether to read cells as circles. [default: False]

--cells-labels <cells_labels>#

Whether to read cells labels (raster). [default: True]

--nucleus-labels <nucleus_labels>#

Whether to read nucleus labels (raster). [default: True]

--transcripts <transcripts>#

Whether to read transcripts. [default: True]

--morphology-mip <morphology_mip>#

Whether to read morphology mip image. [default: True]

--morphology-focus <morphology_focus>#

Whether to read morphology focus image. [default: True]

--aligned-images <aligned_images>#

Whether to parse additional H&E or IF aligned images. [default: True]

--cells-table <cells_table>#

Whether to read cells annotations in the AnnData table. [default: True]

--gex-only <gex_only>#

If True, only load gene expression features. [default: True]

--imread-kwargs <imread_kwargs>#

JSON string of keyword arguments passed to imread. [default: {}]

--image-models-kwargs <image_models_kwargs>#

JSON string of keyword arguments passed to Image2DModel. [default: {}]

--labels-models-kwargs <labels_models_kwargs>#

JSON string of keyword arguments passed to Labels2DModel. [default: {}]