View source: R/intensityRanges.R
intensityRanges | R Documentation |
Set the ranges of the marker intensities, to direct construction of the colour bar for plotting.
intensityRanges(x, p=0.01)
x |
A CyData object produced by |
p |
A numeric scalar specifying the quantile at which intensities should be bounded. |
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
.
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.
Aaron Lun
prepareCellData
,
plotSphereIntensity
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])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.