vizTopic: Visualize pixel proportions of a single cell-type.

View source: R/plot.R

vizTopicR Documentation

Visualize pixel proportions of a single cell-type.

Description

Visualize the pixel proportions of a single topic.

Usage

vizTopic(
  theta,
  pos,
  topic,
  groups = NA,
  group_cols = NA,
  size = 2,
  stroke = 0.3,
  alpha = 1,
  low = "white",
  high = "red",
  plotTitle = NA,
  showLegend = TRUE
)

Arguments

theta

document (pixel) x cell-type proportion matrix

pos

position of pixels, as data.frame with x and y columns

topic

the index of the topic

groups

colors the pixel border lines based on a group or cell layer they belong to. Needs to be a character or named vector of assigned groups for each pixel Ex: c("0", "1", "0", ...)

group_cols

color labels for the groups. Ex: c("0" = "gray", "1" = "red")

size

size of the geom_points to plot (default: 2)

stroke

thickness of the geom_point lines to help in emphasizing groups (default: 0.5)

alpha

alpha value of colored pixels (default: 1)

low

sets the color for the low end of the topic proportion color scale (default: "white")

high

sets the color the the high end of the topic proportion color scale (default: "red")

plotTitle

option to add a title to the plot (character)

showLegend

Boolean to show the plot legend

Value

a plot where each point is a pixel colored by the proportion of the selected cell-type

Examples

data(mOB)
pos <- mOB$pos
cd <- mOB$counts
counts <- cleanCounts(cd, min.lib.size = 100)
corpus <- restrictCorpus(counts, removeAbove=1.0, removeBelow = 0.05)
ldas <- fitLDA(t(as.matrix(corpus)), Ks = 3)
optLDA <- optimalModel(models = ldas, opt = 3)
results <- getBetaTheta(optLDA, perc.filt = 0.05, betaScale = 1000)
deconProp <- results$theta
vizTopic(theta = deconProp, pos = pos, topic = "3", plotTitle = "X3",
    size = 5, stroke = 1, alpha = 0.5, low = "white", high = "red")


JEFworks-Lab/STdeconvolve documentation built on Nov. 14, 2024, 7:24 p.m.