plotInterCellTypeSpatialCrossCor: Expression correlation between cells of group A expressing...

View source: R/plot.R

plotInterCellTypeSpatialCrossCorR Documentation

Expression correlation between cells of group A expressing gene A with neighbors of cells of group A in group B expressing gene B

Description

Expression correlation between cells of group A expressing gene A with neighbors of cells of group A in group B expressing gene B

Usage

plotInterCellTypeSpatialCrossCor(
  gexpA,
  gexpB,
  groupA,
  groupB,
  weight,
  fun = mean,
  ...
)

Arguments

gexpA

Expression of gene A

gexpB

Expression of gene B

groupA

Cells of group A

groupB

Cells of group B

weight

Adjacency weight matrix

fun

Function for combining multiple gene expression values (ex. mean, median, max)

...

Additional plotting parameters

Value

None

Examples

# Simulate data
set.seed(0)
N <- 100
pos <- cbind(rnorm(N), rnorm(N))
rownames(pos) <- paste0('cell', 1:N)
colnames(pos) <- c('x', 'y')
weight <- getSpatialNeighbors(pos)
ctA <- sample(rownames(pos), N/2)
ctB <- setdiff(rownames(pos), ctA)
gexpA <- pos[,2]
gexpA[ctB] <- 0
gexpB <- -pos[,2]
gexpB[ctA] <- 0
plotEmbedding(pos, col=gexpA)
plotEmbedding(pos, col=gexpB)
plotInterCellTypeSpatialCrossCor(gexpA, gexpB, ctA, ctB, weight)
plotInterCellTypeSpatialCrossCor(gexpB, gexpA, ctB, ctA, weight)


JEFworks/MERingue documentation built on June 11, 2022, 4:16 a.m.