API
Import SC2Spa:
import SC2Spa
Spatial Inference
|
Finely map single cells to spatial locations and Reconstruct ST data at single cell resolution |
|
Reconstruct ST data at single cell resolution |
|
Apply KNN algorithm to obtain the single cell neighbors of ST beads |
|
Calculate the weights of nearby single cells for ST beads based on the fine mapping result |
|
Normalized Reciprocal Distance |
|
Reconstruct the gene expression profile of ST beads based on the NRD_weight output |
|
Finetune location prediction model (FCNN) on a specific cell type A model will be trained and saved to root + 'SI_' + CT + '.h5' The predicted coordinates of single cells will be saved in adata_query.obsm['spatial_mapping'] The predicted coordinates of beads will be saved in adata_ref.obs['spatial_mapping'] Fine mapping information will be saved in adata_ref.obs['FM'] and adata_query.obs['FM']. |
|
Save the FCNN or LR training history to 'log/training_log_' + name + '.pickle', |
|
Check the accuracies and mean accuracy of cross-validation |
|
Perform Cross-validation using fully connected neural network |
|
Calculate Wassertein distances of genes between two datasets |
|
Extract gene expression matrices sharing the same genes and the reference coordinates |
|
Predict batch by batch |
Plotting
|
Show the expression of a gene in cells or ST beads |
|
Show the spatial locations of a type of cells or beads |
|
Customized Function |
|
Display original locations or predicted locations of beads/cells of selected types. |
|
Show the expression of location predictive genes (or spatially variable genes) |
|
Show the spatial gene expressions of two genes and their superimposed images |
|
Draw an independent color bar figure |
Benchmarking
|
Calculate bivariate Moran's I of the genes of two ST data. |
|
Show the euclidean distance of the original and predicted locations of beads. |
Preprocessing
|
Min-Max normalize along the second axis |
|
Reverse Min-Max normalize along the second axis |
Transform cartesian coordinates to polar coordinates |
|
|
Transform polar coordinates to cartesian coordinates |
Spatially Variable Gene Analysis
|
Prioritize genes' contribution to location prediction |
|
Trace back the weight matrices to evaluate the importance of genes in location prediction |
|
Select top percent quantile nodes |
Mutual Exclusivity Analysis
|
Calculate Balanced Mutual exclusivity score between Gene 1 and Gene 2 |
|
Calculate Balanced Mutual Exclusivity |
|
Calculate Balanced Mutual exclusivity (subprocess) |
|
Calculate Balanced Mutual Exclusivity and Directed exclusively express index |
|
Calculate Balanced Mutual exclusivity and Directed exclusively express index (subprocess) |
Calculate the counts and probabilities of exclusive events |