view spatialdata_io.xml @ 0:1f6c780a2635 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/spatialdata commit 87bff76d897c5a4277d9987cf26432a18e0458cd-dirty
author iuc
date Sat, 14 Mar 2026 15:16:08 +0000
parents
children
line wrap: on
line source

<tool id="spatialdata_io" name="SpatialData IO" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>load common spatial omics formats into SpatialData</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="creator" />
    <command detect_errors="exit_code"><![CDATA[
        ## CosMX
        #if $method_condi.method == 'cosmx':
            ## puting all files in working directory instead of input. cosmx should run inside same directory
            mkdir -p 'CellComposite' 'CellLabels' 'output' &&
            #for $image in $method_condi.CellComposite:
                #if $image.element_identifier.endswith('.jpg'):
                    ln -s '$image' 'CellComposite/${image.element_identifier}' &&
                #else:
                    ln -s '$image' 'CellComposite/${image.element_identifier}.jpg' &&
                #end if
            #end for
            #for $image in $method_condi.CellLabels:
                #if $image.element_identifier.endswith('.tiff') or $image.element_identifier.endswith('.tif'):
                    ln -s '$image' 'CellLabels/${image.element_identifier}' &&
                #else:
                    ln -s '$image' 'CellLabels/${image.element_identifier}.tiff' &&
                #end if
            #end for
            #if $method_condi.exprMat_file.element_identifier.endswith('.csv'):
                ln -s '$method_condi.exprMat_file' '${method_condi.exprMat_file.element_identifier}' &&
            #else:
                ln -s '$method_condi.exprMat_file' '${method_condi.exprMat_file.element_identifier}.csv' &&
            #end if
            #if $method_condi.fov_positions_file.element_identifier.endswith('.csv'):
                ln -s '$method_condi.fov_positions_file' '${method_condi.fov_positions_file.element_identifier}' &&
            #else:
                ln -s '$method_condi.fov_positions_file' '${method_condi.fov_positions_file.element_identifier}.csv' &&
            #end if
            #if $method_condi.metadata_file.element_identifier.endswith('.csv'):
                ln -s '$method_condi.metadata_file' '${method_condi.metadata_file.element_identifier}' &&
            #else:
                ln -s '$method_condi.metadata_file' '${method_condi.metadata_file.element_identifier}.csv' &&
            #end if
            #if $method_condi.tx_file.element_identifier.endswith('.csv'):
                ln -s '$method_condi.tx_file' '${method_condi.tx_file.element_identifier}' &&
            #else:
                ln -s '$method_condi.tx_file' '${method_condi.tx_file.element_identifier}.csv' &&
            #end if

        ## CURIO
        #else if $method_condi.method == 'curio':
            mkdir -p 'input' 'output' &&
            ln -s '$method_condi.anndata' 'input/${method_condi.dataset_id}_anndata.h5ad' &&
            ln -s '$method_condi.cluster_assignment' 'input/${method_condi.dataset_id}_cluster_assignment.txt' &&
            ln -s '$method_condi.metrics' 'input/${method_condi.dataset_id}_Metrics.csv' &&
            ln -s '$method_condi.variable_features_clusters' 'input/${method_condi.dataset_id}_variable_features_clusters.txt' &&
            ln -s '$method_condi.variable_features_spatial' 'input/${method_condi.dataset_id}_variable_features_spatial_moransi.txt' &&

        ## DBIT
        #else if $method_condi.method == 'dbit':
            ## puting all files in working directory instead of input. dbit should run inside same directory
            mkdir -p 'output' &&
            ln -s '$method_condi.barcode_positions' '${method_condi.dataset_id}_barcode_positions.tabular' &&
            ln -s '$method_condi.counts' '${method_condi.dataset_id}_counts.h5ad' &&
            ln -s '$method_condi.tissue_lowres' '${method_condi.dataset_id}_tissue_lowres.png' &&

        ## MACSima
        #else if $method_condi.method == 'macsima':
            mkdir -p 'input' 'output' &&
            #for $image in $method_condi.tiff_files:
                #if $image.element_identifier.endswith('.tif') or $image.element_identifier.endswith('.tiff'):
                    ln -s '$image' 'input/${image.element_identifier}' &&
                #else:
                    ln -s '$image' 'input/${image.element_identifier}.tif' &&
                #end if
            #end for

        ## MERSCOPE
        #else if $method_condi.method == 'merscope':
            mkdir -p 'input/region/images' 'input/region/vpt_outputs' 'output' &&
            #for $image in $method_condi.mosaic_images:
                #if $image.element_identifier.endswith('.tif'):
                    ln -s '$image' 'input/region/images/${image.element_identifier}' &&
                #else:
                    ln -s '$image' 'input/region/images/${image.element_identifier}.tif' &&
                #end if
            #end for
            ln -s '$method_condi.input_micron_to_mosaic' 'input/region/images/micron_to_mosaic_pixel_transform.csv' &&
            ln -s '$method_condi.cell_by_gene' 'input/region/vpt_outputs/cell_by_gene.csv' &&
            ln -s '$method_condi.cell_meta' 'input/region/vpt_outputs/cell_metadata.csv' &&
            ## the tool checks the file name, so the name is hardcoded here, but it does not necessarily have to be from cellpose
            ln -s '$method_condi.cells_boundaries' 'input/region/vpt_outputs/cellpose_micron_space.parquet' &&
            ln -s '$method_condi.transcripts' 'input/region/detected_transcripts.csv' &&

        ## Visium
        #else if $method_condi.method == 'visium':
            mkdir -p 'input/spatial' 'output' &&
            #if $method_condi.matrix_bool:
                ln -s '$method_condi.feature_bc_matrix' 'input/raw_feature_bc_matrix.h5' &&
            #else:
                ln -s '$method_condi.feature_bc_matrix' 'input/filtered_feature_bc_matrix.h5' &&
            #end if
            ln -s '$method_condi.scalefactors_json' 'input/scalefactors_json.json' &&
            ln -s '$method_condi.fullres_image_file' 'input/fullres_image.tif' &&
            ln -s '$method_condi.tissue_hires_image' 'input/spatial/tissue_hires_image.png' &&
            ln -s '$method_condi.tissue_lowres_image' 'input/spatial/tissue_lowres_image.png' &&
            ln -s '$method_condi.tissue_positions_list' 'input/tissue_positions_list.csv' &&

        ## Visium HD
        #else if $method_condi.method == 'visium_hd':
            mkdir -p 'input' 'output' &&
            ## Core required file
            ln -s '$method_condi.feature_slice' 'input/feature_slice.h5' &&

            ## Binned outputs (if included)
            #if str($method_condi.include_binned_condi.include_binned) == 'yes':
                ## Bin 002um (required for nucleus segmentation if enabled)
                #if $method_condi.include_binned_condi.bin002.feature_bc_matrix_002:
                    mkdir -p 'input/binned_outputs/square_002um/spatial' &&
                    #if $method_condi.matrix_bool:
                        ln -s '$method_condi.include_binned_condi.bin002.feature_bc_matrix_002' 'input/binned_outputs/square_002um/raw_feature_bc_matrix.h5' &&
                    #else:
                        ln -s '$method_condi.include_binned_condi.bin002.feature_bc_matrix_002' 'input/binned_outputs/square_002um/filtered_feature_bc_matrix.h5' &&
                    #end if
                    ln -s '$method_condi.include_binned_condi.bin002.tissue_positions_002' 'input/binned_outputs/square_002um/spatial/tissue_positions.parquet' &&
                    ln -s '$method_condi.include_binned_condi.bin002.scalefactors_json_002' 'input/binned_outputs/square_002um/spatial/scalefactors_json.json' &&
                #end if

                ## Bin 008um
                #if $method_condi.include_binned_condi.bin008.feature_bc_matrix_008:
                    mkdir -p 'input/binned_outputs/square_008um/spatial' &&
                    #if $method_condi.matrix_bool:
                        ln -s '$method_condi.include_binned_condi.bin008.feature_bc_matrix_008' 'input/binned_outputs/square_008um/raw_feature_bc_matrix.h5' &&
                    #else:
                        ln -s '$method_condi.include_binned_condi.bin008.feature_bc_matrix_008' 'input/binned_outputs/square_008um/filtered_feature_bc_matrix.h5' &&
                    #end if
                    ln -s '$method_condi.include_binned_condi.bin008.tissue_positions_008' 'input/binned_outputs/square_008um/spatial/tissue_positions.parquet' &&
                    ln -s '$method_condi.include_binned_condi.bin008.scalefactors_json_008' 'input/binned_outputs/square_008um/spatial/scalefactors_json.json' &&
                #end if

                ## Bin 016um
                #if $method_condi.include_binned_condi.bin016.feature_bc_matrix_016:
                    mkdir -p 'input/binned_outputs/square_016um/spatial' &&
                    #if $method_condi.matrix_bool:
                        ln -s '$method_condi.include_binned_condi.bin016.feature_bc_matrix_016' 'input/binned_outputs/square_016um/raw_feature_bc_matrix.h5' &&
                    #else:
                        ln -s '$method_condi.include_binned_condi.bin016.feature_bc_matrix_016' 'input/binned_outputs/square_016um/filtered_feature_bc_matrix.h5' &&
                    #end if
                    ln -s '$method_condi.include_binned_condi.bin016.tissue_positions_016' 'input/binned_outputs/square_016um/spatial/tissue_positions.parquet' &&
                    ln -s '$method_condi.include_binned_condi.bin016.scalefactors_json_016' 'input/binned_outputs/square_016um/spatial/scalefactors_json.json' &&
                #end if

                ## Nucleus segmentation (requires barcode_mappings at root)
                #if str($method_condi.include_binned_condi.include_nucleus_seg_condi.include_nucleus_seg) == 'yes':
                    mkdir -p 'input/segmented_outputs/' &&
                    ln -s '$method_condi.include_binned_condi.include_nucleus_seg_condi.barcode_mappings' 'input/barcode_mappings.parquet' &&
                    ln -s '$method_condi.include_binned_condi.include_nucleus_seg_condi.nucleus_segmentation' 'input/segmented_outputs/nucleus_segmentations.geojson' &&
                #end if
            #end if

            ## Segmented outputs (cell segmentation)
            #if str($method_condi.segmentation_conditional.enable_segmentation) == 'yes':
                mkdir -p 'input/segmented_outputs/spatial' &&
                #if $method_condi.matrix_bool:
                    ln -s '$method_condi.segmentation_conditional.feature_bc_matrix_seg' 'input/segmented_outputs/raw_feature_cell_matrix.h5' &&
                #else:
                    ln -s '$method_condi.segmentation_conditional.feature_bc_matrix_seg' 'input/segmented_outputs/filtered_feature_cell_matrix.h5' &&
                #end if
                ln -s '$method_condi.segmentation_conditional.cell_segmentation' 'input/segmented_outputs/cell_segmentations.geojson' &&
                ln -s '$method_condi.segmentation_conditional.scalefactors_json_seg' 'input/segmented_outputs/spatial/scalefactors_json.json' &&
            #end if

            ## Images (placed in spatial/ and/or segmented_outputs/spatial/)
            mkdir -p 'input/spatial' &&
            #if $method_condi.images.tissue_hires:
                ln -s '$method_condi.images.tissue_hires' 'input/spatial/tissue_hires_image.png' &&
            #end if
            #if $method_condi.images.tissue_lowres:
                ln -s '$method_condi.images.tissue_lowres' 'input/spatial/tissue_lowres_image.png' &&
            #end if
            #if str($method_condi.images.cytassist_image_condi.include_cytassist) == 'yes':
                ln -s '$method_condi.images.cytassist_image_condi.cytassist_image' 'input/spatial/cytassist_image.tiff' &&
            #end if

            ## Microscope image (if provided, create microscope_image directory)
            #if $method_condi.images.microscope_image:
                mkdir -p 'input/microscope_image' &&
                ln -s '$method_condi.images.microscope_image' 'input/microscope_image/fullres_image.tiff' &&
            #end if

            echo "echoing the structure..." &&
            tree -L 3 input &&

        ## XENIUM
        #else if $method_condi.method == 'xenium':
            mkdir -p 'input/region/morphology_focus/' 'output' &&
            ## ln -s does not work here.
            #if str($method_condi.cell_boundaries) != '':
                cp '$method_condi.cell_boundaries' 'input/region/cell_boundaries.parquet' &&
            #end if
            cp '$method_condi.cell_feature_matrix' 'input/region/cell_feature_matrix.h5' &&
            cp '$method_condi.cells' 'input/region/cells.parquet' &&
            cp '$method_condi.cells_zarr' 'input/region/cells.zarr.zip' &&
            cp '$method_condi.experiment_xenium' 'input/region/experiment.xenium' &&
            #for $image in $method_condi.morphology_focus:
                #if $image.element_identifier.endswith('.ome.tiff') or $image.element_identifier.endswith('.ome.tif'):
                    cp '$image' 'input/region/morphology_focus/${image.element_identifier}' &&
                #else:
                    cp '$image' 'input/region/morphology_focus/${image.element_identifier}.ome.tif' &&
                #end if
            #end for
            #if str($method_condi.nucleus_boundaries) != '':
                cp '$method_condi.nucleus_boundaries' 'input/region/nucleus_boundaries.parquet' &&
            #end if
            #if str($method_condi.transcripts) != '':
                cp '$method_condi.transcripts' 'input/region/transcripts.parquet' &&
            #end if
            #if str($method_condi.add_hne_condi.add_hne) == 'yes' or str($method_condi.add_hne_condi.add_hne) == 'yes_accurate':
                cp '$method_condi.add_hne_condi.hne_image' 'input/region/he_image.ome.tif' &&
            #end if
            #if str($method_condi.add_if_condi.add_if) == 'yes' or str($method_condi.add_if_condi.add_if) == 'yes_accurate':
                cp '$method_condi.add_if_condi.if_image' 'input/region/if_image.ome.tif' &&
            #end if
            #if str($method_condi.add_hne_condi.add_hne) == 'yes_accurate':
                cp '$method_condi.add_hne_condi.image_alignment' 'input/region/he_image_alignment.csv' &&
            #end if
            #if str($method_condi.add_if_condi.add_if) == 'yes_accurate':
                cp '$method_condi.add_if_condi.image_alignment' 'input/region/if_image_alignment.csv' &&
            #end if
        #end if

        ## run the pipeline
        cat 'spdata_io.py' &&
        python3 'spdata_io.py' &&
        ## zip the output spatialdata folder
        cd output && zip -r ../spatialdata.spatialdata.zip spatialdata/ && cd ..
    ]]></command>
    <configfiles>
        <configfile name="spdata_config" filename="spdata_io.py">
