Skip to content

Commit

Permalink
Minor formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterius committed Mar 7, 2024
1 parent d5f16b4 commit fcd5404
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
16 changes: 8 additions & 8 deletions bin/st_clustering.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]:
Expand Down
8 changes: 3 additions & 5 deletions bin/st_quality_controls.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ 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
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}
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions bin/st_svg.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit fcd5404

Please sign in to comment.