plot_drivers | R Documentation |
This function visualizes the strength of associations between the principal components of an omic data matrix and a set of biological and/or technical features.
plot_drivers( dat, clin, stat = "p", bivariate = TRUE, block = NULL, unblock = NULL, parametric = TRUE, kernel = NULL, kpar = NULL, top = NULL, n_pc = 5L, alpha = NULL, p_adj = NULL, r_adj = FALSE, label = FALSE, pal_tiles = "PiRdBr", lim = NULL, coord_equal = FALSE, title = "Variation By Feature", legend = "right", hover = FALSE )
dat |
Omic data matrix or matrix-like object with rows corresponding to
probes and columns to samples. It is strongly recommended that data be
filtered and normalized prior to plotting. Raw counts stored in
|
clin |
Data frame or matrix with rows corresponding to samples and columns to technical and/or biological features to test for associations with omic data. |
stat |
Association statistic of choice. Currently supports |
bivariate |
Test associations in isolation, or after adjusting for
all remaining covariates? If |
block |
String specifying the name of the column in which to find the blocking variable, should one be accounted for. See Details. |
unblock |
Column name(s) of one or more features for which the
|
parametric |
Compute statistics using parametric association tests?
If |
kernel |
The kernel generating function, if using KPCA. Options include
|
kpar |
A named list of arguments setting parameters for the kernel
function. Only relevant if |
top |
Optional number (if > 1) or proportion (if < 1) of most variable probes to be used for PCA. |
n_pc |
Number of principal components to include in the figure. |
alpha |
Optional significance threshold to impose on associations.
Those with p-values (optionally adjusted) less than or equal to
|
p_adj |
Optional p-value adjustment for multiple testing. Options
include |
r_adj |
Adjust partial R-squared? Only relevant if |
label |
Print association statistics over tiles? |
pal_tiles |
String specifying the color palette to use for heatmap
tiles. Options include the complete collection of |
lim |
Optional vector of length two defining lower and upper bounds for
the scale range. Default is observed extrema for |
coord_equal |
Plot tiles of equal width and height? |
title |
Optional plot title. |
legend |
Legend position. Must be one of |
hover |
Show association statistics by hovering mouse over tiles? If
|
Strength of association may be measured either by –log p-values (if
stat = "p"
) or R-squared (if stat = "r2"
). The former may be
adjusted for multiple testing, while the latter can be adjusted for
covariates.
If bivariate = TRUE
, then association tests are performed between
each PC and each clinical covariate, optionally adjusting for a blocking
variable (if block
is non-NULL
). If bivariate = FALSE
,
then all tests are partial association tests, in the sense that they control
for all remaining covariates.
When bivariate = TRUE
, block = NULL
, and parametric =
TRUE
, significance is computed from Pearson correlation tests (for
continuous features) or ANOVA F-tests (for categorical features). When
parametric = FALSE
, significance is computed from rank-based
alternatives, i.e. Spearman correlation tests (for continuous features) or
Kruskal-Wallis tests (for categorical features).
When bivariate = FALSE
or block
is non-NULL
,
significance is computed from partial correlation tests for continuous data
(Pearson if parametric = TRUE
, Spearman if parametric = FALSE
)
or repeated measures ANOVA F-tests (under rank-transformation if
parametric = FALSE
). In all cases, the alternative hypothesis assumes
a monotonic relationship between variables.
A blocking variable may be provided if samples violate the assumption of
independence, e.g. for studies in which subjects are observed at multiple
time points. If a blocking variable is identified, it will be regressed out
prior to testing for all variables except those explicitly exempted by the
unblock
argument. When supplying a blocking variable, be careful to
consider potential collinearities in the data. For instance, clinical
features may be invariant with respect to subject, while subject may be
nested within other variables like batch or treatment group. The block
and unblock
arguments are intended to help parse out these
relationships.
Numeric and categorical features are tested differently. To protect against
potential mistakes (e.g., one-hot encoding a Boolean variable),
plot_drivers
automatically prints a data frame listing the class of each
feature.
If kernel
is non-NULL
, then KPCA is used instead of PCA. See
plot_kpca
for more info. Details on kernel functions and their
input parameters can be found in kernlab::dots
.
plot_pca
, plot_kpca
library(SummarizedExperiment) library(edgeR) library(dplyr) data(airway) cnts <- assay(airway) keep <- rowSums(cpm(cnts) > 1) >= 4 mat <- cpm(cnts[keep, ], log = TRUE) clin <- colData(airway) %>% as_tibble(.) %>% select(cell, dex) plot_drivers(mat, clin)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.