intensityRanges: Define intensity ranges

View source: R/intensityRanges.R

intensityRangesR Documentation

Define intensity ranges

Description

Set the ranges of the marker intensities, to direct construction of the colour bar for plotting.

Usage

intensityRanges(x, p=0.01)

Arguments

x

A CyData object produced by prepareCellData.

p

A numeric scalar specifying the quantile at which intensities should be bounded.

Details

For each marker, intensities across all cells are used to calculate the p and 1-p quantiles. This defines the lower and upper bound, respectively, to use as the irange argument in plotSphereIntensity. The aim is to prevent extreme outliers from skewing the distribution of colours. This would result in loss of resolution at non-outlier values.

Note that, while the bounds are defined at the quantiles p and 1-p, the colour gradient will not be computed across the percentiles. That is, the “middle” of the gradient will not represent the median cell intensity. Rather, the colour gradient is computed from the lower and upper bounds, so the middle with represent the average of the bounds. Users should label the colour bar with the bounded intensities, rather than with the values of p or 1-p.

Value

A matrix specifying the lower and upper bounds (rows) on the intensity for each marker (columns). Markers used in distance calculations (see markers in ?prepareCellData) are listed first, followed by the unused markers.

Author(s)

Aaron Lun

See Also

prepareCellData, plotSphereIntensity

Examples

example(countCells, echo=FALSE) # Using the mocked-up data set.
bounds <- intensityRanges(cnt)

# Plotting example (using a subset for fast PCA).
cd.subset <- t(cellIntensities(cnt)[,1:1000])
coords <- prcomp(cd.subset)

chosen.marker <- 5
plotSphereIntensity(coords$x[,1], coords$x[,2], 
    intensity=cd.subset[chosen.marker,], 
    irange=bounds[,chosen.marker])

MarioniLab/cydar documentation built on Aug. 15, 2024, 5:25 a.m.