#if $method_condi.method == 'cosmx':
from spatialdata_io import cosmx
spdata = cosmx(path="./",
               dataset_id="$method_condi.dataset_id",
               transcripts=$method_condi.transcripts_bool,
               )

#else if $method_condi.method == 'curio':
from spatialdata_io import curio
spdata = curio(path="./input"
               )

#else if $method_condi.method == 'dbit':
from spatialdata_io import dbit
spdata = dbit(path="./",
              anndata_path="${method_condi.dataset_id}_counts.h5ad",
              barcode_position="${method_condi.dataset_id}_barcode_positions.tabular",
              image_path="${method_condi.dataset_id}_tissue_lowres.png",
              dataset_id="$method_condi.dataset_id",
              border=$method_condi.border,
              border_scale=$method_condi.border_scale,
              )

#else if $method_condi.method == 'macsima':
from spatialdata_io import macsima
spdata = macsima(path="./input",
                parsing_style="auto",
                #if $method_condi.subset:
                subset=$method_condi.subset,
                #end if
                #if $method_condi.subset_c:
                subset_c=$method_condi.subset_c,
                #end if
                max_chunk_size=$method_condi.max_chunk_size,
                c_chunks_size=$method_condi.c_chunks_size,
                multiscale=$method_condi.multiscale_bool,
                transformations=$method_condi.transformations_bool,
                #if str($method_condi.scale_factors) != '':
                #set scale_factors_list = [int(x.strip()) for x in str($method_condi.scale_factors).split(',')]
                scale_factors=$scale_factors_list,
                #end if
                nuclei_channel_name="$method_condi.nuclei_channel_name",
                #if str($method_condi.split_threshold_nuclei_channel) != '':
                split_threshold_nuclei_channel=$method_condi.split_threshold_nuclei_channel,
                #else:
                split_threshold_nuclei_channel=None,
                #end if
                include_cycle_in_channel_name=$method_condi.include_cycle_in_channel_name_bool,
                )

