diff --git a/bin/st_clustering.qmd b/bin/st_clustering.qmd index ba26fb9..ccb91ba 100644 --- a/bin/st_clustering.qmd +++ b/bin/st_clustering.qmd @@ -11,13 +11,12 @@ jupyter: python3 ```{python} #| tags: [parameters] #| echo: false - -input_sdata = "st_sdata_filtered.zarr" # Name of the input anndata file +input_sdata = "st_sdata_filtered.zarr" # Input: SpatialData file cluster_resolution = 1 # Resolution for Leiden clustering n_hvgs = 2000 # Number of HVGs to use for analyses -artifact_dir = "artifacts" -output_adata_processed = "st_adata_processed.h5ad" # Name of the output anndata file -output_sdata = "st_sdata_processed.zarr" # Name of the input anndata file +artifact_dir = "artifacts" # Output directory +output_sdata = "st_sdata_processed.zarr" # Output: SpatialData file +output_adata_processed = "st_adata_processed.h5ad" # Output: AnnData file ``` The data has already been filtered in the _quality controls_ reports and is @@ -39,9 +38,10 @@ from IPython.display import display, Markdown ``` ```{python} -# Make sure we can use scanpy plots with the AnnData object exported from sdata.table -# This code is taken from the early version of https://github.com/scverse/spatialdata-io/pull/102/ -# Once the PR will be merged in spatialdata-io, we should use spatialdata_io.to_legacy_anndata(sdata). +# Make sure we can use scanpy plots with the AnnData object exported from +# `sdata.table`. This code is taken from the early version of https://github.com/scverse/spatialdata-io/pull/102/ +# Once that PR is merged into spatialdata-io, we should instead use +# `spatialdata_io.to_legacy_anndata(sdata)`. def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: adata = sdata.table for dataset_id in adata.uns["spatial"]: diff --git a/bin/st_quality_controls.qmd b/bin/st_quality_controls.qmd index 125beb2..ecd19a0 100644 --- a/bin/st_quality_controls.qmd +++ b/bin/st_quality_controls.qmd @@ -26,7 +26,7 @@ analysis tools and facilitates seamless integration into existing workflows. ```{python} #| tags: [parameters] #| echo: false -input_sdata = "st_sdata_raw.zarr" # Name of the input anndata file +input_sdata = "st_sdata_raw.zarr" # Input: SpatialData file min_counts = 500 # Min counts per spot min_genes = 250 # Min genes per spot min_spots = 1 # Min spots per gene @@ -34,8 +34,8 @@ mito_threshold = 20 # Mitochondrial content threshold (%) ribo_threshold = 0 # Ribosomal content threshold (%) hb_threshold = 100 # content threshold (%) artifact_dir = "artifacts" -output_sdata = "st_sdata_filtered.zarr" # Name of the output zarr file -output_adata_filtered = "st_adata_filtered.h5ad" # Name of the output anndata file +output_sdata = "st_sdata_filtered.zarr" # Output: SpatialData file +output_adata_filtered = "st_adata_filtered.h5ad" # Output: AnnData file ``` ```{python} @@ -78,9 +78,7 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: ```{python} # Read the data - st_sdata = spatialdata.read_zarr(input_sdata, ["images", "table", "shapes"]) - st_adata = to_legacy_anndata(st_sdata) # Convert X matrix from csr to csc dense matrix for output compatibility: diff --git a/bin/st_svg.qmd b/bin/st_svg.qmd index 1951e4c..e9f7b00 100644 --- a/bin/st_svg.qmd +++ b/bin/st_svg.qmd @@ -9,12 +9,12 @@ jupyter: python3 ```{python} #| tags: [parameters] #| echo: false -input_sdata = "st_sdata_processed.zarr" # Input: SpatialData file +input_sdata = "st_sdata_processed.zarr" # Input: SpatialData file +n_top_spatial_degs = 14 # Number of SVG to plot in report +artifact_dir = "artifacts" # Output directory output_adata_svg = "st_adata_svg.h5ad" # Output: AnnData file output_sdata = "st_sdata_svg.zarr" # Output: SpatialData file -output_svg = "st_svg.csv" # Output: spatially variable genes -n_top_spatial_degs = 14 # Parameter: number of SVG to plot in report -artifact_dir = "artifacts" +output_svg = "st_svg.csv" # Output: spatially variable genes ``` ```{python}