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 object |
cellType_col |
A |
assay_name |
A |
gene_ensembl |
A |
gene_name |
A |
Improved argument names and documentaion, but same functionalty from get_mean_ratio2()
.
A 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 cols spcified by the user to add gene infomation
## Get the mean ratio for each gene for each cell type defined in `cellType`
get_mean_ratio(sce_ab, cellType_col = "cellType")
# gene cellType.target mean.target cellType.2nd mean.2nd MeanRatio MeanRatio.rank MeanRatio.anno
# <chr> <fct> <dbl> <fct> <dbl> <dbl> <int> <chr>
# 1 ENSG00000230615 Inhib.2 1.00 Excit.2 0.239 4.20 1 Inhib.2/Excit.2: 4.197
# 2 ENSG00000162512 Inhib.2 1.71 Astro 0.512 3.35 2 Inhib.2/Astro: 3.346
# 3 ENSG00000137965 Inhib.2 0.950 Astro 0.413 2.30 3 Inhib.2/Astro: 2.301
# 4 ENSG00000060718 Inhib.2 3.32 Astro 1.47 2.26 4 Inhib.2/Astro: 2.264
# 5 ENSG00000162631 Inhib.2 3.55 Astro 1.62 2.19 5 Inhib.2/Astro: 2.19
# Option to specify gene_name as the "Symbol" column from rowData
# this will be added to the marker stats output
SummarizedExperiment::rowData(sce_ab)
get_mean_ratio(sce_ab, cellType_col = "cellType", gene_name = "Symbol", gene_ensembl = "gene_id")
# A tibble: 1,778 × 10
# gene cellType.target mean.target cellType.2nd mean.2nd MeanRatio MeanRatio.rank MeanRatio.anno gene_ensembl gene_name
# <chr> <fct> <dbl> <fct> <dbl> <dbl> <int> <chr> <chr> <chr>
# 1 ENSG00000230615 Inhib.2 1.00 Excit.2 0.239 4.20 1 Inhib.2/Excit.2… ENSG0000023… AL139220…
# 2 ENSG00000162512 Inhib.2 1.71 Astro 0.512 3.35 2 Inhib.2/Astro: … ENSG0000016… SDC3
# 3 ENSG00000137965 Inhib.2 0.950 Astro 0.413 2.30 3 Inhib.2/Astro: … ENSG0000013… IFI44
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.