View source: R/get_mean_ratio.R
get_mean_ratio | R Documentation |
Calculate the Mean Ratio value and rank for each gene for each cell type in
the sce
object, to identify effective marker genes for deconvolution.
get_mean_ratio(
sce,
cellType_col,
assay_name = "logcounts",
gene_ensembl = NULL,
gene_name = NULL
)
sce |
SummarizedExperiment-class (or any derivative class) object containing single cell/nucleus gene expression data. |
cellType_col |
A |
assay_name |
A |
gene_ensembl |
A |
gene_name |
A |
Note if a cell type has < 10 cells the MeanRatio results may be unstable. See rational in OSCA: https://bioconductor.org/books/3.19/OSCA.multisample/multi-sample-comparisons.html#performing-the-de-analysis.
A tibble::tibble()
with the MeanRatio
values for each gene x cell
type.
gene
is the name of the gene (from rownames(sce
)).
cellType.target
is the cell type we're finding marker genes for.
mean.target
is the mean expression of gene
for cellType.target
.
cellType.2nd
is the second highest non-target cell type.
mean.2nd
is the mean expression of gene
for cellType.2nd
.
MeanRatio
is the ratio of mean.target/mean.2nd
.
MeanRatio.rank
is the rank of MeanRatio
for the cell type.
MeanRatio.anno
is an annotation of the MeanRatio
calculation helpful
for plotting.
gene_ensembl
& gene_name
optional columns from rowData(sce)
specified
by the user to add gene information.
## load example SingleCellExperiment
if (!exists("sce_DLPFC_example")) sce_DLPFC_example <- fetch_deconvo_data("sce_DLPFC_example")
## Explore properties of the sce object
sce_DLPFC_example
## this data contains logcounts of gene expression
SummarizedExperiment::assays(sce_DLPFC_example)$logcounts[1:5, 1:5]
## nuclei are classified in to cell types
table(sce_DLPFC_example$cellType_broad_hc)
## Get the mean ratio for each gene for each cell type defined in
## `cellType_broad_hc`
get_mean_ratio(sce_DLPFC_example, cellType_col = "cellType_broad_hc")
# Option to specify gene_name as the "Symbol" column from rowData
# this will be added to the marker stats output
SummarizedExperiment::rowData(sce_DLPFC_example)
## specify rowData col names for gene_name and gene_ensembl
get_mean_ratio(sce_DLPFC_example,
cellType_col = "cellType_broad_hc",
gene_name = "gene_name",
gene_ensembl = "gene_id"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.