compute_mean_expression_many: Compute mean expression of cells for multiple phenotypes and...

Description Usage Arguments Details Value See Also

View source: R/mean_expression.R

Description

For each given combination of phenotype and expression parameter, report the mean expression of the given marker in the specified cells.

Usage

1
2
3
4
5
6
7
8
9
compute_mean_expression_many(
  csd,
  phenotypes,
  params,
  tissue_categories = NULL,
  percentile = NULL,
  count = NULL,
  .by = "Slide ID"
)

Arguments

csd

Cell seg data to use. This should already have been filtered for the slides or fields of interest. It may already be nested by !!.by and Tissue Category.

phenotypes

A named list of phenotype selectors (see phenoptr::parse_phenotypes).

params

A named list matching phenotype names to expression column names.

tissue_categories

Optional vector of tissue category names to include.

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, all cells matching the phenotype are used and the result is the overall mean expression.

.by

Column to aggregate by

Details

This is a very flexible function. If percentile and count are both omitted, it will compute the mean expression for all cells in the given phenotype. If either percentile or count is given, the mean expression of the highest expressing cells is computed. If a negative percentile is given, the lowest percentile is used; for example percentile=-.1 would give the expression of the lowest-expressing decile.

By default, this function aggregates by Slide ID and Tissue Category. To compute mean expression by a different aggregate, pass a column name in the .by parameter.

To aggregate over all cells, include "Total Cells"=NA as one of the phenotypes.

Value

A data frame with a column for mean for each param_pair.

See Also

Other aggregation functions: compute_density_from_cell_summary(), compute_density_from_table(), compute_h_score_from_score_data(), compute_h_score(), compute_mean_expression(), compute_positivity_many(), compute_positivity(), count_phenotypes(), counts_to_percents()


akoyabio/phenoptrReports documentation built on Jan. 17, 2022, 6:22 p.m.