cellCounts: Extract cell counts from cfList

View source: R/cellCounts.R

cellCountsR Documentation

Extract cell counts from cfList

Description

A function to add the frequency (or abundance) of cell clusters per sample to a cfList.

Usage

cellCounts(cfList, frequency = FALSE, scale = FALSE)

Arguments

cfList

a cfList object. It should contain at least data in the 'expr' slot.

frequency

one of

  • a logical value. if FALSE, the abundance of the cell counts are used. If TRUE, the frequency of the total amount of given cells is used.

  • a numeric vector of same length as amount of samples

scale

a logical value. Do the cell frequencies need to be centered and scaled? The default scale function is called.

Details

There are several ways to look at the frequency of the created clusters per sample. First, one could look at the abundance of the cells (frequency = FALSE). Second, the frequency of each cluster given as a percentage of total cells of a sample. For example, if the cfList is a collection of CD4+ T cells clusters and one specifies frequency = TRUE, then the percentage of each cluster of the total CD4+ T cells is returned. This is done for each sample separately. Lastly, if there is a specific frequency the user wants to look at it is possible to specify a numeric vector that is treated as the total amount of cells to divide by (e.g. total CD45+ cells). Make sure that with the latter option specify a numeric vector of same length an order as the sampleID in cfList@samples.

The rarity of clusters can vary greatly between each other. One cluster can make up a very large chunk of the total, whereas some clusters only contain a few cells. To equalize the importance of these clusters and make them more comparable (e.g. in the heatmaps), one could choose to scale the data. The default scale is called, which both centers the data to mean zero and scales to unit variance.

Value

Returns the given cfList with a 'counts' slot.

Examples

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

# Add cell counts to cfList
cfData <- cellCounts(cfData)



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