prepareCellData: Prepare mass cytometry data

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/prepareCellData.R

Description

Convert single-cell marker intensities from a mass cytometry experiment into a format for efficient counting.

Usage

1
prepareCellData(x, markers = NULL, ...)

Arguments

x

A named list of numeric matrices, where each matrix corresponds to a sample and contains expression intensities for each cell (row) and each marker (column).

Alternatively, a ncdfFlowSet object containing the same information.

markers

A character vector containing the names of the markers to use in downstream analyses.

...

Additional arguments to pass to buildIndex.

Details

This function constructs a BiocNeighborIndex object from the marker intensities of each cell in one or more samples. The precomputed index is used to speed up downstream nearest-neighbour searching, avoiding redundant work from repeated calls to countCells (e.g., with different values of tol).

If markers is specified, only the selected markers will be used in the precomputation. This restricts the markers that are used in downstream functions - namely, countCells and neighborDistances. By default, markers=NULL which means that all supplied markers will be used.

Markers that are not in markers will be ignored in distance calculations. However, their intensities are still stored in the output object, for use in functions like medIntensities.

Value

A List containing precomputed values for use in countCells. This includes:

Author(s)

Aaron Lun

See Also

countCells, where the output of this function is used to obtain hypersphere counts.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
### Mocking up some data: ###
nmarkers <- 20
marker.names <- paste0("X", seq_len(nmarkers))
nsamples <- 8
sample.names <- paste0("Y", seq_len(nsamples))

x <- list()
for (i in sample.names) {
    ex <- matrix(rgamma(nmarkers*1000, 2, 2), ncol=nmarkers, nrow=1000)
    colnames(ex) <- marker.names
    x[[i]] <- ex
}

### Running the function: ###
cd <- prepareCellData(x)
cd

cydar documentation built on April 17, 2021, 6:01 p.m.