changeset 0:be0e7952e229 draft

planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/squidpy commit ee16860018eba110ff845d62b18396db22abd91e
author goeckslab
date Mon, 29 Aug 2022 23:20:54 +0000
parents
children bad34051dc8a
files main_macros.xml squidpy_spatial.py squidpy_spatial.xml test-data/imc.h5ad test-data/imc_centrality_scores.png test-data/imc_co_occurrence.png test-data/imc_interaction_matrix.png test-data/imc_kmeans.h5ad test-data/imc_nhood_enrichment.png test-data/imc_ripley.png test-data/imc_sn.h5ad
diffstat 11 files changed, 520 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main_macros.xml	Mon Aug 29 23:20:54 2022 +0000
@@ -0,0 +1,64 @@
+<macros>
+    <token name="@TOOL_VERSION@">1.1.2</token>
+    <token name="@PROFILE@">20.01</token>
+    <token name="@VERSION_SUFFIX@">0</token> 
+
+    <xml name="macro_stdio">
+        <stdio>
+            <exit_code range="1:" level="fatal" description="Error occurred. Please check Tool Standard Error" />
+        </stdio>
+    </xml>
+
+    <xml name="squidpy_requirements">
+        <requirements>
+            <container type="docker">quay.io/goeckslab/squidpy:@TOOL_VERSION@</container>
+        </requirements>
+    </xml>
+
+    <xml name="citations">
+        <citations>
+            <citation type="doi">10.1038/s41592-021-01358-2</citation>
+        </citations>
+    </xml>
+
+    <xml name="squidpy_spatial_options">
+        <section name="options" title="Advanced Graph Options" expanded="false">
+            <yield/>
+             <!-- <param argument="copy" type="hidden" value="false" help="If True, return the result, otherwise save it to the adata object." /> -->
+        </section>
+    </xml>
+
+    <xml name="squidpy_plotting_options">
+        <section name="plotting_options" title="Plotting Options" expanded="false">
+            <yield />
+            <!-- <param argument="legend_kwargs" type="text" value="" optional="true" label="Keyword arguments for matplotlib.pyplot.legend()" /> -->
+            <param argument="figsize" type="text" value="" optional="true" label="Size of the figure in inches" help="Optional. e.g.: (12, 12)." />
+            <param argument="dpi" type="integer" value="" optional="true" label="Dots per inch" help="Optional" />
+        </section>
+    </xml>
+
+    <xml name="squidpy_plotting_option_palette">
+        <param argument="palette" type="text" value="" optional="true" label="Categorical colormap for the clusters" help="Comma delimited for multiple. If None, use anndata.AnnData.uns ['{cluster_key}_colors'], if available." />
+    </xml>
+
+    <xml name="squidpy_plotting_options_more">
+        <expand macro="squidpy_plotting_options">
+            <yield />
+            <param argument="annotate" type="boolean" checked="false" label="Whether to annotate the cells of the heatmap?" />
+            <param argument="method" type="select" label="The linkage method to be used for dendrogram/clustering" help="see scipy.cluster.hierarchy.linkage().">
+                <option value="none" selected="true">None</option>
+                <option value="single">single</option>
+                <option value="complete">complete</option>
+                <option value="average">average</option>
+                <option value="weighted">weighted</option>
+                <option value="centroid">centroid</option>
+                <option value="median">median</option>
+                <option value="ward">ward</option>
+            </param>
+            <param argument="title" type="text" value="" optional="true" label="The title of the plot" help="Optional." />
+            <param argument="cmap" type="text" value="viridis" label="Continuous colormap to use" help="Refer to `matplotlib.pyplot.cmap`." />
+            <!-- <param argument="cbar_kwargs" type="text" value="" label="Keyword arguments for matplotlib.figure.Figure.colorbar()" /> -->
+            <expand macro="squidpy_plotting_option_palette" />
+        </expand>
+    </xml>
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/squidpy_spatial.py	Mon Aug 29 23:20:54 2022 +0000
@@ -0,0 +1,110 @@
+import argparse
+import ast
+import json
+import warnings
+
+import pandas as pd
+import squidpy as sq
+from anndata import read_h5ad
+
+
+def main(inputs, anndata, output, output_plot):
+    """
+    Parameter
+    ---------
+    inputs : str
+        File path to galaxy tool parameter.
+    anndata : str
+        File path to anndata containing phenotyping info.
+    output : str
+        File path to output.
+    output_plot: str or None
+        File path to save the plotting image.
+    """
+    warnings.simplefilter('ignore')
+
+    with open(inputs, 'r') as param_handler:
+        params = json.load(param_handler)
+
+    adata = read_h5ad(anndata)
+
+    if 'spatial' not in adata.obsm:
+        try:
+            adata.obsm['spatial'] = adata.obs[['X_centroid', 'Y_centroid']].values
+        except Exception as e:
+            print(e)
+
+    tool = params['analyses']['selected_tool']
+    tool_func = getattr(sq.gr, tool)
+
+    options = params['analyses']['options']
+
+    for k, v in options.items():
+        if not isinstance(v, str):
+            continue
+
+        if v in ('', 'none'):
+            options[k] = None
+            continue
+
+        if k == 'genes':    # for spatial_autocorr and sepal
+            options[k] = [e.strip() for e in v.split(',')]
+        elif k == 'radius':    # for spatial_neighbors
+            options[k] = ast.literal_eval(v)
+        elif k == 'numba_parallel':    # for nhood_enrichment and ligrec
+            if v == 'false':
+                options[k] = False
+            elif v == 'true':
+                options[k] = True
+        elif k == 'interactions':    # for ligrec
+            options[k] = pd.read_csv(v, sep="\t")
+        elif k == 'max_neighs':
+            options[k] = int(v)      # for sepal
+
+    cluster_key = params['analyses'].get('cluster_key')
+    if cluster_key:
+        tool_func(adata, cluster_key, **options)
+    else:
+        tool_func(adata, **options)
+
+    if output_plot:
+        plotting_options = params['analyses']['plotting_options']
+        for k, v in plotting_options.items():
+            if not isinstance(v, str):
+                continue
+
+            if v in ('', 'none'):
+                plotting_options[k] = None
+                continue
+
+            if k == 'figsize':
+                options[k] = ast.literal_eval(v)
+            elif k in ('palette', 'score', 'source_groups', 'target_groups'):
+                options[k] = [e.strip() for e in v.split(',')]
+            elif k == 'means_range':        # ligrec
+                v = v.strip()
+                if v[0] == '(':
+                    v = v[1:]
+                if v[-1] == ')':
+                    v = v[:-1]
+                options[k] = tuple([float(e.strip()) for e in v.split(',', 1)])
+
+        plotting_func = getattr(sq.pl, tool)
+        if cluster_key:
+            plotting_func(adata, cluster_key, save=output_plot, **plotting_options)
+        else:       # TODO Remove this, since all plottings need cluster key
+            plotting_func(adata, save=output_plot, **plotting_options)
+
+    adata.write(output)
+
+
+if __name__ == '__main__':
+    aparser = argparse.ArgumentParser()
+    aparser.add_argument("-i", "--inputs", dest="inputs", required=True)
+    aparser.add_argument("-e", "--output", dest="output", required=True)
+    aparser.add_argument("-a", "--anndata", dest="anndata", required=True)
+    aparser.add_argument("-p", "--output_plot", dest="output_plot", required=False)
+
+    args = aparser.parse_args()
+
+    main(args.inputs, args.anndata, args.output, args.output_plot)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/squidpy_spatial.xml	Mon Aug 29 23:20:54 2022 +0000
@@ -0,0 +1,346 @@
+<tool id="squidpy_spatial" name="Squidpy Graph and Plotting" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
+    <description>for spatial analysis </description>
+    <macros>
+        <import>main_macros.xml</import>
+    </macros>
+    <expand macro="squidpy_requirements"/>
+    <expand macro="macro_stdio" />
+    <version_command>echo "@TOOL_VERSION@"</version_command>
+    <command>
+        <![CDATA[
+        python '$__tool_directory__/squidpy_spatial.py'
+            --inputs '$inputs'
+            --anndata '$anndata'
+            --output '$output'
+            #if $analyses.selected_tool in ['nhood_enrichment', 'centrality_scores', 'interaction_matrix', 'ligrec', 'ripley', 'co_occurrence']:
+            --output_plot "`pwd`/image.png"
+            #end if
+
+        ]]>
+    </command>
+    <configfiles>
+        <inputs name="inputs" data_style="paths"/>
+    </configfiles>
+    <inputs>
+        <param name="anndata" type="data" format="h5ad" label="Select the input anndata" />
+        <conditional name="analyses">
+            <param name="selected_tool" type="select" label="Select an analysis">
+                <option value="spatial_neighbors" selected="true">Spatial neighbors -- Create a graph from spatial coordinates</option>
+                <option value="nhood_enrichment">nhood_enrichment -- Compute neighborhood enrichment by permutation test.</option>
+                <option value="co_occurrence" >co_occurrence -- Compute co-occurrence probability of clusters</option>
+                <option value="centrality_scores">centrality_scores -- Compute centrality scores per cluster or cell type</option>
+                <option value="interaction_matrix">interaction_matrix -- Compute interaction matrix for clusters</option>
+                <option value="ripley">ripley -- Calculate various Ripley’s statistics for point processes</option>
+                <option value="ligrec">ligrec -- Perform the permutation test as described in [Efremova et al., 2020]</option>
+                <option value="spatial_autocorr">spatial_autocorr -- Calculate Global Autocorrelation Statistic (Moran’s I or Geary’s C)</option>
+                <option value="sepal">sepal -- Identify spatially variable genes with Sepal</option>
+            </param>
+            <when value="spatial_neighbors">
+                <expand macro="squidpy_spatial_options">
+                    <param argument="spatial_key" type="text" value="spatial" optional="false" label="The Key where spatial coordinates are stored" help="Key in `anndata.AnnData.obsm`." />
+                    <param argument="coord_type" type="select" label="Type of coordinate system">
+                        <option value="grid" selected="true">grid</option>
+                        <option value="generic">generic</option>
+                        <option value="none">None - use `grid` when `spatial_key` is in `anndata.AnnData.uns with `n_neighs` = 6 (Visium), otherwise `generic`</option>
+                    </param>
+                    <param argument="n_neighs" type="integer" value="6" label="Number of neighboring tiles" help="When the `coord_type` is generic, this's number of neighborhoods for non-grid data and only used when `delaunay` is False." />
+                    <param argument="radius" type="text" value="" optional="true" label="Radius" help="Only available when coord_type = 'generic'. If float, this is the neighborhood radius to compute the graph; if tuple, this is edge range [min(radius), max(radius)] used prune the final graph." />
+                    <param argument="delaunay" type="boolean" checked="false" optional="true" label="Whether to compute the graph from Delaunay triangulation" help="Only used when coord_type = 'generic'." />
+                    <param argument="n_rings" type="integer" value="1" label="Number of rings of neighbors for grid data" help="Only used when coord_type = 'grid'." />
+                    <param argument="transform" type="select" label="Type of adjacency matrix transform">
+                        <option value="none" selected="true">None</option>
+                        <option value="spectral">spectral</option>
+                        <option value="cosine">cosine</option>
+                    </param>
+                    <param argument="set_diag" type="boolean" checked="false" label="Whether to set the diagonal of the spatial connectivities to 1.0" />
+                    <param argument="key_added" type="text" value="spatial" label="The column name used in anndata to store the returned data" />
+                </expand>
+            </when>
+            <when value="nhood_enrichment">
+                <param argument="cluster_key" type="text" value="" optional="false" label="Key in anndata.AnnData.obs where clustering is stored" />
+                <expand macro="squidpy_spatial_options">
+                    <param argument="connectivity_key" type="text" value="" optional="true" label="Key in anndata.AnnData.obsp where spatial connectivities are stored" />
+                    <param argument="n_perms" type="integer" value="1000" label="Number of permutations for the permutation test" />
+                    <param argument="numba_parallel" type="select" label="Whether to use numba.prange or not">
+                        <option value="false" selected="true">No -- Recommended for small datasets or small number of interactions</option>
+                        <option value="true">Yes</option>
+                        <option value="none">Auto</option>
+                    </param>
+                    <param argument="seed" type="integer" value="" optional="true" label="Randomness seed" />
+                </expand>
+                <expand macro="squidpy_plotting_options_more">
+                    <param argument="mode" type="select" label="Choose one result from gr.nhood_enrichment to plot">
+                        <option value="zscore" selected="true">zscore</option>
+                        <option value="count">count</option>
+                    </param>
+                </expand>
+            </when>
+            <when value="co_occurrence">
+                <param argument="cluster_key" type="text" value="" optional="false" label="Key in anndata.AnnData.obs where clustering is stored" />
+                <expand macro="squidpy_spatial_options">
+                    <param argument="spatial_key" type="text" value="spatial" optional="false" label="The Key where spatial coordinates are stored" help="Key in `anndata.AnnData.obsm`." />
+                    <param argument="n_steps" type="integer" value="50" label="Number of distance thresholds at which co-occurrence is computed" />
+                    <param argument="n_splits" type="integer" value="" optional="true" label="Number of splits in which to divide the spatial coordinates" help="In anndata.AnnData.obsm ['{spatial_key}']." />
+                </expand>
+                <expand macro="squidpy_plotting_options">
+                    <expand macro="squidpy_plotting_option_palette" />
+                </expand>
+            </when>
+            <when value="centrality_scores">
+                <param argument="cluster_key" type="text" value="" optional="false" label="Key in anndata.AnnData.obs where clustering is stored" />
+                <expand macro="squidpy_spatial_options">
+                    <param argument="score" type="select" label="Centrality measures as described in networkx.algorithms.centrality" help="Refer to [Hagberg et al., 2008]." >
+                        <option value="none" selected="true">None</option>
+                        <option value="closeness_centrality">closeness_centrality -- measure of how close the group is to other nodes</option>
+                        <option value="average_clustering">average_clustering -- measure of the degree to which nodes cluster together</option>
+                        <option value="degree_centrality">degree_centrality -- fraction of non-group members connected to group members</option>
+                    </param>
+                    <param argument="connectivity_key" type="text" value="" optional="true" label="Key in anndata.AnnData.obsp where spatial connectivities are stored" />
+                </expand>
+                <expand macro="squidpy_plotting_options">
+                    <param argument="score" type="text" value="" optional="true" label="The scores to plot" help="Comma delimited for multiple. If None, plot all scores." />
+                    <expand macro="squidpy_plotting_option_palette" />
+                </expand>
+            </when>
+            <when value="interaction_matrix">
+                <param argument="cluster_key" type="text" value="" optional="false" label="Key in anndata.AnnData.obs where clustering is stored" />
+                <expand macro="squidpy_spatial_options">
+                    <param argument="connectivity_key" type="text" value="" optional="true" label="Key in anndata.AnnData.obsp where spatial connectivities are stored" />
+                    <param argument="normalized" type="boolean" checked="false" label="Whether to normalize the sum of each row to 1" />
+                    <param argument="weights" type="boolean" checked="false" label="Whether to use edge weights or binarize" />
+                </expand>
+                <expand macro="squidpy_plotting_options_more"/>
+            </when>
+            <when value="ripley">
+                <param argument="cluster_key" type="text" value="" optional="false" label="Key in anndata.AnnData.obs where clustering is stored" />
+                <expand macro="squidpy_spatial_options">
+                    <param argument="mode" type="select" label="Which Ripley’s statistic to compute">
+                        <option value="F" selected="true">F</option>
+                        <option value="G">G</option>
+                        <option value="L">L</option>
+                    </param>
+                    <param argument="spatial_key" type="text" value="spatial" optional="false" label="The Key where spatial coordinates are stored" help="Key in `anndata.AnnData.obsm`." />
+                    <param argument="metric" type="select" label="Which metric to use for computing distances" help="Refer to `sklearn.neighbors.DistanceMetric`." >
+                        <option value="euclidean" selected="true">euclidean</option>
+                        <option value="manhattan">manhattan</option>
+                        <option value="chebyshev">chebyshev</option>
+                        <option value="minkowski">minkowski</option>
+                        <option value="wminkowski">wminkowski</option>
+                        <option value="seuclidean">seuclidean</option>
+                        <option value="mahalanobis">mahalanobis</option>
+                        <option value="haversine">haversine</option>
+                        <option value="hamming">hamming</option>
+                        <option value="canberra">canberra</option>
+                        <option value="braycurtis">braycurtis</option>
+                    </param>
+                    <param argument="n_neigh" type="integer" value="2" label="Number of neighbors to consider for the KNN graph" />
+                    <param argument="n_simulations" type="integer" value="100" label="Number of simulations to run for computing p-values" />
+                    <param argument="n_observations" type="integer" value="1000" label="Number of observations to generate for the Spatial Poisson Point Process" />
+                    <param argument="max_dist" type="float" value="" optional="true" label="Maximum distances for the support" help="If None, max_dist is the square root of area/2."/>
+                    <param argument="n_steps" type="integer" value="50" label="Number of steps for the support" />
+                    <param argument="seed" type="integer" value="" optional="true" label="Randomness seed" />
+                </expand>
+                <expand macro="squidpy_plotting_options">
+                    <param argument="mode" type="select" label="Ripley’s statistics to be plotted">
+                        <option value="F" selected="true">F</option>
+                        <option value="G">G</option>
+                        <option value="L">L</option>
+                    </param>
+                    <param argument="plot_sims" type="boolean" checked="true" label="Whether to overlay simulations in the plot" />
+                    <expand macro="squidpy_plotting_option_palette" />
+                </expand>
+            </when>
+            <when value="ligrec">
+                <param argument="cluster_key" type="text" value="" optional="false" label="Key in anndata.AnnData.obs where clustering is stored" />
+                <expand macro="squidpy_spatial_options">
+                    <param argument="use_raw" type="boolean" checked="true" label="Whether to access anndata.AnnData.raw" />
+                    <param argument="interactions" type="data" format="tabular" optional="true" label="Select the dataset containing interaction to test" help="Must contain at least 2 columns named ‘source’ and ‘target’. Can be null, a condition under which the interactions are extracted from omnipath." />
+                    <param argument="complex_policy" type="select" label="Policy on how to handle complexes">
+                        <option value="min" selected="true">min -- select gene with the minimum average expression</option>
+                        <option value="all">all --  select all possible combinations between ‘source’ and ‘target’ complexes</option>
+                    </param>
+                    <param argument="n_perms" type="integer" value="" optional="true" label="Number of permutations for the permutation test." />
+                    <param argument="threshold" type="float" value="0.01" label="Do not perform permutation test if any of the interacting components is being expressed in less than threshold percent of cells within a given cluster" />
+                    <param argument="corr_method" type="select" label="Correction method for multiple testing">
+                        <option value="none" selected="true">None</option>
+                        <option value="bonferroni">bonferroni</option>
+                        <option value="sidak">sidak</option>
+                        <option value="holm-sidak">holm-sidak</option>
+                        <option value="holm">holm</option>
+                        <option value="simes-hochberg">simes-hochberg</option>
+                        <option value="hommel">hommel</option>
+                        <option value="fdr_bh">fdr_bh</option>
+                        <option value="fdr_by">fdr_by</option>
+                        <option value="fdr_tsbh">fdr_tsbh</option>
+                        <option value="fdr_tsbky">fdr_tsbky</option>
+                    </param>
+                    <param argument="corr_axis" type="select" label="Axis over which to perform the FDR correction" help="Only used when corr_method != None.">
+                        <option value="clusters" selected="true">clusters -- correct clusters by performing FDR correction across the interactions</option>
+                        <option value="interactions">interactions -- correct interactions by performing FDR correction across the clusters</option>
+                    </param>
+                    <param argument="numba_parallel" type="select" label="Whether to use numba.prange or not">
+                        <option value="false" selected="true">No -- Recommended for small datasets or small number of interactions</option>
+                        <option value="true">Yes</option>
+                        <option value="none">Auto</option>
+                    </param>
+                    <param argument="key_added" type="text" value="" optional="true" label="Key in anndata to store the result" help="In `anndata.AnnData.uns`. If None, '{cluster_key}_ligrec' will be used." />
+                    <param argument="gene_symbols" type="text" value="" optional="true" label="Key in anndata.AnnData.var to use instead of anndata.AnnData.var_names" help="Optional." />
+                    <param argument="seed" type="integer" value="" label="Randomness seed" />
+                </expand>
+                <expand macro="squidpy_plotting_options">
+                    <param argument="source_groups" type="text" value="" optional="true" label="Source interaction clusters" help="Comma delimited. If None, select all clusters." />
+                    <param argument="target_groups" type="text" value="" optional="true" label="Target interaction clusters" help="Comma delimited. If None, select all clusters." />
+                    <param argument="means_range" type="text" value="(-inf, inf)" label="Only show interactions whose means are within this closed interval" help="Tuple of floats. e.g.: (-10, 10)." />
+                    <param argument="pvalue_threshold" type="float" value="1.0" label="Only show interactions with p-value less than this threshold" />
+                    <param argument="remove_empty_interactions" type="boolean" checked="true" label="Whether to remove rows and columns that only contain interactions with NaN values?" />
+                    <param argument="remove_nonsig_interactions" type="boolean" checked="false" label="Whether to remove rows and columns that only contain interactions that are larger than `alpha`? " />
+                    <param argument="dendrogram" type="select" label="How to cluster based on the p-values?">
+                        <option value="none" selected="true">None</option>
+                        <option value="interacting_molecules">interacting_molecules</option>
+                        <option value="interacting_clusters">interacting_clusters</option>
+                        <option value="both">both</option>
+                    </param>
+                    <param argument="alpha" type="float" value="0.001" label="Significance threshold" help="All elements with p-values less than alpha will be marked by tori instead of dots." />
+                    <param argument="swap_axes" type="boolean" checked="false" label="Whether to show the cluster combinations as rows and the interacting pairs as columns" />
+                </expand>
+            </when>
+            <when value="spatial_autocorr">
+                <expand macro="squidpy_spatial_options">
+                    <param argument="connectivity_key" type="text" value="spatial_connectivities" label="Key in anndata.AnnData.obsp where spatial connectivities are stored" />
+                    <param argument="genes" type="text" value="" optional="true" label="List of gene names, as stored in anndata.AnnData.var_names" help="Comma delitimited.  Used to compute global spatial autocorrelation statistic. If None, it’s computed anndata.AnnData.var ['highly_variable']." />
+                    <param argument="mode" type="select">
+                        <option value="moran" selected="true">moran</option>
+                        <option value="geary">geary</option>
+                    </param>
+                    <param argument="transformation" type="boolean" checked="true" label="Whether to perform row-normalization on weights in anndata.AnnData.obsp ['spatial_connectivities']" />
+                    <param argument="n_perms" type="integer" value="" optional="true" label="Number of permutations for the permutation test." help="If None, only p-values under normality assumption are computed"/>
+                    <param argument="two_tailed" type="boolean" checked="false" label="Are the p-values two-tailed?" help="One-tailed, if False." />
+                    <param argument="corr_method" type="select" label="Correction method for multiple testing">
+                        <option value="none" selected="true">None</option>
+                        <option value="bonferroni">bonferroni</option>
+                        <option value="sidak">sidak</option>
+                        <option value="holm-sidak">holm-sidak</option>
+                        <option value="holm">holm</option>
+                        <option value="simes-hochberg">simes-hochberg</option>
+                        <option value="hommel">hommel</option>
+                        <option value="fdr_bh">fdr_bh</option>
+                        <option value="fdr_by">fdr_by</option>
+                        <option value="fdr_tsbh">fdr_tsbh</option>
+                        <option value="fdr_tsbky">fdr_tsbky</option>
+                    </param>
+                    <param argument="layer" type="text" value="" optional="true" label="Layer in anndata.AnnData.layers to use" help="If None, use anndata.AnnData.X." />
+                    <param argument="seed" type="integer" value="" optional="true" label="Randomness seed" />
+                </expand>
+            </when>
+            <when value="sepal">
+                <expand macro="squidpy_spatial_options">
+                    <param argument="max_neighs" type="select" label="Maximum number of neighbors of a node in the graph">
+                        <option value="4" selected="true">4 -- for a square-grid (ST, Dbit-seq)</option>
+                        <option value="6">6 -- for a hexagonal-grid (Visium)</option>
+                    </param>
+                    <param argument="genes" type="text" value="" optional="true" label="List of gene names, as stored in anndata.AnnData.var_names" help="Comma delitimited.  Used to compute global spatial autocorrelation statistic. If None, it’s computed anndata.AnnData.var ['highly_variable']." />
+                    <param argument="n_iter" type="integer" value="30000" optional="true" label="Maximum number of iterations for the diffusion simulation" />
+                    <param argument="dt" type="float" value="0.001" label="Time step in diffusion simulation" />
+                    <param argument="thresh" type="float" value="1e-8" label="Entropy threshold for convergence of diffusion simulation" />
+                    <param argument="spatial_key" type="text" value="spatial" optional="false" label="The Key where spatial coordinates are stored" help="Key in `anndata.AnnData.obsm`." />
+                    <param argument="connectivity_key" type="text" value="spatial_connectivities" label="Key in anndata.AnnData.obsp where spatial connectivities are stored" />
+                    <param argument="layer" type="text" value="" optional="true" label="Layer in anndata.AnnData.layers to use" help="If None, use anndata.AnnData.X." />
+                    <param argument="use_raw" type="boolean" checked="true" label="Whether to access anndata.AnnData.raw" />
+                </expand>
+            </when>
+        </conditional>
+    </inputs>
+    <outputs>
+        <data format="h5ad" name="output" label="Squidpy.gr.${analyses.selected_tool} on ${on_string}" />
+        <data from_work_dir="image.png" format="png" name="output_plot" label="Squidpy.pl.${analyses.selected_tool} on ${on_string}" >
+            <filter>analyses['selected_tool'] in ['nhood_enrichment', 'centrality_scores', 'interaction_matrix', 'ligrec', 'ripley', 'co_occurrence']</filter>
+        </data>
+    </outputs>
+    <tests>
+        <test>
+            <param name="anndata" value="imc.h5ad" ftype="h5ad" />
+            <param name="selected_tool" value="spatial_neighbors" />
+            <output name="output">
+                <assert_contents>
+                    <has_h5_keys keys="uns/spatial_neighbors" />
+                </assert_contents>
+            </output>
+        </test>
+        <test>
+            <param name="anndata" value="imc_sn.h5ad" ftype="h5ad" />
+            <param name="selected_tool" value="nhood_enrichment" />
+            <param name="cluster_key" value="cell type" />
+            <output name="output">
+                <assert_contents>
+                    <has_h5_keys keys="uns/cell type_nhood_enrichment" />
+                </assert_contents>
+            </output>
+            <output name="output_plot" file="imc_nhood_enrichment.png" compare="sim_size" delta="2000" />
+        </test>
+        <test>
+            <param name="anndata" value="imc_sn.h5ad" ftype="h5ad" />
+            <param name="selected_tool" value="co_occurrence" />
+            <param name="cluster_key" value="cell type" />
+            <output name="output">
+                <assert_contents>
+                    <has_h5_keys keys="uns/cell type_co_occurrence" />
+                </assert_contents>
+            </output>
+            <output name="output_plot" file="imc_co_occurrence.png" compare="sim_size" delta="2000" />
+        </test>
+        <test>
+            <param name="anndata" value="imc_sn.h5ad" ftype="h5ad" />
+            <param name="selected_tool" value="centrality_scores" />
+            <param name="cluster_key" value="cell type" />
+            <output name="output">
+                <assert_contents>
+                    <has_h5_keys keys="uns/cell type_centrality_scores" />
+                </assert_contents>
+            </output>
+            <output name="output_plot" file="imc_centrality_scores.png" compare="sim_size" delta="2000" />
+        </test>
+        <test>
+            <param name="anndata" value="imc_sn.h5ad" ftype="h5ad" />
+            <param name="selected_tool" value="interaction_matrix" />
+            <param name="cluster_key" value="cell type" />
+            <output name="output">
+                <assert_contents>
+                    <has_h5_keys keys="uns/cell type_interactions" />
+                </assert_contents>
+            </output>
+            <output name="output_plot" file="imc_interaction_matrix.png" compare="sim_size" delta="2000" />
+        </test>
+        <test>
+            <param name="anndata" value="imc_sn.h5ad" ftype="h5ad" />
+            <param name="selected_tool" value="ripley" />
+            <param name="cluster_key" value="cell type" />
+            <output name="output">
+                <assert_contents>
+                    <has_h5_keys keys="uns/cell type_ripley_F" />
+                </assert_contents>
+            </output>
+            <output name="output_plot" file="imc_ripley.png" compare="sim_size" delta="2000" />
+        </test>
+    </tests>
+    <help>
+        <![CDATA[
+**What it does**
+
+This tool includes various of single cell spatial analysis utils provided by Squidpy.
+
+**Input**
+
+*AnnData*
+
+**Output**
+
+*Anndata*
+
+*Plotting (PNG) if applicable*
+
+
+        ]]>
+    </help>
+    <citations>
+    </citations>
+</tool>
Binary file test-data/imc.h5ad has changed
Binary file test-data/imc_centrality_scores.png has changed
Binary file test-data/imc_co_occurrence.png has changed
Binary file test-data/imc_interaction_matrix.png has changed
Binary file test-data/imc_kmeans.h5ad has changed
Binary file test-data/imc_nhood_enrichment.png has changed
Binary file test-data/imc_ripley.png has changed
Binary file test-data/imc_sn.h5ad has changed