msiPlot: Draw a density (median signal intensity) plot

View source: R/msiPlot.R

msiPlotR Documentation

Draw a density (median signal intensity) plot

Description

Function to plot the density (median signal intensity) for given markers.

Usage

msiPlot(cfList, markers, byGroup = NULL, byCluster = NULL, ...)

Arguments

cfList

a cfList object. It should contain at least data in the 'expr' and 'samples' slots.

markers

character vector with column names of the markers to be plotted. A numeric vector is also accepted, note that 1 starts after removing columns 'clusterID' and 'sampleID'.

byGroup

a character, referring to a column name in the samples slot of the cfList. This will be used as the grouping for the y-axis.

byCluster

character vector specifying which cluster to be plotted. This will be used as the grouping for the y-axis.

...

Additional arguments passed on to geom_density_ridges.

Value

None

Examples

# Read Data
dirFCS <- system.file("extdata", package="cytofast")
cfData <- readCytosploreFCS(dir = dirFCS, colNames = "description")

# relabeling of clusterID
levels(cfData@expr[,"clusterID"]) <- gsub("[^0-9]", "", levels(cfData@expr[,"clusterID"]))  

# Add cell counts to cfList and add meta data
cfData <- cellCounts(cfData, frequency = TRUE, scale = TRUE)
meta <- spitzer[match(row.names(cfData@samples), spitzer$CSPLR_ST),]
cfData@samples <- cbind(cfData@samples, meta)

# Remove unnecessary markers
cfData@expr <- cfData@expr[,-c(3:10, 13:16, 55:59, 61:63)]

# Draw median signal intensity plot, by group
msiPlot(cfData, markers = c("MHC.II", "CD45", "CD4"), byGroup = 'group')

# Or by cluster
msiPlot(cfData, markers = c("MHC.II", "CD45", "CD4"), byCluster = c("1", "6", "10"))



KoenAStam/cytofast documentation built on June 1, 2022, 1:15 a.m.