Search a reduction for observations (e.g. traits) that match a given term (case-insensitive substring search). Then get the factors with the highest mean loading for the matching features.

get_top_factors(
  obj,
  metadata = NULL,
  reduction = NULL,
  term,
  search_col = "label_phe",
  n_quantiles = 10,
  select_quantiles = n_quantiles,
  plot_hist = FALSE,
  verbose = TRUE
)

Arguments

obj

Seurat object or dimensionality reduction object.

metadata

Phenotype metadata. Not needed if obj is a Seurat object.

reduction

Which reduction to extract from. Only used if obj is of class Seurat.

term

Term with which to perform substring search of observations.

search_col

Which column in the observation metadata to perform substring search.

n_quantiles

How many quantiles to bin factor loadings into.

select_quantiles

Which quantiles to return. Defaults to the top quantile only.

plot_hist

Whether to plot the distribution of loadings.

verbose

Print messages.

Value

data.table

Examples

data("DEGAS_seurat") top_factors <- get_top_factors( obj = DEGAS_seurat, term = "parkinson", select_quantiles = 8:10 )
#> Extracting embeddings from Seurat reduction: contributionGene
#> + 2 matching phenotypes identified: #> - HC206 #> - FH1262