ctsv: Detection of cell-type-specific spatially variable genes

CTSVR Documentation

Detection of cell-type-specific spatially variable genes

Description

Detection of cell-type-specific spatially variable genes

Usage

CTSV(spe, W, num_core = 1, BPPARAM = NULL)

Arguments

spe

An SpatialExperiment class.

W

An n by K cell-type proportion matrix, where K is the number of cell types. The column names of W are cell type names.

num_core

Number of cores if using paralleling. The default is one.

BPPARAM

Optional additional argument for parallelization. The default is NULL, in which case num_core will be used instead. If provided, this should be an instance of BiocParallelParam. For most users, the recommended option is to use the num_core argument instead.

Value

A list with a G by 2K matrix of p-values and a G by 2K matrix of q-values.

pval

A G by 2K matrix of p-values. The first K columns correspond to the first coordinate, and the last K columns to the second coordinate.

qval

A G by 2K matrix of q-values. The first K columns correspond to the first coordinate, and the last K columns to the second coordinate.

Examples

library(CTSV)
#read example data
data(CTSVexample_data)
spe <- CTSVexample_data[[1]]
W <- CTSVexample_data[[2]]
gamma_true <- CTSVexample_data[[3]]
# gene number
G <- nrow(spe)
# spot number
n <- ncol(spe)
# cell type number
K <- ncol(W)
G
n
K
# SV genes in each cell type:
rownames(W)[which(gamma_true[,1] == 1)]
rownames(W)[which(gamma_true[,2] == 1)]
# Number of SV genes at the aggregated level:
sum(rowSums(gamma_true)>0)
#--- Run CTSV ----
result <- CTSV(spe,W,num_core = 8)
# View on q-value matrix
head(result$qval)
# detect SV genes
re <- svGene(result$qval,0.05)
#SV genes in each cell type:
re$SVGene

jingeyu/CTSV documentation built on July 11, 2022, 4:54 a.m.