#else if $method_condi.method == 'merscope':
from spatialdata_io import merscope
spdata = merscope(path="./input/region",
                  vpt_outputs="./input/region/vpt_outputs",
                  #set z_layers_list = [int(x.strip()) for x in str($method_condi.z_layers).split(',')]
                  z_layers=$z_layers_list,
                  region_name="$method_condi.region_name",
                  slide_name="$method_condi.slide_name",
                  backend="rioxarray",
                  transcripts=$method_condi.transcripts_bool,
                  cells_boundaries=$method_condi.cells_boundaries_bool,
                  cells_table=$method_condi.cells_table_bool,
                  mosaic_images=$method_condi.mosaic_images_bool,
                  )

#else if $method_condi.method == 'visium':
from spatialdata_io import visium
spdata = visium(path="./input",
                dataset_id="$method_condi.dataset_id",
                #if $method_condi.matrix_bool:
                counts_file='raw_feature_bc_matrix.h5',
                #else:
                counts_file='filtered_feature_bc_matrix.h5',
                #end if
                fullres_image_file='fullres_image.tif',
                tissue_positions_file='tissue_positions_list.csv',
                scalefactors_file='scalefactors_json.json',
                var_names_make_unique=True,
                )

#else if $method_condi.method == 'visium_hd':
from spatialdata_io import visium_hd
spdata = visium_hd(path="./input",
                   dataset_id="$method_condi.dataset_id",
                   #if $method_condi.matrix_bool:
                   filtered_counts_file=False,
                   #else:
                   filtered_counts_file=True,
                   #end if
                   #if str($method_condi.include_binned_condi.include_binned) == 'no':
                   load_segmentations_only=True,
                   #else:
                   load_segmentations_only=False,
                   #end if
                   #if str($method_condi.include_binned_condi.include_binned) == 'yes' and str($method_condi.include_binned_condi.include_nucleus_seg_condi.include_nucleus_seg) == 'yes':
                   load_nucleus_segmentations=True,
                   #else:
                   load_nucleus_segmentations=False,
                   #end if
                   bin_size=None,
                   bins_as_squares=$method_condi.bins_as_squares_bool,
                   annotate_table_by_labels=$method_condi.annotate_table_by_labels_bool,
                   #if $method_condi.images.microscope_image:
                   fullres_image_file="./input/microscope_image/fullres_image.tiff",
                   #else:
                   fullres_image_file=None,
                   #end if
                   #if str($method_condi.images.cytassist_image_condi.include_cytassist) == 'yes':
                   load_all_images=True,
                   #else:
                   load_all_images=False,
                   #end if
                   var_names_make_unique=$method_condi.var_names_make_unique_bool,
                   )

#else if $method_condi.method == 'xenium':
import os
from spatialdata_io import xenium
spdata = xenium(path="./input/region",
                #if str($method_condi.cell_boundaries) != '':
                cells_boundaries=True,
                #else:
                cells_boundaries=False,
                #end if
                #if str($method_condi.nucleus_boundaries) != '':
                nucleus_boundaries=True,
                #else:
                nucleus_boundaries=False,
                #end if
                cells_as_circles=$method_condi.cells_as_circles_bool,
                cells_labels=$method_condi.cells_labels_bool,
                nucleus_labels=$method_condi.nucleus_labels_bool,
                #if str($method_condi.transcripts) != '':
                transcripts=True,
                #else:
                transcripts=False,
                #end if
                morphology_mip=$method_condi.morphology_mip_bool,
                morphology_focus=$method_condi.morphology_focus_bool,
                #if str($method_condi.add_hne_condi.add_hne) == 'yes' or str($method_condi.add_if_condi.add_if) == 'yes':
                aligned_images=True,
                #else:
                aligned_images=False,
                #end if
                cells_table=$method_condi.cells_table_bool,
                gex_only=$method_condi.gex_only_bool,
                n_jobs=int(os.getenv("GALAXY_SLOTS")),
                )

