In this tutorial, you will learn how to run the complementary pipeline SAW reanalyze for clustering, differential expression analysis, and lasso.
Clustering
In bioinformatic downstream analysis, clustering is a critical and fundamental method that creates groups of spatial expression points with similar characteristics. The process helps uncover the underlying structure and patterns within the expression data. Clustering plays a crucial role in bioinformatics research because of its versatility in finding gene expression patterns, investigating cell types, and studying disease subtypes.
Choose an appropriate bin size for your datasets. For example, the diameter of a mammalian cell is about 10 µm, based on the physical spacing of a pair of DNBs being 500 nm, so it can be roughly estimated that bin20 is a suitable starting point.
Leiden algorithm is called for clustering, --Leiden-resolution , default to 1.0, controls the coarseness of the clustering when performing Leiden. Higher values lead to more clusters.
Differential expression analysis can be performed through --marker based on the clusters categorized by Leiden algorithm.
You can perform clustering with a bin GEF and set up the command as below:
clustering├──<SN>.bin20_1.0.h5ad##<SN>.<bin_size>_<resolution>.h5ad, containing analysis results├──find_marker_genes.csv##original output CSV└──bin20_marker_features.csv##formatted CSV for visualization in StereoMap
If turn --marker on to the analysis, you will get results related to differential expression analysis, namely find_marker_genes.csv and <bin_size>_marker_features.csv.
find_marker_genes.csv is the original output file.
<bin_size>_marker_features.csv. is a formatted CSV that records mean MID counts, L2FC, adjusted p-value, and expression ratio of marker features for each cluster.
Or begin with a cellbin GEF:
Clustering outputs based on cellbin GEF are listed:
Lasso
The interactive tool in StereoMap can manually delineate closed regions of interest. It needs SAW reanalyze to extract feature expression matrices of regions, using the GeoJSON from StereoMap.
Lasso in StereoMap
Run the pipeline for lasso, and set up the command as below:
--bin-size parameter can accept a list of INTs to generate expression matrices with multiple bin sizes at once.
Lasso outputs based on bin GEF are listed:
Or begin with:
Lasso outputs based on cellbin GEF are listed:
Differential expression analysis
SAW reanalyze can perform differential expression analysis based on both clustering and lasso areas, using the diffexp GeoJSON file from StereoMap.
Selected clusters and lasso regions are recorded in the diffexp GeoJSON.
Perform the analysis simply:
--count-data accepts an output directory of the last SAW count, SAW reanalyze will detect all files, needed for differential expression analysis. Related information is recorded in the *.diffexp.geojson.
Differential expression analysis outputs are listed:
clustering_analysis
├── <SN>.cellbin.gef ##a copy of input cellbin GEF but with new clustering information
├── <SN>.cellbin_1.0.h5ad ##<SN>.cellbin_<resolution>.h5ad, containing analysis results
├── find_marker_genes.csv ##original output CSV
└── cellbin_marker_features.csv ##formatted CSV for visualization in StereoMap