Find the cells with the highest (or lowest) expression of the given parameter within the given phenotype. Report the mean expression of the high-expressing cells.

compute_mean_expression(csd, phenotype, param, percentile = NULL, count = NULL)

Arguments

csd

Cell seg data to use. This should already have been filtered for the slides or fields of interest.

phenotype

A phenotype selector. This will be passed to phenoptr::select_rows.

param

The parameter (column) to report, as a string.

percentile

The percentile cutoff for top-expressing cells. For example, to measure the top quartile, the percentile is 0.75. Negative numbers will use low-expressing cells; to measure the bottom decile, use a percentile of -0.1.

count

The number of top expressing cells to use. Only one of percentile and count can be provided. If both are omitted, the mean expression of all cells is returned.

Value

A data frame with columns for count and mean.