#if str($method_condi.add_if_condi.add_if) == 'yes_accurate':
from spatialdata_io import xenium_aligned_image
spdata["if_image"] = xenium_aligned_image(
    image_path="./input/region/if_image.ome.tif",
    alignment_file="./input/region/if_image_alignment.csv"
)
#else if str($method_condi.add_hne_condi.add_hne) == 'yes_accurate':
from spatialdata_io import xenium_aligned_image
spdata["he_image"] = xenium_aligned_image(
    image_path="./input/region/he_image.ome.tif",
    alignment_file="./input/region/he_image_alignment.csv"
)

#end if
#end if

print(spdata)
spdata.write("./output/spatialdata", overwrite=True)
        </configfile>
    </configfiles>
    <inputs>
        <conditional name="method_condi">
            <param name="method" type="select" label="Spatial Technology">
                <option value="cosmx">CosMx</option>
                <option value="dbit">DBiT-seq</option>
                <option value="macsima">MACSima</option>
                <option value="merscope">MERSCOPE</option>
                <option value="visium">10x Genomics Visium</option>
                <option value="visium_hd">10x Genomics Visium HD</option>
                <option value="xenium">10x Genomics Xenium</option>
            </param>
            <when value="cosmx">
                <param name="CellComposite" type="data" format="jpg,png,tiff" multiple="true" label="Cell Composite images"/>
                <param name="CellLabels" type="data" format="tiff" multiple="true" label="Cell Labels images"/>
                <param name="exprMat_file" type="data" format="csv" label="Expression matrix file"/>
                <param name="fov_positions_file" type="data" format="csv" label="FOV positions file"/>
                <param name="metadata_file" type="data" format="csv" label="Metadata file"/>
                <param name="tx_file" type="data" format="csv" label="Transcripts file"/>
                <param name="dataset_id" type="text" value="Galaxy" label="Dataset identifier" help="It should match your input files name">
                    <sanitizer invalid_char="">
                        <valid initial="string.letters,string.digits">
                            <add value="_" />
                        </valid>
                    </sanitizer>
                    <validator type="regex">[0-9a-zA-Z_]+</validator>
                </param>
                <param name="transcripts_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Load transcripts information?"/>
            </when>
            <when value="dbit">
                <param name="barcode_positions" type="data" format="tabular" label="Barcode positions file"/>
                <param name="counts" type="data" format="h5ad" label="Counts file"/>
                <param name="tissue_lowres" type="data" format="png" label="Tissue low resolution image"/>
                <param name="dataset_id" type="text" value="Galaxy" label="Dataset identifier" help="It should match your input files name">
                    <sanitizer invalid_char="">
                        <valid initial="string.letters,string.digits">
                            <add value="_" />
                        </valid>
                    </sanitizer>
                    <validator type="regex">[0-9a-zA-Z_]+</validator>
                </param>
                <param name="border" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Create a border" help="If True, the square is shrinked toward its center, leaving an empty border." />
                <param name="border_scale" type="float" value="1" label="Border scale factor" help="The factor by which the border is scaled. The default is 1. It corresponds to a border length of (0.125 * length of the square’s edge)"/>
            </when>
            <when value="macsima">
                <param name="tiff_files" type="data" format="tiff" multiple="true" label="MACSima TIFF images" help="OME-TIFF files from MACSima cyclic imaging experiment"/>
                <param name="subset" type="integer" min="0" optional="true" label="Subset the image to the first ``subset`` pixels in x and y dimensions"/>
                <param name="subset_c" type="integer" min="0" optional="true" label="Subset the image to the first ``c_subset`` channels"/>
                <param name="max_chunk_size" type="integer" min="0" value="1024" label="Maximum chunk size for x and y dimension"/>
                <param name="c_chunks_size" type="integer" min="0" value="1" label="Maximum chunk size for x and y dimension"/>
                <param name="multiscale_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Create multiscale image?"/>
                <param name="transformations_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Whether to add a transformation from pixels to microns to the image"/>
                <param name="scale_factors" type="integer" min="0" optional="true" label="Scale factors to use for downsampling" help="If None, scale factors are calculated based on image size."/>
                <param name="nuclei_channel_name" type="text" value="DAPI" label="Nuclei channel name"/>
                <param name="split_threshold_nuclei_channel" type="integer" min="0" value="2" optional="true" label="Split threshold for nuclei channels" help="If the number of channels that include nuclei_channel_name is greater than this threshold, the nuclei channels are split into a separate stack.."/>
                <param name="include_cycle_in_channel_name_bool" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Include cycle number in channel name?" help="If True, prepend cycle number to channel names (e.g., 'R1 DAPI')"/>
            </when>
            <when value="merscope">
                <param name="slide_name" type="text" value="Galaxy" label="Dataset identifier" help="Prefix used to name the constructed SpatialData elements.">
                    <sanitizer invalid_char="">
                        <valid initial="string.letters,string.digits">
                            <add value="_" />
                        </valid>
                    </sanitizer>
                    <validator type="regex">[0-9a-zA-Z_]+</validator>
                </param>
                <param name="region_name" type="text" value="region" label="Region name" help="Region name appended to the dataset identifier in the MERSCOPE output.">
                    <sanitizer invalid_char="">
                        <valid initial="string.letters,string.digits">
                            <add value="_" />
                        </valid>
                    </sanitizer>
                    <validator type="regex">[0-9a-zA-Z_]+</validator>
                </param>
                <param argument="--z_layers" type="text" value="3" optional="false" label="Comma separated list of Indices of the z-layers to consider" help="By default, only the middle layer is considered (layer 3).">
                    <expand macro="sanitize_digits"/>
                </param>
                <param argument="--mosaic-images" type="data" format="tiff" multiple="true" label="MEROSCOPE tiff images"/>
                <param name="input_micron_to_mosaic" type="data" format="csv" label="Micron to mosaic mapping file"/>
                <param name="cell_by_gene" type="data" format="csv" label="Cell by gene table" help="Cells as rows and Genes as columns"/>
                <param name="cell_meta" type="data" format="csv" label="Cell metadata table"/>
                <param name="cells_boundaries" type="data" format="parquet" label="Cell boundaries (micron_space)"/>
                <param name="transcripts" type="data" format="csv" label="Detected transcripts"/>
                <param name="transcripts_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Load transcripts information?"/>
                <param name="cells_boundaries_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Load cells boundaries?"/>
                <param name="cells_table_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Load cells table?"/>
                <param name="mosaic_images_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Load mosaic images?"/>
            </when>
            <when value="visium">
                <param name="dataset_id" type="text" value="Galaxy" label="Dataset identifier to name the constructed SpatialData elements">
                    <sanitizer invalid_char="">
                        <valid initial="string.letters,string.digits">
                            <add value="_" />
                        </valid>
                    </sanitizer>
                    <validator type="regex">[0-9a-zA-Z_]+</validator>
                </param>
                <param name="feature_bc_matrix" type="data" format="h5" label="feature BC matrix (Counts file)"/>
                <param name="matrix_bool" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Is the matrix input, raw?" help="If the matrix input is raw, set this to true." />
                <param name="scalefactors_json" type="data" format="json" label="Scale factors file"/>
                <param name="fullres_image_file" type="data" format="tiff" label="Full resolution image"/>
                <param name="tissue_hires_image" type="data" format="png" label="Tissue high resolution image"/>
                <param name="tissue_lowres_image" type="data" format="png" label="Tissue low resolution image"/>
                <param name="tissue_positions_list" type="data" format="csv" label="Tissue positions file"/>
            </when>
            <when value="visium_hd">
                <param name="dataset_id" type="text" value="Galaxy" label="Dataset identifier" help="Name for the constructed SpatialData elements">
                    <sanitizer invalid_char="">
                        <valid initial="string.letters,string.digits">
                            <add value="_" />
                        </valid>
                    </sanitizer>
                    <validator type="regex">[0-9a-zA-Z_]+</validator>
                </param>
                <param name="matrix_bool" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Is the matrix input, raw?" help="If the matrix input is raw, set this to true."/>
                <param name="feature_slice" type="data" format="h5" label="Feature slice file"/>
                <conditional name="include_binned_condi">
                    <param name="include_binned" type="select" label="Include binned data?">
                        <option value="yes">Yes</option>
                        <option value="no">No</option>
                    </param>
                    <when value="no"/>
                    <when value="yes">
                        <section name="bin008" title="Binned outputs 008">
                            <param name="feature_bc_matrix_008" type="data" format="h5" optional="true" label="Feature BC matrix of bin 008"/>
                            <param name="tissue_positions_008" type="data" format="parquet" optional="true" label="Tissue positions of bin 008"/>
                            <param name="scalefactors_json_008" type="data" format="json" optional="true" label="Scale factors of bin 008"/>
                        </section>
                        <section name="bin016" title="Binned outputs 016">
                            <param name="feature_bc_matrix_016" type="data" format="h5" optional="true" label="Feature BC matrix of bin 016"/>
                            <param name="tissue_positions_016" type="data" format="parquet" optional="true" label="Tissue positions of bin 016"/>
                            <param name="scalefactors_json_016" type="data" format="json" optional="true" label="Scale factors of bin 016"/>
                        </section>
                        <conditional name="include_nucleus_seg_condi">
                            <param name="include_nucleus_seg" type="select" label="Include nucleus segmentation?">
                                <option value="yes">Yes</option>
                                <option value="no">No</option>
                            </param>
                            <when value="no">
                                <section name="bin002" title="Binned outputs 002">
                                    <param name="feature_bc_matrix_002" type="data" format="h5" optional="true" label="Feature BC matrix of bin 002"/>
                                    <param name="tissue_positions_002" type="data" format="parquet" optional="true" label="Tissue positions of bin 002"/>
                                    <param name="scalefactors_json_002" type="data" format="json" optional="true" label="Scale factors of bin 002"/>
                                </section>
                            </when>
                            <when value="yes">
                                <section name="bin002" title="Binned outputs 002">
                                    <param name="feature_bc_matrix_002" type="data" format="h5" optional="false" label="Feature BC matrix of bin 002"/>
                                    <param name="tissue_positions_002" type="data" format="parquet" optional="false" label="Tissue positions of bin 002"/>
                                    <param name="scalefactors_json_002" type="data" format="json" optional="false" label="Scale factors of bin 002"/>
                                </section>
                                <param name="nucleus_segmentation" type="data" format="geojson" optional="false" label="Nucleus segmentation GeoJSON"/>
                                <param name="barcode_mappings" type="data" format="parquet" optional="false" label="Barcode mappings"/>
                            </when>
                        </conditional>
                    </when>
                </conditional>
                <conditional name="segmentation_conditional">
                    <param name="enable_segmentation" type="select" label="Include segmentation data?">
                        <option value="yes">Yes</option>
                        <option value="no">No</option>
                    </param>
                    <when value="no"/>
                    <when value="yes">
                        <param name="feature_bc_matrix_seg" type="data" format="h5" optional="false" label="Feature BC matrix of cell segmentation"/>
                        <param name="cell_segmentation" type="data" format="geojson" optional="false" label="Cell segmentation GeoJSON"/>
                        <param name="scalefactors_json_seg" type="data" format="json" optional="false" label="Scale factors of cell segmentation"/>
                    </when>
                </conditional>
                <section name="images" title="Images">
                    <param name="microscope_image" type="data" format="png,tiff,jpg" optional="true" label="Microscope image" help="Full-resolution microscope image (png/tiff/jpg)"/>
                    <param name="tissue_hires" type="data" format="png" optional="true" label="Tissue high-res image" help="tissue_hires_image.png"/>
                    <param name="tissue_lowres" type="data" format="png" optional="true" label="Tissue low-res image" help="tissue_lowres_image.png"/>
                    <conditional name="cytassist_image_condi">
                         <param name="include_cytassist" type="select" label="Include CytAssist image?">
                            <option value="yes">Yes</option>
                            <option value="no">No</option>
                        </param>
                        <when value="no"/>
                        <when value="yes">
                            <param name="cytassist_image" type="data" format="tiff" optional="false" label="CytAssist image"/>
                        </when>
                    </conditional>
                </section>
                <param name="bins_as_squares_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Load bins as squares?" help="If True, bins are represented as squares; if False, as circles"/>
                <param name="annotate_table_by_labels_bool" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Annotate table by labels?" help="Annotate the AnnData table with cell/nucleus labels"/>
                <param name="var_names_make_unique_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Make variable names unique?" help="If True, call .var_names_make_unique() on each AnnData table"/>
            </when>
            <when value="xenium">
                <param name="cell_feature_matrix" type="data" format="h5" label="Cell feature matrix"/>
                <param name="cells" type="data" format="parquet" label="Cells metadata"/>
                <param name="cells_zarr" type="data" format="zarr.zip" label="Cells zarr archive"/>
                <param name="experiment_xenium" type="data" format="json" label="Experiment xenium file containing specifications"/>
                <param name="morphology_focus" type="data" format="ome.tiff" multiple="true" label="Morphology focus images" help="Both MIP and Focus"/>
                <param name="cell_boundaries" type="data" optional="true" format="parquet" label="Polygons of cell boundaries"/>
                <param name="nucleus_boundaries" type="data" optional="true" format="parquet" label="Polygons of nucleus boundaries"/>
                <param name="transcripts" type="data" optional="true" format="parquet" label="Transcripts"/>
                <param name="cells_as_circles_bool" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Represent cells as circles?" help="The center and the radius of each circle is computed from the corresponding labels cell"/>
                <param name="cells_labels_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Load cells labels?"/>
                <param name="nucleus_labels_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Load nucleus labels?"/>
                <param name="morphology_mip_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Load morphology MIP?"/>
                <param name="morphology_focus_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Load morphology focus?"/>
                <param name="cells_table_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Load cells annotation from AnnData?"/>
                <param name="gex_only_bool" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Load gene expression only?"/>
                <conditional name="add_hne_condi">
                    <param name="add_hne" type="select" label="Add H&amp;E image?">
                        <option value="yes_accurate">Yes, with accurate alignment</option>
                        <option value="yes">Yes</option>
                        <option value="no" selected="true">No</option>
                    </param>
                    <when value="no"/>
                    <when value="yes_accurate">
                        <param name="hne_image" type="data" format="ome.tiff" label="H&amp;E image"/>
                        <param name="image_alignment" type="data" format="csv" label="Image alignment file"/>
                    </when>
                    <when value="yes">
                        <param name="hne_image" type="data" format="ome.tiff" label="H&amp;E image"/>
                    </when>
                </conditional>
                <conditional name="add_if_condi">
                    <param name="add_if" type="select" label="Add IF image?">
                        <option value="yes_accurate">Yes, with accurate alignment</option>
                        <option value="yes">Yes</option>
                        <option value="no" selected="true">No</option>
                    </param>
                    <when value="no"/>
                    <when value="yes_accurate">
                        <param name="if_image" type="data" format="ome.tiff" label="IF image"/>
                        <param name="image_alignment" type="data" format="csv" label="Image alignment file"/>
                    </when>
                    <when value="yes">
                        <param name="if_image" type="data" format="ome.tiff" label="IF image"/>
                    </when>
                </conditional>
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data name="spatialdata_output" format="spatialdata.zip" from_work_dir="spatialdata.spatialdata.zip" label="${tool.name} on ${on_string}: spatialdata"/>
    </outputs>
    <tests>
        <!-- test 1: io MERSCOPE full -->
        <test>
            <conditional name="method_condi">
                <param name="method" value="merscope"/>
                <param name="slide_name" value="Test_MERSCOPE"/>
                <param name="region_name" value="sample_region"/>
                <param name="mosaic_images" location="https://zenodo.org/records/18746346/files/mosaic_Cellbound1_z2.tif,https://zenodo.org/records/18746346/files/mosaic_Cellbound1_z3.tif,https://zenodo.org/records/18746346/files/mosaic_Cellbound2_z2.tif,https://zenodo.org/records/18746346/files/mosaic_Cellbound2_z3.tif,https://zenodo.org/records/18746346/files/mosaic_Cellbound3_z2.tif,https://zenodo.org/records/18746346/files/mosaic_Cellbound3_z3.tif,https://zenodo.org/records/18746346/files/mosaic_DAPI_z2.tif,https://zenodo.org/records/18746346/files/mosaic_DAPI_z3.tif,https://zenodo.org/records/18746346/files/mosaic_PolyT_z2.tif,https://zenodo.org/records/18746346/files/mosaic_PolyT_z3.tif"/>
                <param name="z_layers" value="3"/>
                <param name="input_micron_to_mosaic" location="https://zenodo.org/records/18746346/files/merscope_micron_to_mosaic_pixel_transform.csv"/>
                <param name="cell_by_gene" location="https://zenodo.org/records/18746346/files/merscope_cell_by_gene.csv"/>
                <param name="cell_meta" location="https://zenodo.org/records/18746346/files/merscope_cell_metadata.csv"/>
                <param name="cells_boundaries" location="https://zenodo.org/records/18746346/files/merscope_cellpose2_micron_space.parquet"/>
                <param name="transcripts" location="https://zenodo.org/records/18746346/files/merscope_detected_transcripts.csv"/>
            </conditional>
            <assert_stdout>
                <has_text text="z_layers=[3]"/>
                <has_text text="&apos;Test_MERSCOPE_sample_region_polygons&apos;: GeoDataFrame shape: (928, 9)"/>
                <has_text text="&apos;table&apos;: AnnData (928, 130)"/>
            </assert_stdout>
            <output name="spatialdata_output">
                <assert_contents>
                    <has_archive_member path="spatialdata/zarr.json">
                        <has_text text="&quot;zarr_format&quot;: 3"/>
                        <has_text text="&quot;label&quot;: &quot;DAPI&quot;"/>
                    </has_archive_member>
                </assert_contents>
            </output>
        </test>
        <!-- test 2: io COSMX full -->
        <test>
            <conditional name="method_condi">
                <param name="method" value="cosmx"/>
                <param name="CellComposite" location="https://zenodo.org/records/18746346/files/cosmx_CellComposite_F001.jpg"/>
                <param name="CellLabels" location="https://zenodo.org/records/18746346/files/cosmx_CellLabels_F001.tif"/>
                <param name="exprMat_file" location="https://zenodo.org/records/18746346/files/cosmx_dummy_exprMat_file.csv"/>
                <param name="fov_positions_file" location="https://zenodo.org/records/18746346/files/cosmx_dummy_fov_positions_file.csv"/>
                <param name="metadata_file" location="https://zenodo.org/records/18746346/files/cosmx_dummy_metadata_file.csv"/>
                <param name="tx_file" location="https://zenodo.org/records/18746346/files/cosmx_dummy_tx_file.csv"/>
                <param name="dataset_id" value="cosmx_dummy"/>
                <param name="transcripts_bool" value="True"/>
            </conditional>
            <output name="spatialdata_output">
                <assert_contents>
                    <has_archive_member path="spatialdata/zarr.json">
                        <has_text text="&quot;zarr_format&quot;: 3"/>
                        <has_text text="images/1_image"/>
                    </has_archive_member>
                </assert_contents>
            </output>
        </test>
        <!-- test 3: io dbit full-->
        <test>
            <conditional name="method_condi">
                <param name="method" value="dbit"/>
                <param name="barcode_positions" location="https://zenodo.org/records/18746346/files/dbit_barcode_positions.txt"/>
                <param name="counts" location="https://zenodo.org/records/18746346/files/dbit_counts.h5ad"/>
                <param name="tissue_lowres" location="https://zenodo.org/records/18746346/files/dbit_tissue_lowres.png"/>
            </conditional>
            <assert_stdout>
                <has_text text="&apos;Galaxy&apos;: GeoDataFrame shape: (500, 1) (2D shapes)"/>
                <has_text text="&apos;table&apos;: AnnData (500, 1000)"/>
            </assert_stdout>
            <output name="spatialdata_output">
                <assert_contents>
                    <has_archive_member path="spatialdata/zarr.json">
                        <has_text text="&quot;zarr_format&quot;: 3"/>
                        <has_text text="images/Galaxy_image"/>
                    </has_archive_member>
                </assert_contents>
            </output>
        </test>
        <!-- test 4: io macsima full-->
        <test>
            <conditional name="method_condi">
                <param name="method" value="macsima"/>
                <param name="tiff_files" location="https://zenodo.org/records/18746346/files/macima_C-001_S-000_S_APC_R-01_W-D01_ROI-01_A-CD3_C-REA1151.tif,https://zenodo.org/records/18746346/files/macima_C-002_S-000_S_PE_R-01_W-D01_ROI-01_A-CD279_C-REA1165.tif,https://zenodo.org/records/18746346/files/macima_C-015_S-000_B_DAPI_R-01_W-D01_ROI-01_A-DAPI.tif,https://zenodo.org/records/18746346/files/macima_C-001_S-000_S_DAPI_R-01_W-D01_ROI-01_A-DAPI.tif,https://zenodo.org/records/18746346/files/macima_C-004_S-000_S_FITC_R-01_W-D01_ROI-01_A-CD66b_C-REA306.tif"/>
            </conditional>
            <assert_stdout>
                <has_text text="&apos;input_image&apos;: DataTree"/>
                <has_text text="&apos;input_table&apos;: AnnData (0, 5)"/>
            </assert_stdout>
            <output name="spatialdata_output">
                <assert_contents>
                    <has_archive_member path="spatialdata/zarr.json">
                        <has_text text="&quot;zarr_format&quot;: 3"/>
                        <has_text text="images/input_image"/>
                    </has_archive_member>
                </assert_contents>
            </output>
        </test>
        <!-- test 5: io VISIUM full -->
        <test>
            <conditional name="method_condi">
                <param name="method" value="visium"/>
                <param name="dataset_id" value="Test_Visium"/>
                <param name="feature_bc_matrix" location="https://zenodo.org/records/18746346/files/visium_CytAssist_FFPE_Protein_Expression_Human_Tonsil_filtered_feature_bc_matrix.h5"/>
                <param name="matrix_bool" value="false"/>
                <param name="scalefactors_json" location="https://zenodo.org/records/18746346/files/visium_scalefactors_json.json"/>
                <param name="fullres_image_file" location="https://zenodo.org/records/18746346/files/visium_CytAssist_FFPE_Protein_Expression_Human_Tonsil_image.tif"/>
                <param name="tissue_hires_image" location="https://zenodo.org/records/18746346/files/visium_tissue_hires_image.png"/>
                <param name="tissue_lowres_image" location="https://zenodo.org/records/18746346/files/visium_tissue_lowres_image.png"/>
                <param name="tissue_positions_list" location="https://zenodo.org/records/18746346/files/visium_tissue_positions.csv"/>
            </conditional>
            <assert_stdout>
                <has_text text="&apos;Test_Visium&apos;: GeoDataFrame shape: (4194, 2)"/>
                <has_text text="&apos;table&apos;: AnnData (4194, 18085)"/>
            </assert_stdout>
            <output name="spatialdata_output">
                <assert_contents>
                    <has_archive_member path="spatialdata/zarr.json">
                        <has_text text="&quot;zarr_format&quot;: 3"/>
                        <has_text text="images/Test_Visium_full_image"/>
                    </has_archive_member>
                </assert_contents>
            </output>
        </test>
        <!-- test 6: io Visium HD full -->
        <test>
            <conditional name="method_condi">
                <param name="method" value="visium_hd"/>
                <param name="dataset_id" value="Test_VisiumHD"/>
                <param name="matrix_bool" value="false"/>
                <param name="feature_slice" location="https://zenodo.org/records/18746346/files/visiumhd_feature_slice.h5"/>
                <conditional name="include_binned_condi">
                    <param name="include_binned" value="yes"/>
                    <section name="bin008">
                        <param name="feature_bc_matrix_008" location="https://zenodo.org/records/18746346/files/visiumhd_filtered_feature_bc_matrix_008.h5"/>
                        <param name="tissue_positions_008" location="https://zenodo.org/records/18746346/files/visiumhd_tissue_positions_008.parquet"/>
                        <param name="scalefactors_json_008" location="https://zenodo.org/records/18746346/files/visiumhd_scalefactors_json_008.json"/>
                    </section>
                    <section name="bin016">
                        <param name="feature_bc_matrix_016" location="https://zenodo.org/records/18746346/files/visiumhd_filtered_feature_bc_matrix_016.h5"/>
                        <param name="tissue_positions_016" location="https://zenodo.org/records/18746346/files/visiumhd_tissue_positions_016.parquet"/>
                        <param name="scalefactors_json_016" location="https://zenodo.org/records/18746346/files/visiumhd_scalefactors_json_016.json"/>
                    </section>
                    <conditional name="include_nucleus_seg_condi">
                        <param name="include_nucleus_seg" value="yes"/>
                        <section name="bin002">
                            <param name="feature_bc_matrix_002" location="https://zenodo.org/records/18746346/files/visiumhd_filtered_feature_bc_matrix_002.h5"/>
                            <param name="tissue_positions_002" location="https://zenodo.org/records/18746346/files/visiumhd_tissue_positions_002.parquet"/>
                            <param name="scalefactors_json_002" location="https://zenodo.org/records/18746346/files/visiumhd_scalefactors_json_002.json"/>
                        </section>
                        <param name="nucleus_segmentation" location="https://zenodo.org/records/18746346/files/visiumhd_nucleus_segmentations.geojson"/>
                        <param name="barcode_mappings" location="https://zenodo.org/records/18746346/files/visiumhd_barcode_mappings.parquet"/>
                    </conditional>
                </conditional>
                <conditional name="segmentation_conditional">
                    <param name="enable_segmentation" value="yes"/>
                    <param name="feature_bc_matrix_seg" location="https://zenodo.org/records/18746346/files/visiumhd_filtered_feature_cell_matrix_seg.h5"/>
                    <param name="cell_segmentation" location="https://zenodo.org/records/18746346/files/visiumhd_cell_segmentations.geojson"/>
                    <param name="scalefactors_json_seg" location="https://zenodo.org/records/18746346/files/visiumhd_scalefactors_json_seg.json"/>
                </conditional>
                <section name="images">
                    <param name="tissue_hires" location="https://zenodo.org/records/18746346/files/visiumhd_tissue_hires_image.png"/>
                    <param name="tissue_lowres" location="https://zenodo.org/records/18746346/files/visiumhd_tissue_lowres_image.png"/>
                    <conditional name="cytassist_image_condi">
                        <param name="include_cytassist" value="yes"/>
                        <param name="cytassist_image" location="https://zenodo.org/records/18746346/files/visiumhd_cytassist_image.tiff"/>
                    </conditional>
                </section>
                <param name="bins_as_squares_bool" value="true"/>
                <param name="annotate_table_by_labels_bool" value="false"/>
                <param name="var_names_make_unique_bool" value="true"/>
            </conditional>
            <assert_stdout>
                <has_text text="&apos;Test_VisiumHD"/>
                <has_text text="Tables"/>
                <has_text text="&apos;cell_segmentations&apos;: AnnData"/>
            </assert_stdout>
            <output name="spatialdata_output">
                <assert_contents>
                    <has_archive_member path="spatialdata/zarr.json">
                        <has_text text="&quot;zarr_format&quot;: 3"/>
                    </has_archive_member>
                </assert_contents>
            </output>
        </test>
         <!-- test 7: io XENIUM full -->
        <test>
            <conditional name="method_condi">
                <param name="method" value="xenium"/>
                <param name="cell_feature_matrix" location="https://zenodo.org/records/18746346/files/xenium_cell_feature_matrix.h5"/>
                <param name="cells" location="https://zenodo.org/records/18746346/files/xenium_cells.parquet"/>
                <param name="cells_zarr" location="https://zenodo.org/records/18746346/files/xenium_cells.zarr.zip"/>
                <param name="experiment_xenium" location="https://zenodo.org/records/18746346/files/xenium_experiment.xenium"/>
                <param name="morphology_focus" location="https://zenodo.org/records/18746346/files/ch0000_dapi.ome.tif,https://zenodo.org/records/18746346/files/ch0006_yellow_background.ome.tif,https://zenodo.org/records/18746346/files/ch0001_atp1a1_cd45_e-cadherin.ome.tif,https://zenodo.org/records/18746346/files/ch0007_red_background.ome.tif,https://zenodo.org/records/18746346/files/ch0002_18s.ome.tif,https://zenodo.org/records/18746346/files/ch0008_pd-1.ome.tif,https://zenodo.org/records/18746346/files/ch0003_alphasma_vimentin.ome.tif,https://zenodo.org/records/18746346/files/ch0009_vista.ome.tif,https://zenodo.org/records/18746346/files/ch0004_blue_background.ome.tif,https://zenodo.org/records/18746346/files/ch0010_pd-l1.ome.tif,https://zenodo.org/records/18746346/files/ch0005_green_background.ome.tif,https://zenodo.org/records/18746346/files/ch0011_lag-3.ome.tif"/>
                <param name="cell_boundaries" location="https://zenodo.org/records/18746346/files/xenium_cell_boundaries.parquet"/>
                <param name="nucleus_boundaries" location="https://zenodo.org/records/18746346/files/xenium_nucleus_boundaries.parquet"/>
                <param name="transcripts" location="https://zenodo.org/records/18746346/files/xenium_transcripts.parquet"/>
                <conditional name="add_hne_condi">
                    <param name="add_hne" value="yes"/>
                    <param name="hne_image" location="https://zenodo.org/records/18746346/files/xenium_he_image.ome.tif"/>
                </conditional>
            </conditional>
            <assert_stdout>
                <has_text text="&apos;cell_labels&apos;: DataTree"/>
                <has_text text="&apos;table&apos;: AnnData (358, 405)"/>
            </assert_stdout>
            <output name="spatialdata_output">
                <assert_contents>
                    <has_archive_member path="spatialdata/zarr.json">
                        <has_text text="&quot;zarr_format&quot;: 3"/>
                        <has_text text="images/morphology_focus"/>
                    </has_archive_member>
                </assert_contents>
            </output>
        </test>
         <!-- test 8: io XENIUM full accurate-->
        <test>
            <conditional name="method_condi">
                <param name="method" value="xenium"/>
                <param name="cell_feature_matrix" location="https://zenodo.org/records/18746346/files/xenium_cell_feature_matrix.h5"/>
                <param name="cells" location="https://zenodo.org/records/18746346/files/xenium_cells.parquet"/>
                <param name="cells_zarr" location="https://zenodo.org/records/18746346/files/xenium_cells.zarr.zip"/>
                <param name="experiment_xenium" location="https://zenodo.org/records/18746346/files/xenium_experiment.xenium"/>
                <param name="morphology_focus" location="https://zenodo.org/records/18746346/files/ch0000_dapi.ome.tif,https://zenodo.org/records/18746346/files/ch0006_yellow_background.ome.tif,https://zenodo.org/records/18746346/files/ch0001_atp1a1_cd45_e-cadherin.ome.tif,https://zenodo.org/records/18746346/files/ch0007_red_background.ome.tif,https://zenodo.org/records/18746346/files/ch0002_18s.ome.tif,https://zenodo.org/records/18746346/files/ch0008_pd-1.ome.tif,https://zenodo.org/records/18746346/files/ch0003_alphasma_vimentin.ome.tif,https://zenodo.org/records/18746346/files/ch0009_vista.ome.tif,https://zenodo.org/records/18746346/files/ch0004_blue_background.ome.tif,https://zenodo.org/records/18746346/files/ch0010_pd-l1.ome.tif,https://zenodo.org/records/18746346/files/ch0005_green_background.ome.tif,https://zenodo.org/records/18746346/files/ch0011_lag-3.ome.tif"/>
                <param name="cell_boundaries" location="https://zenodo.org/records/18746346/files/xenium_cell_boundaries.parquet"/>
                <param name="nucleus_boundaries" location="https://zenodo.org/records/18746346/files/xenium_nucleus_boundaries.parquet"/>
                <param name="transcripts" location="https://zenodo.org/records/18746346/files/xenium_transcripts.parquet"/>
                <conditional name="add_hne_condi">
                    <param name="add_hne" value="yes_accurate"/>
                    <param name="hne_image" location="https://zenodo.org/records/18746346/files/xenium_he_image.ome.tif"/>
                    <param name="image_alignment" location="https://zenodo.org/records/18746346/files/xenium_he_image_alignment.csv"/>
                </conditional>
            </conditional>
            <assert_stdout>
                <has_text text="&apos;cell_labels&apos;: DataTree"/>
                <has_text text="&apos;table&apos;: AnnData (358, 405)"/>
                <has_text text="xenium_aligned_image"/>
            </assert_stdout>
            <output name="spatialdata_output">
                <assert_contents>
                    <has_archive_member path="spatialdata/zarr.json">
                        <has_text text="&quot;zarr_format&quot;: 3"/>
                        <has_text text="images/morphology_focus"/>
                    </has_archive_member>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
