| Title: | Spatially Resolved Cell-Cell Communication Inference for Spatial Transcriptomics |
|---|---|
| Description: | Infers spatially resolved cell-cell communications from spatial transcriptomics data using graph network and knowledge graph approaches. Supports both single-cell resolution and spot-based spatial transcriptomics platforms. Provides cell type deconvolution, ligand-receptor interaction analysis, and downstream pathway inference. |
| Authors: | Zaoqu Liu [aut, cre] (ORCID: <https://orcid.org/0000-0002-0452-742X>), Xin Shao [aut] (ORCID: <https://orcid.org/0000-0002-1928-3878>) |
| Maintainer: | Zaoqu Liu <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 2.0.0 |
| Built: | 2026-05-28 14:37:17 UTC |
| Source: | https://github.com/Zaoqu-Liu/SpaTalk |
Use Rcpp for fast permutation if available
.use_cpp_permutation().use_cpp_permutation()
Use Rcpp for fast random walk if available
.use_cpp_random_walk().use_cpp_random_walk()
Calculate co-expression for multiple gene pairs
cpp_batch_coexp(st_data_mat, src_genes, dest_genes, cell_indices)cpp_batch_coexp(st_data_mat, src_genes, dest_genes, cell_indices)
st_data_mat |
Expression matrix |
src_genes |
Source gene indices (1-based) |
dest_genes |
Destination gene indices (1-based) |
cell_indices |
Cell indices to use (1-based) |
Co-expression ratios
Calculate correlation between a vector and matrix columns
cpp_batch_cor(vec1, mat)cpp_batch_cor(vec1, mat)
vec1 |
Reference vector |
mat |
Matrix where each column is compared to vec1 |
Pearson correlation coefficients
Calculate co-expression ratios
cpp_coexp_fast(ligand_expr, receptor_expr)cpp_coexp_fast(ligand_expr, receptor_expr)
ligand_expr |
Ligand expression matrix (n_genes x n_cells) |
receptor_expr |
Receptor expression matrix (n_genes x n_cells) |
Co-expression ratios
Calculate Euclidean distance matrix
cpp_fast_dist(x, y)cpp_fast_dist(x, y)
x |
X coordinates |
y |
Y coordinates |
Distance matrix
Sample cells to reconstruct spot expression
cpp_fast_sampling( spot_ndata, sc_ndata_mat, cell_indices_by_type, spot_celltypes, iter_num = 200L, tolerance = 0.001, seed = 123L )cpp_fast_sampling( spot_ndata, sc_ndata_mat, cell_indices_by_type, spot_celltypes, iter_num = 200L, tolerance = 0.001, seed = 123L )
spot_ndata |
Spot expression vector |
sc_ndata_mat |
Single-cell expression matrix |
cell_indices_by_type |
List of cell indices for each cell type |
spot_celltypes |
Cell types to sample for this spot |
iter_num |
Maximum number of iterations |
tolerance |
Convergence tolerance (unused, kept for API compatibility) |
seed |
Random seed for reproducibility |
Best cell combination and correlation
Find K nearest neighbors
cpp_knn(dist_mat, query_idx, k)cpp_knn(dist_mat, query_idx, k)
dist_mat |
Distance matrix |
query_idx |
Query index (0-based) |
k |
Number of neighbors |
Neighbor indices (0-based)
Permutation test for LR co-expression significance
cpp_permutation_test( st_data_mat, ligand_genes, receptor_genes, sender_cells, receiver_cells, per_num = 1000L, seed = 123L )cpp_permutation_test( st_data_mat, ligand_genes, receptor_genes, sender_cells, receiver_cells, per_num = 1000L, seed = 123L )
st_data_mat |
Expression matrix |
ligand_genes |
Ligand gene indices (1-based R indexing) |
receptor_genes |
Receptor gene indices (1-based R indexing) |
sender_cells |
Sender cell indices (1-based) |
receiver_cells |
Receiver cell indices (1-based) |
per_num |
Number of permutations |
seed |
Random seed for reproducibility |
List with real_ratios and pvalues
Random walk on gene-gene interaction network
cpp_random_walk( ggi_src, ggi_dest, receptor_name, tf_names, n_walks = 10000L, max_hop = 10L, seed = 123L )cpp_random_walk( ggi_src, ggi_dest, receptor_name, tf_names, n_walks = 10000L, max_hop = 10L, seed = 123L )
ggi_src |
Source gene names |
ggi_dest |
Destination gene names |
receptor_name |
Starting receptor name |
tf_names |
TF names to score |
n_walks |
Number of random walks |
max_hop |
Maximum number of hops per walk |
seed |
Random seed for reproducibility |
TF visit frequency scores
create SpaTalk object using spatial transcriptomics data.
createSpaTalk( st_data, st_meta, species, if_st_is_sc, spot_max_cell, celltype = NULL )createSpaTalk( st_data, st_meta, species, if_st_is_sc, spot_max_cell, celltype = NULL )
st_data |
A data.frame or matrix or dgCMatrix containing counts of spatial transcriptomics, each column representing a spot or a cell, each row representing a gene. |
st_meta |
A data.frame containing coordinate of spatial transcriptomics with three columns, namely |
species |
A character meaning species of the spatial transcriptomics data. |
if_st_is_sc |
A logical meaning if it is single-cell spatial transcriptomics data. |
spot_max_cell |
A integer meaning max cell number for each plot to predict. If |
celltype |
A character containing the cell type of ST data. To skip the deconvolution step and directly infer cell-cell communication, please define the cell type. Default is |
SpaTalk object
Identify the cell-cell communications for single-cell or spot-based spatial transciptomics data with proximal ligand-receptor-target interactions.
dec_cci( object, celltype_sender, celltype_receiver, n_neighbor = 10, min_pairs = 5, min_pairs_ratio = 0, per_num = 1000, pvalue = 0.05, co_exp_ratio = 0.1, if_doParallel = T, use_n_cores = NULL )dec_cci( object, celltype_sender, celltype_receiver, n_neighbor = 10, min_pairs = 5, min_pairs_ratio = 0, per_num = 1000, pvalue = 0.05, co_exp_ratio = 0.1, if_doParallel = T, use_n_cores = NULL )
object |
SpaTalk object after |
celltype_sender |
Name of celltype_sender. |
celltype_receiver |
Name of celltype_receiver. |
n_neighbor |
Number of neighbor cells to select as the proximal cell-cell pair. Default is |
min_pairs |
Min proximal cell-cell pairs between for sending and receiving cell types. Default is |
min_pairs_ratio |
Min proximal cell-cell pairs ratio between for sending and receiving cell types. Default is |
per_num |
Number of repeat times for permutation test. Default is |
pvalue |
Include the significantly proximal LR pairs with this cutoff of p value from permutation test. Default is |
co_exp_ratio |
Min cell ratio in receiving cells with co-expressed source and target genes for predicting the downstream pathway activity. |
if_doParallel |
Use doParallel. Default is TRUE. |
use_n_cores |
Number of CPU cores to use. Default is all cores - 2. |
SpaTalk object containing the inferred LR pairs and pathways.
Identify the all cell-cell communications for single-cell or spot-based spatial transciptomics data with proximal ligand-receptor-target interactions.
dec_cci_all( object, n_neighbor = 10, min_pairs = 5, min_pairs_ratio = 0, per_num = 1000, pvalue = 0.05, co_exp_ratio = 0.1, if_doParallel = T, use_n_cores = NULL )dec_cci_all( object, n_neighbor = 10, min_pairs = 5, min_pairs_ratio = 0, per_num = 1000, pvalue = 0.05, co_exp_ratio = 0.1, if_doParallel = T, use_n_cores = NULL )
object |
SpaTalk object after |
n_neighbor |
Number of neighbor cells to select as the proximal cell-cell pair. Default is |
min_pairs |
Min proximal cell-cell pairs between for sending and receiving cell types. Default is |
min_pairs_ratio |
Min proximal cell-cell pairs ratio between for sending and receiving cell types. Default is |
per_num |
Number of repeat times for permutation test. Default is |
pvalue |
Include the significantly proximal LR pairs with this cutoff of p value from permutation test. Default is |
co_exp_ratio |
Min cell ratio in receiving cells with co-expressed source and target genes for predicting the downstream pathway activity. |
if_doParallel |
Use doParallel. Default is TRUE. |
use_n_cores |
Number of CPU cores to use. Default is all cores - 2. |
SpaTalk object containing the inferred LR pairs and pathways.
Identify the cellular composition for single-cell or spot-based spatial transcriptomics data with non-negative regression.
dec_celltype( object, sc_data, sc_celltype, min_percent = 0.5, min_nFeatures = 10, if_use_normalize_data = T, if_use_hvg = F, if_retain_other_genes = F, if_doParallel = T, use_n_cores = NULL, iter_num = 1000, method = 1, env = "base", anaconda_path = "~/anaconda3", dec_result = NULL )dec_celltype( object, sc_data, sc_celltype, min_percent = 0.5, min_nFeatures = 10, if_use_normalize_data = T, if_use_hvg = F, if_retain_other_genes = F, if_doParallel = T, use_n_cores = NULL, iter_num = 1000, method = 1, env = "base", anaconda_path = "~/anaconda3", dec_result = NULL )
object |
SpaTalk object generated from |
sc_data |
A A data.frame or matrix or dgCMatrix containing counts of single-cell RNA-seq data as the reference, each column representing a cell, each row representing a gene. |
sc_celltype |
A character containing the cell type of the reference single-cell RNA-seq data. |
min_percent |
Min percent to predict new cell type for single-cell st_data or predict new cell for spot-based st_data. Default is |
min_nFeatures |
Min number of expressed features/genes for each spot/cell in |
if_use_normalize_data |
Whether to use normalized |
if_use_hvg |
Whether to use highly variable genes for non-negative regression. Default is |
if_retain_other_genes |
Whether to retain other genes which are not overlapped between sc_data and st_data when reconstructing the single-cell ST data. Default is |
if_doParallel |
Use doParallel. Default is TRUE. |
use_n_cores |
Number of CPU cores to use. Default is all cores - 2. |
iter_num |
Number of iteration to generate the single-cell data for spot-based data. Default is |
method |
1 means using the SpaTalk deconvolution method, 2 means using RCTD, 3 means using Seurat, 4 means using SPOTlight, 5 means using deconvSeq, 6 means using stereoscope, 7 means using cell2location |
env |
When method set to 6, namely use stereoscope python package to deconvolute, please define the python environment of installed stereoscope. Default is the 'base' environment. Anaconda is recommended. When method set to 7, namely use cell2location python package to deconvolute, please install cell2location to "base" environment. |
anaconda_path |
When using stereoscope, please define the |
dec_result |
A matrix of deconvolution result from other upcoming methods, row represents spots or cells, column represents cell types of scRNA-seq reference. See |
SpaTalk object containing the decomposing results.
Demo data of dec_result
demo_dec_result()demo_dec_result()
dec_result used in dec_celltype must be a matrix object, each row representing a spot, each column representing a cell type.
A matrix.
dec_result_demo <- demo_dec_result()dec_result_demo <- demo_dec_result()
Demo data of geneinfo
demo_geneinfo()demo_geneinfo()
geneinfo used in dec_celltype must be a data.frame object with three columns, namely 'symbol', 'synonyms', 'species'.
geneinfo_demo <- demo_geneinfo()geneinfo_demo <- demo_geneinfo()
Demo data of lrpairs
demo_lrpairs()demo_lrpairs()
lrpairs used in dec_cci must be a data.frame object with three columns, namely 'ligand', 'receptor', 'species'.
A data.frame.
lrpairs_demo <- demo_lrpairs()lrpairs_demo <- demo_lrpairs()
Demo data of pathways
demo_pathways()demo_pathways()
pathways used in dec_cci must be a data.frame object with seven columns, namely 'src', 'dest', 'pathway', 'source', 'type', 'src_tf', 'dest_tf', 'species'.
A data.frame.
pathways_demo <- demo_pathways()pathways_demo <- demo_pathways()
Demo data of sc_data.
demo_sc_data()demo_sc_data()
sc_data used in dec_celltype must be a matrix object, each column representing a cell, each row representing a gene.
A matrix.
sc_data_demo <- demo_sc_data()sc_data_demo <- demo_sc_data()
Demo data of st_data.
demo_st_data()demo_st_data()
st_data used in dec_celltype must be a matrix object, each column representing a spot, each row representing a gene.
A matrix.
st_data_demo <- demo_st_data()st_data_demo <- demo_st_data()
Demo data of st_meta
demo_st_meta()demo_st_meta()
st_meta used in dec_celltype must be a data.frame object with three columns, namely 'spot', 'x', 'y' for spot-based spatial transcriptomics data.
A data.frame.
st_meta_demo <- demo_st_meta()st_meta_demo <- demo_st_meta()
Demo data of single-cell st_data.
demo_st_sc_data()demo_st_sc_data()
st_data used in dec_celltype must be a matrix object, each column representing a cell, each row representing a gene.
A matrix.
st_data_demo <- demo_st_sc_data()st_data_demo <- demo_st_sc_data()
Demo data of st_sc_meta
demo_st_sc_meta()demo_st_sc_meta()
st_sc_meta used in dec_celltype must be a data.frame object with three columns, namely 'cell', 'x', 'y' for single-cell spatial transcriptomics data.
A data.frame.
st_sc_meta_demo <- demo_st_sc_meta()st_sc_meta_demo <- demo_st_sc_meta()
Find lrpairs and pathways with receptors having downstream targets and transcriptional factors.
find_lr_path( object, lrpairs, pathways, max_hop = NULL, if_doParallel = T, use_n_cores = NULL )find_lr_path( object, lrpairs, pathways, max_hop = NULL, if_doParallel = T, use_n_cores = NULL )
object |
SpaTalk object generated from |
lrpairs |
A data.frame of the system data containing ligand-receptor pairs of |
pathways |
A data.frame of the system data containing gene-gene interactions and pathways from KEGG and Reactome as well as the information of transcriptional factors. |
max_hop |
Max hop from the receptor to the downstream target transcriptional factor to find for receiving cells. Default is |
if_doParallel |
Use doParallel. Default is TRUE. |
use_n_cores |
Number of CPU cores to use. Default is all cores - 2. |
SpaTalk object containing the filtered lrpairs and pathways.
Gene symbols of 'Human' and 'Mouse' updated on June 30, 2021 for revising count matrix.
geneinfogeneinfo
An object of class data.frame with 250934 rows and 3 columns.
https://www.ncbi.nlm.nih.gov/gene
Generate pseudo spot st_data with single-cell st_data
generate_spot(st_data, st_meta, x_min, x_res, x_max, y_min, y_res, y_max)generate_spot(st_data, st_meta, x_min, x_res, x_max, y_min, y_res, y_max)
st_data |
A data.frame or matrix or dgCMatrix containing counts of spatial transcriptomics, each column representing a cell, each row representing a gene. |
st_meta |
A data.frame containing coordinate of spatial transcriptomics with three columns, |
x_min |
Min value of x axis. |
x_res |
Resolution of x coordinate. |
x_max |
Max value of x axis. |
y_min |
Min value of y axis. |
y_res |
Resolution of y coordinate. |
y_max |
Max value of y axis. |
A list of spot st_data and st_meta
Get LR and downstream pathways and get p value of receptor-related pathways with LR-target genes by the Fisher-exact test.
get_lr_path( object, celltype_sender, celltype_receiver, ligand, receptor, min_gene_num = 5 )get_lr_path( object, celltype_sender, celltype_receiver, ligand, receptor, min_gene_num = 5 )
object |
SpaTalk object generated from |
celltype_sender |
Name of celltype_sender. |
celltype_receiver |
Name of celltype_receiver. |
ligand |
Name of ligand from celltype_sender. |
receptor |
Name of receptor from celltype_receiver. |
min_gene_num |
Min genes number for each pathway. |
A list containing two data.frame. One is LR and downstream pathways, another is the p value of receptor-related pathways with LR-target genes.
Ligand-receptor pairs of 'Human' and 'Mouse' containing 3398 human and 2033 mouse pairs.
lrpairslrpairs
An object of class data.frame with 5427 rows and 3 columns.
http://tcm.zju.edu.cn/celltalkdb/
KEGG pathways and Reactomes of 'Human' and 'Mouse' for intra-cellular genes and transcription factors.
pathwayspathways
An object of class data.frame with 669197 rows and 8 columns.
https://www.genome.jp/kegg/pathway.html
http://bioinfo.life.hust.edu.cn/AnimalTFDB/#!/
Point plot with spatial distribution of celltype_sender and celltype_receiver
plot_ccdist( object, celltype_sender, celltype_receiver, color = NULL, size = 1, if_plot_others = T, if_plot_density = T, if_plot_edge = T, if_show_arrow = T, arrow_length = 0.05, plot_cells = NULL )plot_ccdist( object, celltype_sender, celltype_receiver, color = NULL, size = 1, if_plot_others = T, if_plot_density = T, if_plot_edge = T, if_show_arrow = T, arrow_length = 0.05, plot_cells = NULL )
object |
SpaTalk object generated from |
celltype_sender |
Name of celltype_sender. |
celltype_receiver |
Name of celltype_receiver. |
color |
Color for celltype_sender, celltype_receiver, and others. Three values. |
size |
Point size. Default is |
if_plot_others |
Whether to plot others. Default is |
if_plot_density |
Whether to plot marginal density plots. Default is |
if_plot_edge |
Whether to plot edge between neighbors. Default is |
if_show_arrow |
Whether to show the arrow of the plotted edge. Default is |
arrow_length |
Arrow length. |
plot_cells |
Which cells to plot. Default is all cells. Input a character vector of cell names to plot. |
Heatmap with LR pairs of celltype_sender and celltype_receiver
plot_cci_lrpairs( object, celltype_sender, celltype_receiver, top_lrpairs = 20, color = NULL, border_color = "black", type = "sig", fontsize_number = 5, number_color = "black", color_low = NULL, color_high = NULL )plot_cci_lrpairs( object, celltype_sender, celltype_receiver, top_lrpairs = 20, color = NULL, border_color = "black", type = "sig", fontsize_number = 5, number_color = "black", color_low = NULL, color_high = NULL )
object |
SpaTalk object generated from |
celltype_sender |
Name of celltype_sender. |
celltype_receiver |
Name of celltype_receiver. |
top_lrpairs |
Number of top lrpairs for plotting. Default is |
color |
Color for the cells in heatmap. |
border_color |
color of cell borders on heatmap, use NA if no border should be drawn. |
type |
Set 'sig' to plot significant LRI pairs or set 'number' to plot the number of spatial LRI pairs. |
fontsize_number |
fontsize of the numbers displayed in cells. |
number_color |
color of the text. |
color_low |
For 'number' type, define the color for the lowest value. |
color_high |
For 'number' type, define the color for the highest value. |
Plot network with LR and downstream pathways
plot_lr_path( object, celltype_sender, celltype_receiver, ligand, receptor, color = NULL, size = 5, arrow_length = 0.1 )plot_lr_path( object, celltype_sender, celltype_receiver, ligand, receptor, color = NULL, size = 5, arrow_length = 0.1 )
object |
SpaTalk object generated from |
celltype_sender |
Name of celltype_sender. |
celltype_receiver |
Name of celltype_receiver. |
ligand |
Name of ligand from celltype_sender. |
receptor |
Name of receptor from celltype_receiver. |
color |
Color for points Two values. |
size |
Size of points. |
arrow_length |
Arrow length. |
Point plot with LR pair from celltype_sender to celltype_receiver
plot_lrpair( object, celltype_sender, celltype_receiver, ligand, receptor, color = NULL, size = 1, if_plot_density = T, if_plot_edge = T, if_show_arrow = T, arrow_length = 0.05, plot_cells = NULL )plot_lrpair( object, celltype_sender, celltype_receiver, ligand, receptor, color = NULL, size = 1, if_plot_density = T, if_plot_edge = T, if_show_arrow = T, arrow_length = 0.05, plot_cells = NULL )
object |
SpaTalk object generated from |
celltype_sender |
Name of celltype_sender. |
celltype_receiver |
Name of celltype_receiver. |
ligand |
Name of ligand from celltype_sender. |
receptor |
Name of receptor from celltype_receiver. |
color |
Color for ligand, receptor, and others. Three values. |
size |
Point size. Default is |
if_plot_density |
Whether to plot marginal density plots. Default is |
if_plot_edge |
Whether to plot edge between neighbors. Default is |
if_show_arrow |
Whether to show the arrow of the plotted edge. Default is |
arrow_length |
Arrow length. |
plot_cells |
Which cells to plot. Default is all cells. Input a character vector of cell names to plot. |
Violin plot spatial distance of LR pair between expressed senders and receivers and between expressed cell-cell pairs.
plot_lrpair_vln( object, celltype_sender, celltype_receiver, ligand, receptor, vln_color = NULL, if_plot_boxplot = T, box_width = 0.2 )plot_lrpair_vln( object, celltype_sender, celltype_receiver, ligand, receptor, vln_color = NULL, if_plot_boxplot = T, box_width = 0.2 )
object |
SpaTalk object generated from |
celltype_sender |
Name of celltype_sender. |
celltype_receiver |
Name of celltype_receiver. |
ligand |
Name of ligand from celltype_sender. |
receptor |
Name of receptor from celltype_receiver. |
vln_color |
Color for violins. Two values. |
if_plot_boxplot |
Whether to plot boxplot. Default is |
box_width |
Box width. Default is |
River plot of significantly activated pathways and related downstream genes of receptors.
plot_path2gene( object, celltype_sender, celltype_receiver, ligand, receptor, min_gene_num = 5, pvalue = 0.5, color = NULL, color_flow = "blue" )plot_path2gene( object, celltype_sender, celltype_receiver, ligand, receptor, min_gene_num = 5, pvalue = 0.5, color = NULL, color_flow = "blue" )
object |
SpaTalk object generated from |
celltype_sender |
Name of celltype_sender. |
celltype_receiver |
Name of celltype_receiver. |
ligand |
Name of ligand from celltype_sender. |
receptor |
Name of receptor from celltype_receiver. |
min_gene_num |
Min genes number for each pathway. |
pvalue |
P value of the Fisher-exact test. |
color |
Color of pathways and genes. Two values. |
color_flow |
Color of the flow. |
Ponit plot with spatial distribution of a single predicted cell type for transcriptomics data
plot_st_celltype( object, celltype, size = 1, color_celltype = "blue", color_others = "grey" )plot_st_celltype( object, celltype, size = 1, color_celltype = "blue", color_others = "grey" )
object |
SpaTalk object generated from |
celltype |
Name of cell type in the |
size |
Point size. Default is |
color_celltype |
Color for the celltype of interest. |
color_others |
Color for the others. |
Plot spatial distribution of all predicted cell types for transcriptomics data
plot_st_celltype_all(object, size = 1, color = NULL)plot_st_celltype_all(object, size = 1, color = NULL)
object |
SpaTalk object generated from |
size |
Point size. Default is |
color |
Color for all predicted cell types. |
Plot spatial density of a single predicted cell type for transcriptomics data
plot_st_celltype_density( object, celltype, type, if_plot_point = T, point_color = NULL, point_size = 1, color_low = "grey", color_mid = NULL, color_high = "blue", color_midpoint = NULL, size = 1 )plot_st_celltype_density( object, celltype, type, if_plot_point = T, point_color = NULL, point_size = 1, color_low = "grey", color_mid = NULL, color_high = "blue", color_midpoint = NULL, size = 1 )
object |
SpaTalk object generated from |
celltype |
Name of cell type in the |
type |
Select 'contour' or 'raster'. |
if_plot_point |
Whether to plot points when type is 'contour'. |
point_color |
Point color. |
point_size |
Point size. Default is |
color_low |
Color for the lowest value. |
color_mid |
Color for the middle value for using |
color_high |
Color for the highest value. |
color_midpoint |
Value for the middle scale. Default is |
size |
Line size when type is 'contour'. Default is |
Plot spatial distribution of a single predicted cell type percent for transcriptomics data
plot_st_celltype_percent( object, celltype, size = 1, color_low = NULL, color_mid = NULL, color_high = NULL, color_midpoint = NULL )plot_st_celltype_percent( object, celltype, size = 1, color_low = NULL, color_mid = NULL, color_high = NULL, color_midpoint = NULL )
object |
SpaTalk object generated from |
celltype |
Name of cell type in the |
size |
Point size. Default is |
color_low |
Color for the lowest value. |
color_mid |
Color for the middle value for using |
color_high |
Color for the highest value. |
color_midpoint |
Value for the middle scale. Default is |
Plot heatpmap of correlation between the expression of marker genes and the predicted score of cell types among all spatial cells or spots.
plot_st_cor_heatmap( object, marker_genes, celltypes, color_low = NULL, color_mid = NULL, color_high = NULL, scale = "none", if_show_top = T, top_direction = "row", border_color = NA )plot_st_cor_heatmap( object, marker_genes, celltypes, color_low = NULL, color_mid = NULL, color_high = NULL, scale = "none", if_show_top = T, top_direction = "row", border_color = NA )
object |
SpaTalk object generated from |
marker_genes |
A character containing the known marker genes to plot, provide at least two marker genes of interest. |
celltypes |
A character containing name of cell type in the |
color_low |
Color for the lowest value. |
color_mid |
Color for the middle value for using |
color_high |
Color for the highest value. |
scale |
Character indicating if the values should be centered and scaled in either the row direction or the column direction, or none. Corresponding values are 'row', 'column' and 'none'. |
if_show_top |
Whether to plot a symbol to the highest value across rows or columns. Default is |
top_direction |
Direction to identify the highest value, select |
border_color |
Color of the cell border. Default is |
Point plot with spatial distribution of a gene for transcriptomics data
plot_st_gene( object, gene, size = 1, color_low = "grey", color_mid = NULL, color_high = "blue", color_midpoint = NULL, if_use_newmeta = T, celltype = NULL, if_plot_others = T )plot_st_gene( object, gene, size = 1, color_low = "grey", color_mid = NULL, color_high = "blue", color_midpoint = NULL, if_use_newmeta = T, celltype = NULL, if_plot_others = T )
object |
SpaTalk object generated from |
gene |
Symbol of gene, e.g., 'AKT1'. |
size |
Point size. Default is |
color_low |
Color for the lowest value. |
color_mid |
Color for the middle value for using |
color_high |
Color for the highest value. |
color_midpoint |
Value for the middle scale. Default is |
if_use_newmeta |
Whether to use newmeta o plot the spatial distribution of gene after |
celltype |
gene in which celltype to plot. Default is |
if_plot_others |
Whether to plot other cells when to use defined |
Please set if_use_newmeta as FALSE to plot the spatial distribution of gene before dec_celltype for spot-based data.
Plot scatterpie for spatial transcriptomics data
plot_st_pie(object, pie_scale = 1, xy_ratio = 1, color = NULL)plot_st_pie(object, pie_scale = 1, xy_ratio = 1, color = NULL)
object |
SpaTalk object generated from |
pie_scale |
Scale of each pie to plot. Default is |
xy_ratio |
Ratio of y and x coordinates. Default is |
color |
Filled of colors for pie plot, length of |
Plot scatterpie for spot-based ST data
plot_st_pie_generate(st_meta, pie_scale = 1, xy_ratio = 1, color = NULL)plot_st_pie_generate(st_meta, pie_scale = 1, xy_ratio = 1, color = NULL)
st_meta |
st_meta generated from |
pie_scale |
Scale of each pie to plot. Default is |
xy_ratio |
Ratio of y and x coordinates. Default is |
color |
Filled of colors for pie plot, length of |
Revise genes according to NCBI Gene symbols updated in June 30, 2021 for count matrix, user-custom lrpairs data.frame, and user-custom pathways data.frame.
rev_gene(data = NULL, data_type = NULL, species = NULL, geneinfo = NULL)rev_gene(data = NULL, data_type = NULL, species = NULL, geneinfo = NULL)
data |
A data.frame or matrix or dgCMatrix containing count data each column representing a spot or a cell, each row representing a gene; Or a data.frame containing ligand-receptor pairs; Or a data.frame containing gene-gene interactions and pathways from KEGG and Reactome as well as the information of transcriptional factors. |
data_type |
A character to define the type of |
species |
Species of the data. |
geneinfo |
A data.frame of the system data containing gene symbols of |
A new matrix or data.frame.
Set the expected cell in SpaTalk object
set_expected_cell(object, value)set_expected_cell(object, value)
object |
SpaTalk object |
value |
Th number of expected cell for each spot, must be equal to the spot number. |
SpaTalk object
Show SpaTalk object
## S4 method for signature 'SpaTalk' show(object)## S4 method for signature 'SpaTalk' show(object)
object |
A SpaTalk object |
Invisible NULL, prints summary information
An S4 class containing the data, meta, and results of inferred cell type compositions, LR pairs, and pathways.
dataA list containing the raw and normalized data.
metaA list containing the raw and new meta data.
paraA list containing the parameters.
coefA matrix containing the results of deconvolution.
cellpairA list containing the cell-cell pairs based on the spatial distance.
distA matrix containing the Euclidean distance among cells.
lrpairA data frame containing the inferred LR pairs.
tfA data frame containing the TFs of receptors.
lr_pathA list containing the lrpairs and pathways.