Description Usage Arguments Details Value Author(s) See Also Examples

Compute, for each gene, the percentage of variance that is explained by one or more variables of interest.

1 2 3 4 5 6 7 | ```
getVarianceExplained(x, ...)
## S4 method for signature 'ANY'
getVarianceExplained(x, variables, subset_row = NULL)
## S4 method for signature 'SummarizedExperiment'
getVarianceExplained(x, variables = NULL, ..., exprs_values = "logcounts")
``` |

`x` |
A numeric matrix of expression values, usually log-transformed and normalized. Alternatively, a SummarizedExperiment containing such a matrix. |

`...` |
For the generic, arguments to be passed to specific methods. For the SummarizedExperiment method, arguments to be passed to the ANY method. |

`variables` |
A DataFrame or data.frame containing one or more variables of interest.
This should have number of rows equal to the number of columns in For the SummarizedExperiment method, this can also be a character vector specifying column names of |

`subset_row` |
A vector specifying the subset of rows of |

`exprs_values` |
String or integer scalar specifying the expression values for which to compute the variance. |

This function computes the percentage of variance in gene expression that is explained by variables in the sample-level metadata. It allows problematic factors to be quickly identified, as well as the genes that are most affected.

A numeric matrix containing the percentage of variance explained by each factor (column) and for each gene (row).

Aaron Lun

`getExplanatoryPCs`

, which calls this function.

`plotExplanatoryVariables`

, to plot the results.

1 2 3 4 | ```
example_sce <- mockSCE()
example_sce <- logNormCounts(example_sce)
r2mat <- getVarianceExplained(example_sce)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.