**What it does**

This tool loads common spatial omics data formats into the SpatialData framework, a unified data structure for spatial omics data. It supports multiple spatial transcriptomics and proteomics technologies, converting their native output formats into a standardized SpatialData object stored as a Zarr archive.

-----

**Supported Technologies**

- **10x Genomics Visium**: Standard Visium spatial gene expression data
- **10x Genomics Visium HD**: High-definition Visium with multiple bin sizes and segmentation data
- **10x Genomics Xenium**: In situ spatial transcriptomics with subcellular resolution
- **CosMx SMI (Nanostring)**: Spatial molecular imaging platform
- **MERSCOPE (Vizgen)**: Multiplexed error-robust fluorescence in situ hybridization
- **MACSima (Miltenyi)**: Multiplexed antibody-based imaging for cyclic staining
- **DBiT-seq**: Deterministic Barcoding in Tissue for spatial omics

-----

**Output**

The tool produces a SpatialData object saved as a compressed Zarr archive (.spatialdata.zip). This archive contains:

- **Images**: H&E, staining images
- **Labels**: Pixel-level segmentation
- **Shapes**: Cell/nucleus boundaries, subcellular structures, anatomical annotations, regions of interest (ROIs)
- **Points**: Transcripts locations with gene information, landmarks points
- **Tables**: AnnData objects with gene expression matrices and metadata

The SpatialData format enables downstream analysis with tools like squidpy, spatialdata-plot, and napari for interactive visualization.

-----

**More Information**

- `SpatialData documentation <https://spatialdata.scverse.org/projects/io/en/stable/>`__


    ]]></help>
    <expand macro="citations" />
</tool>