R/plot_decontx.R
plotDecontXMarkerExpression.Rd
Generates a violin plot that shows the counts of marker
genes in cells across specific clusters or cell types. Can be used to view
the expression of marker genes in different cell types before and after
decontamination with decontX
.
plotDecontXMarkerExpression(
x,
markers,
groupClusters = NULL,
assayName = c("counts", "decontXcounts"),
z = NULL,
exactMatch = TRUE,
by = "rownames",
log1p = FALSE,
ncol = NULL,
plotDots = FALSE,
dotSize = 0.1
)
Either a SingleCellExperiment or a matrix-like object of counts.
Character Vector or List. A character vector or list of character vectors with the names of the marker genes of interest.
List. A named list that allows
cell clusters labels coded in
z
to be regrouped and renamed on the fly. For example,
list(Tcells=c(1, 2), Bcells=7)
would recode clusters
1 and 2 to "Tcells"
and cluster 7 to "Bcells". Note that if this is used, clusters
in z
not found
in groupClusters
will be excluded. Default NULL
.
Character vector. Name(s) of the assay(s) to
plot if x
is a
SingleCellExperiment. If more than one assay is listed, then
side-by-side violin plots will be generated.
Default c("counts", "decontXcounts")
.
Character, Integer, or Vector.
Indicates the cluster labels for each cell.
If x
is a SingleCellExperiment and z = NULL
,
then the cluster labels from decontX
will be retreived from the
colData
of x
(i.e. colData(x)$decontX_clusters
).
If z
is a single character or integer, then that column will be
retrived from colData
of x
. (i.e. colData(x)[,z]
).
If x
is a counts matrix, then z
will need to be a vector
the same length as the number of columns in x
that indicate
the cluster to which each cell belongs. Default NULL
.
Boolean. Whether to only identify exact matches
for the markers or to identify partial matches using grep
.
See retrieveFeatureIndex
for more details.
Default TRUE
.
Character. Where to search for the markers if x
is a
SingleCellExperiment. See retrieveFeatureIndex
for more details. If x
is a matrix, then this must be set to
"rownames"
. Default "rownames"
.
Boolean. Whether to apply the function log1p
to the data
before plotting. This function will add a pseudocount of 1 and then log
transform the expression values. Default FALSE
.
Integer. Number of columns to make in the plot.
Default NULL
.
Boolean. If TRUE
, the
expression of features will be plotted as points in addition to the violin
curve. Default FALSE
.
Numeric. Size of points if plotDots = TRUE
.
Default 0.1
.
Returns a ggplot
object.
See decontX
for a full example of how to estimate
and plot contamination.