Title: | scDataviz: single cell dataviz and downstream analyses |
---|---|
Description: | In the single cell World, which includes flow cytometry, mass cytometry, single-cell RNA-seq (scRNA-seq), and others, there is a need to improve data visualisation and to bring analysis capabilities to researchers even from non-technical backgrounds. scDataviz attempts to fit into this space, while also catering for advanced users. Additonally, due to the way that scDataviz is designed, which is based on SingleCellExperiment, it has a 'plug and play' feel, and immediately lends itself as flexibile and compatibile with studies that go beyond scDataviz. Finally, the graphics in scDataviz are generated via the ggplot engine, which means that users can 'add on' features to these with ease. |
Authors: | Kevin Blighe [aut, cre] |
Maintainer: | Kevin Blighe <[email protected]> |
License: | GPL-3 |
Version: | 1.17.0 |
Built: | 2024-10-31 04:49:50 UTC |
Source: | https://github.com/bioc/scDataviz |
ggplot2
theme.Package-wide, non-user function used to set a base ggplot2
theme.
basetheme( titleLabSize, subtitleLabSize, captionLabSize, axisLabSize, xlabAngle, xlabhjust, xlabvjust, ylabAngle, ylabhjust, ylabvjust, legendPosition, legendLabSize )
basetheme( titleLabSize, subtitleLabSize, captionLabSize, axisLabSize, xlabAngle, xlabhjust, xlabvjust, ylabAngle, ylabhjust, ylabvjust, legendPosition, legendLabSize )
titleLabSize |
Size of plot title. |
subtitleLabSize |
Size of plot subtitle. |
captionLabSize |
Size of plot caption. |
axisLabSize |
Size of x- and y-axis labels. |
xlabAngle |
Rotation angle of x-axis labels. |
xlabhjust |
Horizontal adjustment of x-axis labels. |
xlabvjust |
Vertical adjustment of x-axis labels. |
ylabAngle |
Rotation angle of y-axis labels. |
ylabhjust |
Horizontal adjustment of y-axis labels. |
ylabvjust |
Vertical adjustment of y-axis labels. |
legendPosition |
Position of |
legendLabSize |
Size of plot legend text. |
Package-wide, non-user function used to set a base ggplot2
theme.
A list
object.
Kevin Blighe <[email protected]>
# create a theme th <- basetheme( titleLabSize = 16, subtitleLabSize = 12, captionLabSize = 12, axisLabSize = 16, xlabAngle = 0, xlabhjust = 0.5, xlabvjust = 0.5, ylabAngle = 0, ylabhjust = 0.5, ylabvjust = 0.5, legendPosition = 'none', legendLabSize = 12)
# create a theme th <- basetheme( titleLabSize = 16, subtitleLabSize = 12, captionLabSize = 12, axisLabSize = 16, xlabAngle = 0, xlabhjust = 0.5, xlabvjust = 0.5, ylabAngle = 0, ylabhjust = 0.5, ylabvjust = 0.5, legendPosition = 'none', legendLabSize = 12)
Seurat
's FindNeighbors
and FindClusters
.A wrapper function for Seurat
's FindNeighbors
and FindClusters
.
clusKNN( indata, reducedDim = "UMAP", dimColnames = c("UMAP1", "UMAP2"), clusterAssignName = "Cluster", distance.matrix = FALSE, k.param = 20, compute.SNN = TRUE, prune.SNN = 1/15, nn.method = "rann", annoy.metric = "euclidean", nn.eps = 0, verbose = TRUE, force.recalc = FALSE, modularity.fxn = 1, initial.membership = NULL, weights = NULL, node.sizes = NULL, resolution = 0.8, method = "matrix", algorithm = 1, n.start = 10, n.iter = 10, random.seed = 0, group.singletons = TRUE, temp.file.location = NULL, edge.file.name = NULL, overwrite = FALSE )
clusKNN( indata, reducedDim = "UMAP", dimColnames = c("UMAP1", "UMAP2"), clusterAssignName = "Cluster", distance.matrix = FALSE, k.param = 20, compute.SNN = TRUE, prune.SNN = 1/15, nn.method = "rann", annoy.metric = "euclidean", nn.eps = 0, verbose = TRUE, force.recalc = FALSE, modularity.fxn = 1, initial.membership = NULL, weights = NULL, node.sizes = NULL, resolution = 0.8, method = "matrix", algorithm = 1, n.start = 10, n.iter = 10, random.seed = 0, group.singletons = TRUE, temp.file.location = NULL, edge.file.name = NULL, overwrite = FALSE )
indata |
A data-frame or matrix, or |
reducedDim |
A reduced dimensional component stored within |
dimColnames |
The column names of the dimensions to use. |
clusterAssignName |
The new column name in the metadata that will contain the determined cell-to-cluster assignments. |
distance.matrix |
Refer to |
k.param |
Refer to |
compute.SNN |
Refer to |
prune.SNN |
Refer to |
nn.method |
Refer to |
annoy.metric |
Refer to |
nn.eps |
Refer to |
verbose |
Refer to |
force.recalc |
Refer to |
modularity.fxn |
Refer to |
initial.membership |
Refer to |
weights |
Refer to |
node.sizes |
Refer to |
resolution |
Refer to |
method |
Refer to |
algorithm |
Refer to |
n.start |
Refer to |
n.iter |
Refer to |
random.seed |
Refer to |
group.singletons |
Refer to |
temp.file.location |
Refer to |
edge.file.name |
Refer to |
overwrite |
When the input object is a SingleCellExperiment, enabling
this will result in the overwriting, with the new cluster assignments, of
any column in your metadata that has the same name as
|
A wrapper function for Seurat's FindNeighbors and FindClusters.
A SingleCellExperiment
or numeric
object.
Kevin Blighe <[email protected]>
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) clusKNN(mat)
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) clusKNN(mat)
SingleCellExperiment
object.Draw a contour plot, typically relating to co-ordinates of a 2-dimensional reduction / embedding, typically contained within a SingleCellExperiment
object.
contourPlot( indata, reducedDim = "UMAP", dimColnames = c("UMAP1", "UMAP2"), lowcol = "darkblue", highcol = "darkred", alpha = c(0, 0.5), contour = "black", bins = 300, legendPosition = "right", legendLabSize = 12, legendIconSize = 5, legendKeyHeight = 2.5, xlim = NULL, ylim = NULL, celllab = NULL, labSize = 3, drawConnectors = TRUE, widthConnectors = 0.5, colConnectors = "black", xlab = dimColnames[1], xlabAngle = 0, xlabhjust = 0.5, xlabvjust = 0.5, ylab = dimColnames[2], ylabAngle = 0, ylabhjust = 0.5, ylabvjust = 0.5, axisLabSize = 16, title = "Cellular density and contours", subtitle = "", caption = ifelse(is(indata, "SingleCellExperiment"), paste0("Total cells, ", nrow(as.data.frame(reducedDim(indata, reducedDim))), "; Bins, ", bins), paste0("Total cells, ", nrow(indata), "; Bins, ", bins)), titleLabSize = 16, subtitleLabSize = 12, captionLabSize = 12, hline = NULL, hlineType = "longdash", hlineCol = "black", hlineWidth = 0.4, vline = NULL, vlineType = "longdash", vlineCol = "black", vlineWidth = 0.4, gridlines.major = TRUE, gridlines.minor = TRUE, borderWidth = 0.8, borderColour = "black", verbose = TRUE )
contourPlot( indata, reducedDim = "UMAP", dimColnames = c("UMAP1", "UMAP2"), lowcol = "darkblue", highcol = "darkred", alpha = c(0, 0.5), contour = "black", bins = 300, legendPosition = "right", legendLabSize = 12, legendIconSize = 5, legendKeyHeight = 2.5, xlim = NULL, ylim = NULL, celllab = NULL, labSize = 3, drawConnectors = TRUE, widthConnectors = 0.5, colConnectors = "black", xlab = dimColnames[1], xlabAngle = 0, xlabhjust = 0.5, xlabvjust = 0.5, ylab = dimColnames[2], ylabAngle = 0, ylabhjust = 0.5, ylabvjust = 0.5, axisLabSize = 16, title = "Cellular density and contours", subtitle = "", caption = ifelse(is(indata, "SingleCellExperiment"), paste0("Total cells, ", nrow(as.data.frame(reducedDim(indata, reducedDim))), "; Bins, ", bins), paste0("Total cells, ", nrow(indata), "; Bins, ", bins)), titleLabSize = 16, subtitleLabSize = 12, captionLabSize = 12, hline = NULL, hlineType = "longdash", hlineCol = "black", hlineWidth = 0.4, vline = NULL, vlineType = "longdash", vlineCol = "black", vlineWidth = 0.4, gridlines.major = TRUE, gridlines.minor = TRUE, borderWidth = 0.8, borderColour = "black", verbose = TRUE )
indata |
A data-frame or matrix, or |
reducedDim |
A reduced dimensional embedding stored within |
dimColnames |
The column names of the dimensions to use. |
lowcol |
Shade for low-density contours. |
highcol |
Shade for high-density contours. |
alpha |
Control the gradient of colour transparency, with 1 being opaque. |
contour |
The colour of the contour lines. |
bins |
The number of bins that determine the overall density values. |
legendPosition |
Position of legend |
legendLabSize |
Size of plot legend text. |
legendIconSize |
Size of plot legend icons / symbols. |
legendKeyHeight |
Height of the legend key. |
xlim |
Limits of the x-axis. |
ylim |
Limits of the y-axis. |
celllab |
A vector containing any cells that the user wishes to label in the plot. |
labSize |
Size of labels. |
drawConnectors |
Logical, indicating whether or not to connect plot labels to their corresponding points by line connectors. |
widthConnectors |
Line width of connectors. |
colConnectors |
Line colour of connectors. |
xlab |
Label for x-axis. |
xlabAngle |
Rotation angle of x-axis labels. |
xlabhjust |
Horizontal adjustment of x-axis labels. |
xlabvjust |
Vertical adjustment of x-axis labels. |
ylab |
Label for y-axis. |
ylabAngle |
Rotation angle of y-axis labels. |
ylabhjust |
Horizontal adjustment of y-axis labels. |
ylabvjust |
Vertical adjustment of y-axis labels. |
axisLabSize |
Size of x- and y-axis labels. |
title |
Plot title. |
subtitle |
Plot subtitle. |
caption |
Plot caption. |
titleLabSize |
Size of plot title. |
subtitleLabSize |
Size of plot subtitle. |
captionLabSize |
Size of plot caption. |
hline |
Draw one or more horizontal lines passing through this/these values on y-axis. For single values, only a single numerical value is necessary. For multiple lines, pass these as a vector, e.g., c(60,90). |
hlineType |
Line type for hline |
hlineCol |
Colour of hline. |
hlineWidth |
Width of hline. |
vline |
Draw one or more vertical lines passing through this/these values on x-axis. For single values, only a single numerical value is necessary. For multiple lines, pass these as a vector, e.g., c(60,90). |
vlineType |
Line type for vline |
vlineCol |
Colour of vline. |
vlineWidth |
Width of vline. |
gridlines.major |
Logical, indicating whether or not to draw major gridlines. |
gridlines.minor |
Logical, indicating whether or not to draw minor gridlines. |
borderWidth |
Width of the border on the x and y axes. |
borderColour |
Colour of the border on the x and y axes. |
verbose |
Boolean (TRUE / FALSE) to print messages to console or not. |
Draw a contour plot, typically relating to co-ordinates of a 2-dimensional reduction / embedding, typically contained within a SingleCellExperiment
object.
A ggplot2
object.
Kevin Blighe <[email protected]>
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) u <- umap::umap(mat)$layout colnames(u) <- c('UMAP1','UMAP2') contourPlot(u)
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) u <- umap::umap(mat)$layout colnames(u) <- c('UMAP1','UMAP2') contourPlot(u)
Downsample an input data-frame or matrix based on variance.
downsampleByVar(x, varianceFactor = 0.1, verbose = TRUE)
downsampleByVar(x, varianceFactor = 0.1, verbose = TRUE)
x |
Input data-matrix. |
varianceFactor |
Removes this proportion of variables based on lesser variance. |
verbose |
Boolean (TRUE / FALSE) to print messages to console or not. |
Downsample an input data-frame or matrix based on variance.
A matrix
object.
Kevin Blighe <[email protected]>
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) downsampleByVar(mat, varianceFactor = 0.1)
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) downsampleByVar(mat, varianceFactor = 0.1)
SingleCellExperiment
object.Import a data-frame or matrix, and associated metadata, to a SingleCellExperiment
object.
importData( mat, assayname, metadata = NULL, downsampleVar = NULL, verbose = TRUE )
importData( mat, assayname, metadata = NULL, downsampleVar = NULL, verbose = TRUE )
mat |
A data-frame or matrix of expression values. Data-frames will be coerced to matrices. |
assayname |
Name of the |
metadata |
Metadata associated with the data contained in 'mat'. A
strict rule is enforced requiring that |
downsampleVar |
Downsample based on variance. Removes this proportion of variables (rows) based on lesser variance. This is applied on a per sample basis. If user wishes to apply this globally on the final merged dataset, then set this to 0 and remove based on variance manually after object creation. |
verbose |
Boolean (TRUE / FALSE) to print messages to console or not. |
Import a data-frame or matrix, and associated metadata, to a SingleCellExperiment
object.
A SingleCellExperiment
object.
Kevin Blighe <[email protected]>
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(50000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) metadata <- data.frame( group = rep('A', nrow(mat)), row.names = rownames(mat), stringsAsFactors = FALSE) sce <- importData(mat, assayname = 'normcounts', metadata = metadata)
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(50000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) metadata <- data.frame( group = rep('A', nrow(mat)), row.names = rownames(mat), stringsAsFactors = FALSE) sce <- importData(mat, assayname = 'normcounts', metadata = metadata)
Find enriched markers per identified cluster and calculate cluster abundances across these for samples and metadata variables.
markerEnrichment( indata, meta = NULL, assay = "scaled", sampleAbundances = TRUE, sampleID = "sample", studyvarID = NULL, clusterAssign = metadata(indata)[["Cluster"]], funcSummarise = function(x) mean(x, na.rm = TRUE), method = "Z", prob = 0.1, limits = c(-1.96, 1.96), verbose = TRUE )
markerEnrichment( indata, meta = NULL, assay = "scaled", sampleAbundances = TRUE, sampleID = "sample", studyvarID = NULL, clusterAssign = metadata(indata)[["Cluster"]], funcSummarise = function(x) mean(x, na.rm = TRUE), method = "Z", prob = 0.1, limits = c(-1.96, 1.96), verbose = TRUE )
indata |
A data-frame or matrix, or |
meta |
If 'indata' is a non- |
assay |
Name of the assay slot in |
sampleAbundances |
Logical, indicating whether or not to calculate cluster abundances across study samples. |
sampleID |
If |
studyvarID |
A column name from the provided metadata representing a condition or trait over which cluster abundances will be calculated. |
clusterAssign |
A vector of cell-to-cluster assignments. This can be
from any source but must align with your cells / variables. There is no
check to ensure this when 'indata' is not a |
funcSummarise |
A mathematical function used to summarise expression per marker per cluster. |
method |
Type of summarisation to apply to the data for final marker
selection. Possible values include |
prob |
See details for |
limits |
See details for |
verbose |
Boolean (TRUE / FALSE) to print messages to console or not. |
Find enriched markers per identified cluster and calculate cluster abundances across these for samples and metadata variables. markerEnrichment
first collapses your input data's expression profiles from the level of cells to the level of clusters based on a mathematical function specified by funcSummarise
. It then either selects, per cluster, low|high markers via quantiles, or transforms this collapsed data to global Z-scores and selects low|high markers based on Z-score cut-offs.
A data.frame
object.
Kevin Blighe <[email protected]>
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) u <- umap::umap(mat)$layout colnames(u) <- c('UMAP1','UMAP2') rownames(u) <- rownames(mat) clus <- clusKNN(u) metadata <- data.frame( group = c(rep('PB1', 25), rep('PB2', 25)), row.names = rownames(u)) markerEnrichment(t(mat), meta = metadata, sampleAbundances = FALSE, studyvarID = 'group', clusterAssign = clus)
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) u <- umap::umap(mat)$layout colnames(u) <- c('UMAP1','UMAP2') rownames(u) <- rownames(mat) clus <- clusKNN(u) metadata <- data.frame( group = c(rep('PB1', 25), rep('PB2', 25)), row.names = rownames(u)) markerEnrichment(t(mat), meta = metadata, sampleAbundances = FALSE, studyvarID = 'group', clusterAssign = clus)
SingleCellExperiment
object. By default, this function plots the expression profile of 6 randomly-selected markers from your data.Highlight the individual marker expression profile across a 2-dimensional reduction / embedding, typically contained within a SingleCellExperiment
object. By default, this function plots the expression profile of 6 randomly-selected markers from your data.
markerExpression( indata, layout = NULL, assay = "scaled", reducedDim = "UMAP", dimColnames = c("UMAP1", "UMAP2"), markers = sample(rownames(indata), 6), ncol = 3, nrow = 2, col = c("darkblue", "yellow"), colMidpoint = 0, alpha = c(0, 1), pointSize = 0.5, legendPosition = "right", legendLabSize = 12, legendKeyHeight = 2.5, xlim = NULL, ylim = NULL, celllab = NULL, labSize = 3, drawConnectors = TRUE, widthConnectors = 0.5, colConnectors = "black", xlab = dimColnames[1], xlabAngle = 0, xlabhjust = 0.5, xlabvjust = 0.5, ylab = dimColnames[2], ylabAngle = 0, ylabhjust = 0.5, ylabvjust = 0.5, axisLabSize = 16, stripLabSize = 16, title = "Individual marker expression", subtitle = "", caption = ifelse(is(indata, "SingleCellExperiment"), paste0("Total cells, ", nrow(as.data.frame(reducedDim(indata, reducedDim)))), paste0("Total cells, ", nrow(layout))), titleLabSize = 16, subtitleLabSize = 12, captionLabSize = 12, hline = NULL, hlineType = "longdash", hlineCol = "black", hlineWidth = 0.4, vline = NULL, vlineType = "longdash", vlineCol = "black", vlineWidth = 0.4, gridlines.major = TRUE, gridlines.minor = TRUE, borderWidth = 0.8, borderColour = "black" )
markerExpression( indata, layout = NULL, assay = "scaled", reducedDim = "UMAP", dimColnames = c("UMAP1", "UMAP2"), markers = sample(rownames(indata), 6), ncol = 3, nrow = 2, col = c("darkblue", "yellow"), colMidpoint = 0, alpha = c(0, 1), pointSize = 0.5, legendPosition = "right", legendLabSize = 12, legendKeyHeight = 2.5, xlim = NULL, ylim = NULL, celllab = NULL, labSize = 3, drawConnectors = TRUE, widthConnectors = 0.5, colConnectors = "black", xlab = dimColnames[1], xlabAngle = 0, xlabhjust = 0.5, xlabvjust = 0.5, ylab = dimColnames[2], ylabAngle = 0, ylabhjust = 0.5, ylabvjust = 0.5, axisLabSize = 16, stripLabSize = 16, title = "Individual marker expression", subtitle = "", caption = ifelse(is(indata, "SingleCellExperiment"), paste0("Total cells, ", nrow(as.data.frame(reducedDim(indata, reducedDim)))), paste0("Total cells, ", nrow(layout))), titleLabSize = 16, subtitleLabSize = 12, captionLabSize = 12, hline = NULL, hlineType = "longdash", hlineCol = "black", hlineWidth = 0.4, vline = NULL, vlineType = "longdash", vlineCol = "black", vlineWidth = 0.4, gridlines.major = TRUE, gridlines.minor = TRUE, borderWidth = 0.8, borderColour = "black" )
indata |
A data-frame or matrix, or |
layout |
If 'indata' is a non-SingleCellExperiment object, |
assay |
Name of the assay slot in 'indata' from which data will be
taken, assuming |
reducedDim |
A reduced dimensional component stored within |
dimColnames |
The column names of the dimensions to use. |
markers |
Vector containing marker names to plot. |
ncol |
Number of columns for faceting. |
nrow |
Number of rows for faceting. |
col |
Colours used for generation of fill gradient according to expression values. Can be 2 or 3 colours. |
colMidpoint |
Mid-point (expression value) for the colour range. Only
used when 3 colours are specified by |
alpha |
Control the gradient of colour transparency, with 1 being opaque. |
pointSize |
Size of plotted points. |
legendPosition |
Position of legend |
legendLabSize |
Size of plot legend text. |
legendKeyHeight |
Height of the legend key. |
xlim |
Limits of the x-axis. |
ylim |
Limits of the y-axis. |
celllab |
A vector containing any cells that the user wishes to label in the plot. |
labSize |
Size of labels. |
drawConnectors |
Logical, indicating whether or not to connect plot labels to their corresponding points by line connectors. |
widthConnectors |
Line width of connectors. |
colConnectors |
Line colour of connectors. |
xlab |
Label for x-axis. |
xlabAngle |
Rotation angle of x-axis labels. |
xlabhjust |
Horizontal adjustment of x-axis labels. |
xlabvjust |
Vertical adjustment of x-axis labels. |
ylab |
Label for y-axis. |
ylabAngle |
Rotation angle of y-axis labels. |
ylabhjust |
Horizontal adjustment of y-axis labels. |
ylabvjust |
Vertical adjustment of y-axis labels. |
axisLabSize |
Size of x- and y-axis labels. |
stripLabSize |
Size of the strip (marker) labels. |
title |
Plot title. |
subtitle |
Plot subtitle. |
caption |
Plot caption. |
titleLabSize |
Size of plot title. |
subtitleLabSize |
Size of plot subtitle. |
captionLabSize |
Size of plot caption. |
hline |
Draw one or more horizontal lines passing through this/these values on y-axis. For single values, only a single numerical value is necessary. For multiple lines, pass these as a vector, e.g., c(60,90). |
hlineType |
Line type for hline |
hlineCol |
Colour of hline. |
hlineWidth |
Width of hline. |
vline |
Draw one or more vertical lines passing through this/these values on x-axis. For single values, only a single numerical value is necessary. For multiple lines, pass these as a vector, e.g., c(60,90). |
vlineType |
Line type for vline |
vlineCol |
Colour of vline. |
vlineWidth |
Width of vline. |
gridlines.major |
Logical, indicating whether or not to draw major gridlines. |
gridlines.minor |
Logical, indicating whether or not to draw minor gridlines. |
borderWidth |
Width of the border on the x and y axes. |
borderColour |
Colour of the border on the x and y axes. |
Highlight the individual marker expression profile across a 2-dimensional reduction / embedding, typically contained within a SingleCellExperiment
object. By default, this function plots the expression profile of 6 randomly-selected markers from your data.
A ggplot2
object.
Kevin Blighe <[email protected]>
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) u <- umap::umap(mat)$layout colnames(u) <- c('UMAP1','UMAP2') rownames(u) <- rownames(mat) markerExpression(t(mat), layout = u)
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) u <- umap::umap(mat)$layout colnames(u) <- c('UMAP1','UMAP2') rownames(u) <- rownames(mat) markerExpression(t(mat), layout = u)
Generate box-and-whisker plots illustrating marker expression per k-NN identified cluster. By default, 5 randomly-selected clusters are selected, and the expression profiles of 10 randomly-selected markers are plot across these.
markerExpressionPerCluster( indata, assay = "scaled", clusters = sample(unique(metadata(indata)[["Cluster"]]), 5), clusterAssign = metadata(indata)[["Cluster"]], markers = sample(rownames(indata), 10), ncol = 5, nrow = 2, legendPosition = "none", legendLabSize = 12, legendKeyHeight = 2.5, xlim = NULL, ylim = NULL, yfixed = FALSE, xlab = "Marker", xlabAngle = 90, xlabhjust = 0.5, xlabvjust = 0.5, ylab = "Expression", ylabAngle = 0, ylabhjust = 0.5, ylabvjust = 0.5, axisLabSize = 16, stripLabSize = 16, title = "Marker expression per cluster", subtitle = "", caption = "", titleLabSize = 16, subtitleLabSize = 12, captionLabSize = 12, borderWidth = 0.8, borderColour = "black", verbose = TRUE )
markerExpressionPerCluster( indata, assay = "scaled", clusters = sample(unique(metadata(indata)[["Cluster"]]), 5), clusterAssign = metadata(indata)[["Cluster"]], markers = sample(rownames(indata), 10), ncol = 5, nrow = 2, legendPosition = "none", legendLabSize = 12, legendKeyHeight = 2.5, xlim = NULL, ylim = NULL, yfixed = FALSE, xlab = "Marker", xlabAngle = 90, xlabhjust = 0.5, xlabvjust = 0.5, ylab = "Expression", ylabAngle = 0, ylabhjust = 0.5, ylabvjust = 0.5, axisLabSize = 16, stripLabSize = 16, title = "Marker expression per cluster", subtitle = "", caption = "", titleLabSize = 16, subtitleLabSize = 12, captionLabSize = 12, borderWidth = 0.8, borderColour = "black", verbose = TRUE )
indata |
A data-frame or matrix, or SingleCellExperiment object. If a
data-frame or matrix, this should relate to expression data (cells as
columns; genes as rows). If a |
assay |
Name of the assay slot in |
clusters |
Vector containing clusters to plot. |
clusterAssign |
A vector of cell-to-cluster assignments. This can be
from any source but must align with your cells / variables. There is no
check to ensure this when |
markers |
Vector containing marker names to plot. |
ncol |
Number of columns for faceting. |
nrow |
Number of rows for faceting. |
legendPosition |
Position of legend |
legendLabSize |
Size of plot legend text. |
legendKeyHeight |
Height of the legend key. |
xlim |
Limits of the x-axis. |
ylim |
Limits of the y-axis. |
yfixed |
Logical, specifying whether or not to fix the y-axis scales across all clusters when faceting. |
xlab |
Label for x-axis. |
xlabAngle |
Rotation angle of x-axis labels. |
xlabhjust |
Horizontal adjustment of x-axis labels. |
xlabvjust |
Vertical adjustment of x-axis labels. |
ylab |
Label for y-axis. |
ylabAngle |
Rotation angle of y-axis labels. |
ylabhjust |
Horizontal adjustment of y-axis labels. |
ylabvjust |
Vertical adjustment of y-axis labels. |
axisLabSize |
Size of x- and y-axis labels. |
stripLabSize |
Size of the strip labels. |
title |
Plot title. |
subtitle |
Plot subtitle. |
caption |
Plot caption. |
titleLabSize |
Size of plot title. |
subtitleLabSize |
Size of plot subtitle. |
captionLabSize |
Size of plot caption. |
borderWidth |
Width of the border on the x and y axes. |
borderColour |
Colour of the border on the x and y axes. |
verbose |
Boolean (TRUE / FALSE) to print messages to console or not. |
Generate box-and-whisker plots illustrating marker expression per k-NN identified cluster. By default, 5 randomly-selected clusters are selected, and the expression profiles of 10 randomly-selected markers are plot across these.
A ggplot2
object.
Kevin Blighe <[email protected]>
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(5000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) clus <- clusKNN(mat) markerExpressionPerCluster(t(mat), clusters = c(0, 1), clusterAssign = clus)
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(5000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) clus <- clusKNN(mat) markerExpressionPerCluster(t(mat), clusters = c(0, 1), clusterAssign = clus)
SingleCellExperiment
object.Colour shade a 2-dimensional reduction / embedding based on metadata, typically contained within a SingleCellExperiment
object.
metadataPlot( indata, meta = NULL, reducedDim = "UMAP", dimColnames = c("UMAP1", "UMAP2"), colby = NULL, colkey = NULL, pointSize = 0.5, legendPosition = "right", legendLabSize = 12, legendIconSize = 5, xlim = NULL, ylim = NULL, celllab = NULL, labSize = 3, drawConnectors = TRUE, widthConnectors = 0.5, colConnectors = "black", xlab = dimColnames[1], xlabAngle = 0, xlabhjust = 0.5, xlabvjust = 0.5, ylab = dimColnames[2], ylabAngle = 0, ylabhjust = 0.5, ylabvjust = 0.5, axisLabSize = 16, title = "Metadata plot", subtitle = "", caption = ifelse(is(indata, "SingleCellExperiment"), paste0("Total cells, ", nrow(as.data.frame(reducedDim(indata, reducedDim)))), paste0("Total cells, ", nrow(meta))), titleLabSize = 16, subtitleLabSize = 12, captionLabSize = 12, hline = NULL, hlineType = "longdash", hlineCol = "black", hlineWidth = 0.4, vline = NULL, vlineType = "longdash", vlineCol = "black", vlineWidth = 0.4, gridlines.major = TRUE, gridlines.minor = TRUE, borderWidth = 0.8, borderColour = "black" )
metadataPlot( indata, meta = NULL, reducedDim = "UMAP", dimColnames = c("UMAP1", "UMAP2"), colby = NULL, colkey = NULL, pointSize = 0.5, legendPosition = "right", legendLabSize = 12, legendIconSize = 5, xlim = NULL, ylim = NULL, celllab = NULL, labSize = 3, drawConnectors = TRUE, widthConnectors = 0.5, colConnectors = "black", xlab = dimColnames[1], xlabAngle = 0, xlabhjust = 0.5, xlabvjust = 0.5, ylab = dimColnames[2], ylabAngle = 0, ylabhjust = 0.5, ylabvjust = 0.5, axisLabSize = 16, title = "Metadata plot", subtitle = "", caption = ifelse(is(indata, "SingleCellExperiment"), paste0("Total cells, ", nrow(as.data.frame(reducedDim(indata, reducedDim)))), paste0("Total cells, ", nrow(meta))), titleLabSize = 16, subtitleLabSize = 12, captionLabSize = 12, hline = NULL, hlineType = "longdash", hlineCol = "black", hlineWidth = 0.4, vline = NULL, vlineType = "longdash", vlineCol = "black", vlineWidth = 0.4, gridlines.major = TRUE, gridlines.minor = TRUE, borderWidth = 0.8, borderColour = "black" )
indata |
A data-frame or matrix, or |
meta |
If 'indata' is a non-SingleCellExperiment object, 'meta' must be
activated and relate to a data-frame of metadata that aligns with the rows
of |
reducedDim |
A reduced dimensional embedding stored within |
dimColnames |
The column names of the dimensions to use. |
colby |
If NULL, all points will be coloured differently. If not NULL,
the value is assumed to be a column name in |
colkey |
Vector of name-value pairs relating to value passed to 'col',
e.g., |
pointSize |
Size of plotted points. |
legendPosition |
Position of legend |
legendLabSize |
Size of plot legend text. |
legendIconSize |
Size of plot legend icons / symbols. |
xlim |
Limits of the x-axis. |
ylim |
Limits of the y-axis. |
celllab |
A vector containing any cells that the user wishes to label in the plot. |
labSize |
Size of labels. |
drawConnectors |
Logical, indicating whether or not to connect plot labels to their corresponding points by line connectors. |
widthConnectors |
Line width of connectors. |
colConnectors |
Line colour of connectors. |
xlab |
Label for x-axis. |
xlabAngle |
Rotation angle of x-axis labels. |
xlabhjust |
Horizontal adjustment of x-axis labels. |
xlabvjust |
Vertical adjustment of x-axis labels. |
ylab |
Label for y-axis. |
ylabAngle |
Rotation angle of y-axis labels. |
ylabhjust |
Horizontal adjustment of y-axis labels. |
ylabvjust |
Vertical adjustment of y-axis labels. |
axisLabSize |
Size of x- and y-axis labels. |
title |
Plot title. |
subtitle |
Plot subtitle. |
caption |
Plot caption. |
titleLabSize |
Size of plot title. |
subtitleLabSize |
Size of plot subtitle. |
captionLabSize |
Size of plot caption. |
hline |
Draw one or more horizontal lines passing through this/these values on y-axis. For single values, only a single numerical value is necessary. For multiple lines, pass these as a vector, e.g., c(60,90). |
hlineType |
Line type for hline |
hlineCol |
Colour of hline. |
hlineWidth |
Width of hline. |
vline |
Draw one or more vertical lines passing through this/these values on x-axis. For single values, only a single numerical value is necessary. For multiple lines, pass these as a vector, e.g., c(60,90). |
vlineType |
Line type for vline |
vlineCol |
Colour of vline. |
vlineWidth |
Width of vline. |
gridlines.major |
Logical, indicating whether or not to draw major gridlines. |
gridlines.minor |
Logical, indicating whether or not to draw minor gridlines. |
borderWidth |
Width of the border on the x and y axes. |
borderColour |
Colour of the border on the x and y axes. |
Colour shade a 2-dimensional reduction / embedding based on metadata, typically contained within a SingleCellExperiment
object.
A ggplot2
object.
Kevin Blighe <[email protected]>
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) u <- umap::umap(mat)$layout colnames(u) <- c('UMAP1','UMAP2') rownames(u) <- rownames(mat) metadata <- data.frame( group = c(rep('PB1', 25), rep('PB2', 25)), row.names = rownames(u)) metadataPlot(u, meta = metadata, colby = 'group')
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) u <- umap::umap(mat)$layout colnames(u) <- c('UMAP1','UMAP2') rownames(u) <- rownames(mat) metadata <- data.frame( group = c(rep('PB1', 25), rep('PB2', 25)), row.names = rownames(u)) metadataPlot(u, meta = metadata, colby = 'group')
SingleCellExperiment
object, using the basic R implementation of UMAP.Perform UMAP on an input data-frame or matrix, or SingleCellExperiment
object, using the basic R implementation of UMAP.
performUMAP( indata, config = NULL, assay = "scaled", reducedDim = NULL, dims = seq_len(20), newDimName = NULL, useMarkers = NULL, verbose = TRUE )
performUMAP( indata, config = NULL, assay = "scaled", reducedDim = NULL, dims = seq_len(20), newDimName = NULL, useMarkers = NULL, verbose = TRUE )
indata |
A data-frame or matrix, or |
config |
UMAP configuration settings |
assay |
Name of the assay slot in |
reducedDim |
A dimensional reduction / embedding stored within
|
dims |
If 'reducedDim' is activated, the number of dimensions to use. |
newDimName |
Name for the new dimensional embedding that will be produced.
If nothing is selected for neither this nor |
useMarkers |
Before performing UMAP, subset the data for these markers. |
verbose |
Boolean (TRUE / FALSE) to print messages to console or not. |
Perform UMAP on an input data-frame or matrix, or SingleCellExperiment
object, using the basic R implementation of UMAP.
A SingleCellExperiment
object.
Kevin Blighe <[email protected]>
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) performUMAP(mat)
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) performUMAP(mat)
Highlight cell-to-cluster assignments across a 2-dimensional reduction / embedding.
plotClusters( indata, clusterVector = NULL, reducedDim = "UMAP", dimColnames = c("UMAP1", "UMAP2"), clusterColname = "Cluster", pointSize = 0.5, legendPosition = "none", legendLabSize = 12, xlim = NULL, ylim = NULL, label = TRUE, labSize = 5, drawConnectors = TRUE, widthConnectors = 0.5, colConnectors = "black", xlab = dimColnames[1], xlabAngle = 0, xlabhjust = 0.5, xlabvjust = 0.5, ylab = dimColnames[2], ylabAngle = 0, ylabhjust = 0.5, ylabvjust = 0.5, axisLabSize = 16, title = "k-nearest neighbour (k-NN) clusters", subtitle = "", caption = ifelse(is(indata, "SingleCellExperiment"), paste0("Total cells, ", nrow(as.data.frame(reducedDim(indata, reducedDim)))), paste0("Total cells, ", length(clusterVector))), titleLabSize = 16, subtitleLabSize = 12, captionLabSize = 12, hline = NULL, hlineType = "longdash", hlineCol = "black", hlineWidth = 0.4, vline = NULL, vlineType = "longdash", vlineCol = "black", vlineWidth = 0.4, gridlines.major = TRUE, gridlines.minor = TRUE, borderWidth = 0.8, borderColour = "black", verbose = TRUE )
plotClusters( indata, clusterVector = NULL, reducedDim = "UMAP", dimColnames = c("UMAP1", "UMAP2"), clusterColname = "Cluster", pointSize = 0.5, legendPosition = "none", legendLabSize = 12, xlim = NULL, ylim = NULL, label = TRUE, labSize = 5, drawConnectors = TRUE, widthConnectors = 0.5, colConnectors = "black", xlab = dimColnames[1], xlabAngle = 0, xlabhjust = 0.5, xlabvjust = 0.5, ylab = dimColnames[2], ylabAngle = 0, ylabhjust = 0.5, ylabvjust = 0.5, axisLabSize = 16, title = "k-nearest neighbour (k-NN) clusters", subtitle = "", caption = ifelse(is(indata, "SingleCellExperiment"), paste0("Total cells, ", nrow(as.data.frame(reducedDim(indata, reducedDim)))), paste0("Total cells, ", length(clusterVector))), titleLabSize = 16, subtitleLabSize = 12, captionLabSize = 12, hline = NULL, hlineType = "longdash", hlineCol = "black", hlineWidth = 0.4, vline = NULL, vlineType = "longdash", vlineCol = "black", vlineWidth = 0.4, gridlines.major = TRUE, gridlines.minor = TRUE, borderWidth = 0.8, borderColour = "black", verbose = TRUE )
indata |
A data-frame or matrix, or |
clusterVector |
If |
reducedDim |
A reduced dimensional embedding stored within 'indata', e.g., PCA or UMAP. |
dimColnames |
The column names of the dimensions to use. |
clusterColname |
The column name in the metadata of |
pointSize |
Size of plotted points. |
legendPosition |
Position of legend |
legendLabSize |
Size of plot legend text. |
xlim |
Limits of the x-axis. |
ylim |
Limits of the y-axis. |
label |
Logical, indicating whether or not to label the clusters. |
labSize |
Size of labels. |
drawConnectors |
Logical, indicating whether or not to connect plot labels to their corresponding cluster islands by line connectors. |
widthConnectors |
Line width of connectors. |
colConnectors |
Line colour of connectors. |
xlab |
Label for x-axis. |
xlabAngle |
Rotation angle of x-axis labels. |
xlabhjust |
Horizontal adjustment of x-axis labels. |
xlabvjust |
Vertical adjustment of x-axis labels. |
ylab |
Label for y-axis. |
ylabAngle |
Rotation angle of y-axis labels. |
ylabhjust |
Horizontal adjustment of y-axis labels. |
ylabvjust |
Vertical adjustment of y-axis labels. |
axisLabSize |
Size of x- and y-axis labels. |
title |
Plot title. |
subtitle |
Plot subtitle. |
caption |
Plot caption. |
titleLabSize |
Size of plot title. |
subtitleLabSize |
Size of plot subtitle. |
captionLabSize |
Size of plot caption. |
hline |
Draw one or more horizontal lines passing through this/these values on y-axis. For single values, only a single numerical value is necessary. For multiple lines, pass these as a vector, e.g., c(60,90). |
hlineType |
Line type for hline |
hlineCol |
Colour of hline. |
hlineWidth |
Width of hline. |
vline |
Draw one or more vertical lines passing through this/these values on x-axis. For single values, only a single numerical value is necessary. For multiple lines, pass these as a vector, e.g., c(60,90). |
vlineType |
Line type for vline |
vlineCol |
Colour of vline. |
vlineWidth |
Width of vline. |
gridlines.major |
Logical, indicating whether or not to draw major gridlines. |
gridlines.minor |
Logical, indicating whether or not to draw minor gridlines. |
borderWidth |
Width of the border on the x and y axes. |
borderColour |
Colour of the border on the x and y axes. |
verbose |
Boolean (TRUE / FALSE) to print messages to console or not. |
Highlight cell-to-cluster assignments across a 2-dimensional reduction / embedding.
A ggplot2
object.
Kevin Blighe <[email protected]>
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) u <- umap::umap(mat) clusvec <- clusKNN(u$layout) plotClusters(u$layout, clusvec)
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) u <- umap::umap(mat) clusvec <- clusKNN(u$layout) plotClusters(u$layout, clusvec)
Find enriched markers per identified cluster and visualise these as a custom corrplot.
plotSignatures( indata, assay = "scaled", clusterAssign = metadata(indata)[["Cluster"]], funcSummarise = function(x) mean(x, na.rm = TRUE), col = colorRampPalette(brewer.pal(9, "RdPu"))(100), labCex = 1, legendPosition = "right", legendCex = 1, labDegree = 90, verbose = TRUE )
plotSignatures( indata, assay = "scaled", clusterAssign = metadata(indata)[["Cluster"]], funcSummarise = function(x) mean(x, na.rm = TRUE), col = colorRampPalette(brewer.pal(9, "RdPu"))(100), labCex = 1, legendPosition = "right", legendCex = 1, labDegree = 90, verbose = TRUE )
indata |
A data-frame or matrix, or |
assay |
Name of the assay slot in |
clusterAssign |
A vector of cell-to-cluster assignments. This can be
from any source but must align with your cells / variables. There is no
check to ensure this when |
funcSummarise |
A mathematical function used to summarise expression per marker, per cluster. |
col |
colorRampPalette to be used for shading low-to-high expression. |
labCex |
cex (size) of the main plot labels. |
legendPosition |
position of legend. Can be one of 'top', 'right', 'bottom', 'left' |
legendCex |
cex (size) of the legend labels. |
labDegree |
Rotation angle of the main plot labels. |
verbose |
Boolean (TRUE / FALSE) to print messages to console or not. |
Find enriched markers per identified cluster and visualise these as a custom corrplot. plotSignatures
first collapses your input data's expression profiles from the level of cells to the level of clusters based on a mathematical function specified by funcSummarise
. It then centers and scales the data range to be between -1 and +1 for visualisation purposes.
A corrplot
object.
Kevin Blighe <[email protected]>
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) u <- umap::umap(mat)$layout colnames(u) <- c('UMAP1','UMAP2') rownames(u) <- rownames(mat) clus <- clusKNN(u) plotSignatures(t(mat), clusterAssign = clus)
# create random data that follows a negative binomial mat <- jitter(matrix( MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat) <- paste0('CD', 1:ncol(mat)) rownames(mat) <- paste0('cell', 1:nrow(mat)) u <- umap::umap(mat)$layout colnames(u) <- c('UMAP1','UMAP2') rownames(u) <- rownames(mat) clus <- clusKNN(u) plotSignatures(t(mat), clusterAssign = clus)
Input, filter, normalise, and transform FCS expression data.
processFCS( files, assayname = "scaled", metadata = NULL, filter = TRUE, bgNoiseThreshold = 1, euclideanNormThreshold = 1, transformation = TRUE, transFun = function(x) asinh(x), asinhFactor = 5, downsample = 1e+05, downsampleVar = 0.1, colsDiscard = NULL, colsRetain = NULL, newColnames = NULL, emptyValue = TRUE, verbose = TRUE )
processFCS( files, assayname = "scaled", metadata = NULL, filter = TRUE, bgNoiseThreshold = 1, euclideanNormThreshold = 1, transformation = TRUE, transFun = function(x) asinh(x), asinhFactor = 5, downsample = 1e+05, downsampleVar = 0.1, colsDiscard = NULL, colsRetain = NULL, newColnames = NULL, emptyValue = TRUE, verbose = TRUE )
files |
A vector of FCS files. |
assayname |
Name of the assay slot in which data will be stored. |
metadata |
Metadata associated with the FCS files specified in
'files'. A strict rule is enforced requiring that |
filter |
Boolean (TRUE / FALSE) to enable filtering (per sample) for background signal / noise. |
bgNoiseThreshold |
Threshold for background noise. Used when
|
euclideanNormThreshold |
Euclidean norm threshold for background
noise. Used when |
transformation |
Boolean (TRUE / FALSE) to enable data transformation after filtering. |
transFun |
The function to apply (per sample) for transformation.
Typically, for flow and mass cytometry, this is hyperbolic arc sine
( |
asinhFactor |
The factor to apply when transforming via |
downsample |
Downsample to this number of random variables. This is performed on the final merged dataset, i.e., after all samples have been bound together. NULL to disable. |
downsampleVar |
Downsample based on variance. Removes this proportion of cells based on lesser variance. This is applied per sample. If user wishes to apply this globally on the final merged dataset, then set this to 0 and remove based on variance manually. |
colsDiscard |
Columns to be removed from the final merged data. These names are literal and must match exactly. |
colsRetain |
Retain these columns only. This is the same as |
newColnames |
A named vector of new marker names to assign to each sample.
The values of this vector should be the new marker names; the names of this
vector should represent the ooriginal marker names. This operation is performed
AFTER any operation involving |
emptyValue |
boolean (taken from ?flowCore::read.FCS indicating whether or not we allow an empty value for keyword values in TEXT segment. |
verbose |
Boolean (TRUE / FALSE) to print messages to console or not. |
Input, filter, normalise, and transform FCS expression data.
A SingleCellExperiment
object.
Kevin Blighe <[email protected]>
# create random data that follows a negative binomial mat1 <- jitter(matrix( MASS::rnegbin(rexp(50000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat1) <- paste0('CD', 1:ncol(mat1)) rownames(mat1) <- paste0('cell', 1:nrow(mat1)) mat2 <- jitter(matrix( MASS::rnegbin(rexp(50000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat2) <- paste0('CD', 1:ncol(mat2)) rownames(mat2) <- paste0('cell', 1:nrow(mat2)) metadata <- data.frame( group = c('PB1', 'PB2'), row.names = c('mat1', 'mat2'), stringsAsFactors = FALSE)
# create random data that follows a negative binomial mat1 <- jitter(matrix( MASS::rnegbin(rexp(50000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat1) <- paste0('CD', 1:ncol(mat1)) rownames(mat1) <- paste0('cell', 1:nrow(mat1)) mat2 <- jitter(matrix( MASS::rnegbin(rexp(50000, rate=.1), theta = 4.5), ncol = 20)) colnames(mat2) <- paste0('CD', 1:ncol(mat2)) rownames(mat2) <- paste0('cell', 1:nrow(mat2)) metadata <- data.frame( group = c('PB1', 'PB2'), row.names = c('mat1', 'mat2'), stringsAsFactors = FALSE)