
Plot conformal selection results on the LEMUR embedding
Source:R/plotter.R
plotter_conformal_selection.RdVisualizes gene-level differential expression and conformal selection
results on the aligned LEMUR UMAP embedding. For each gene, the cells of
the LEMUR neighborhood are colored by their predicted differential
expression. When a gene has at least min_cells_contour selected
cells, green density contours show where the selected cells concentrate.
The number of selected cells is given in each panel title.
Arguments
- conformer_output
A
SingleCellExperimentreturned byconformeRwith"conf_selection"inwhat. Only the test cells (conformeR_split == "test") are plotted.- genes_to_plot
Character vector specifying the genes to plot. They must be among the
genes_of_interestpassed toconformeR().- min_cells_contour
Minimum number of selected cells for a gene before density contours are drawn (default 30). Use
Infto never draw contours.
Value
A single combined ggplot/cowplot object showing
differential expression and conformal selection results for all
requested genes on the aligned LEMUR UMAP embedding. When contours are
drawn, a shared legend is added below the grid of gene panels.
Details
Density contours are normalized to their maximum, so they look the same whether they summarise six cells or six hundred. They are therefore only drawn for genes with enough selected cells; for the other genes only the number of selected cells is reported.
Examples
data("sce_reduced")
sce_conformer <- conformeR(sce_reduced,
design_lemur = ~ patient_id + condition,
contrast_column = "condition",
n_embedding = 15,
genes_of_interest = c(
"ENSG00000163453",
"ENSG00000163734"
)
)
#> Select cells that are considered close with 'harmony'
#> Storing 20% of the data (600 cells) as test data.
#> Regress out global effects using linear method.
#> Find base point for differential embedding
#> Fit differential embedding model
#> Initial error: 4.57e+05
#> ---Fit Grassmann linear model
#> Final error: 1.39e+05
#> Find optimal neighborhood using zscore.
#> Validate neighborhoods using test data
#> Form pseudobulk (summing counts)
#> Calculate size factors for each gene
#> Fit edgeR model on pseudobulk data
#> Fit diff-in-diff effect
#> Find optimal neighborhood using zscore.
#> Validate neighborhoods using test data
#> Form pseudobulk (summing counts)
#> Calculate size factors for each gene
#> Fit edgeR model on pseudobulk data
#> Fit diff-in-diff effect
#> Find optimal neighborhood using zscore.
#> Validate neighborhoods using test data
#> Form pseudobulk (summing counts)
#> Calculate size factors for each gene
#> Fit edgeR model on pseudobulk data
#> Fit diff-in-diff effect
#> Running conformal procedures on 2 gene(s).
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
plotter_conformal_selection(sce_conformer,
genes_to_plot = c(
"ENSG00000163453",
"ENSG00000163734"
)
)