| Title: | Conformalized differential expression analysis of multi-condition single-cell data |
|---|---|
| Description: | conformeR provides conformal prediction layers for the cell neighborhood construction step of the LEMUR framework. It implements two complementary approaches, conformal clustering and conformal selection, to quantify uncertainty in the resulting cell neighborhoods, together with tools for visualizing and interpreting the resulting uncertainty sets. |
| Authors: | Justine Leclerc [cre, aut] (ORCID: <https://orcid.org/0009-0002-5667-0778>), Christof Seiler [aut] (ORCID: <https://orcid.org/0000-0001-8802-3642>), Digital Society Initiative - University of Zurich [fnd] (RAI - Reliable AI for Biomedicine) |
| Maintainer: | Justine Leclerc <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.99.1 |
| Built: | 2026-10-19 20:13:43 UTC |
| Source: | https://github.com/BiocStaging/conformeR |
Runs a LEMUR analysis, identifies differential-expression neighborhoods, and applies conformal procedures to a set of genes of interest. The data are split into training, calibration, and test sets based on the covariates specified in the LEMUR design formula.
conformeR( sce, design_lemur = ~1, contrast_column, contrast_levels = NULL, n_embedding = 60, use_assay = "logcounts", test_fraction_lemur = 0.2, cp_train_frac = 0.5, cp_cal_frac = 0.25, cp_alpha = 0.05, genes_of_interest, what = c("conf_selection", "conf_clustering"), n_cores = 1, verbose = TRUE )conformeR( sce, design_lemur = ~1, contrast_column, contrast_levels = NULL, n_embedding = 60, use_assay = "logcounts", test_fraction_lemur = 0.2, cp_train_frac = 0.5, cp_cal_frac = 0.25, cp_alpha = 0.05, genes_of_interest, what = c("conf_selection", "conf_clustering"), n_cores = 1, verbose = TRUE )
sce |
A |
design_lemur |
A formula specifying the design used by LEMUR. |
contrast_column |
A column name specifying the comparison used for differential-expression testing in LEMUR. |
contrast_levels |
when |
n_embedding |
Number of dimensions in the LEMUR embedding. |
use_assay |
Character string specifying the assay to use. |
test_fraction_lemur |
Fraction of cells used as the LEMUR test set. |
cp_train_frac |
Fraction of cells used for conformal training. |
cp_cal_frac |
Fraction of cells used for conformal calibration. |
cp_alpha |
Miscoverage level for the conformal procedures. |
genes_of_interest |
Character vector containing the names of genes to include in the conformal analysis.They need to correspond to the row names of the sce. |
what |
Character vector specifying the conformal procedure(s) to run. |
n_cores |
Number of cores used for parallel processing. |
verbose |
Logical indicating whether to display progress information. |
The conformal procedures are applied to a subset of genes of interest. Genes are processed in chunks to allow parallel computation.
A list containing:
fit_lemurThe LEMUR test-set object restricted to the genes of interest.
nei_lemurThe LEMUR neighborhoods for the genes of interest in the test set.
conf_resultsThe results of the conformal procedures for the genes of interest.
data("sce_reduced") out_conformer <- conformeR(sce_reduced, design_lemur = ~ patient_id + condition, contrast_column = "condition", n_embedding = 15, genes_of_interest = c( "ENSG00000163453", "ENSG00000163734" ) ) out_conformerdata("sce_reduced") out_conformer <- conformeR(sce_reduced, design_lemur = ~ patient_id + condition, contrast_column = "condition", n_embedding = 15, genes_of_interest = c( "ENSG00000163453", "ENSG00000163734" ) ) out_conformer
Visualizes gene-level differential expression and conformal clustering results on the aligned LEMUR UMAP embedding. Cells are displayed according to their LEMUR neighborhood membership and the size of the conformal prediction set. The cells inside and outside the conformal neighborhood prediction set are combined into a single stacked plot, annotated "Inside" / "Outside", with one shared "Set size" legend for the black/grey contours.
plotter_conformal_clustering(conformer_output, genes_to_plot)plotter_conformal_clustering(conformer_output, genes_to_plot)
conformer_output |
A list returned by |
genes_to_plot |
Character vector specifying the genes to plot. |
A single combined ggplot/cowplot object: the
"Inside" panel row stacked above the "Outside" panel row, each row
labeled accordingly, with one shared "Set size" legend (black = set
size 1, grey = the other set size observed in the data) below the
combined grid.
data("sce_reduced") out_conformer <- conformeR(sce_reduced, design_lemur = ~ patient_id + condition, contrast_column = "condition", n_embedding = 15, genes_of_interest = c( "ENSG00000163453", "ENSG00000163734" ) ) plotter_conformal_clustering(out_conformer, genes_to_plot = c( "ENSG00000163453", "ENSG00000163734" ) )data("sce_reduced") out_conformer <- conformeR(sce_reduced, design_lemur = ~ patient_id + condition, contrast_column = "condition", n_embedding = 15, genes_of_interest = c( "ENSG00000163453", "ENSG00000163734" ) ) plotter_conformal_clustering(out_conformer, genes_to_plot = c( "ENSG00000163453", "ENSG00000163734" ) )
Visualizes gene-level differential expression and conformal selection results on the aligned LEMUR UMAP embedding. For each selected gene, cells are shown according to their LEMUR neighborhood membership and conformal selection status (density contours).
plotter_conformal_selection(conformer_output, genes_to_plot)plotter_conformal_selection(conformer_output, genes_to_plot)
conformer_output |
A list returned by |
genes_to_plot |
Character vector specifying the genes to plot. |
A single combined ggplot/cowplot object showing
differential expression and conformal selection results for all
requested genes on the aligned LEMUR UMAP embedding, with one shared
"Conformal selection" legend for the green contours below the grid of
gene panels (instead of one legend per gene).
data("sce_reduced") out_conformer <- conformeR(sce_reduced, design_lemur = ~ patient_id + condition, contrast_column = "condition", n_embedding = 15, genes_of_interest = c( "ENSG00000163453", "ENSG00000163734" ) ) plotter_conformal_selection(out_conformer, genes_to_plot = c( "ENSG00000163453", "ENSG00000163734" ) )data("sce_reduced") out_conformer <- conformeR(sce_reduced, design_lemur = ~ patient_id + condition, contrast_column = "condition", n_embedding = 15, genes_of_interest = c( "ENSG00000163453", "ENSG00000163734" ) ) plotter_conformal_selection(out_conformer, genes_to_plot = c( "ENSG00000163453", "ENSG00000163734" ) )
A small SingleCellExperiment object used to demonstrate the conformeR workflow. Random subset from a real dataset (see source). Code for reproducing from original dataset at: https://github.com/juslecl/conformeR-paper/tree/main/data_preparation 3k cells and 100 genes for 2 patients, 2 conditions, 3 cell-types.
data("sce_reduced")data("sce_reduced")
A SingleCellExperiment object.
This object is a subset of the dataset from Zhao et al. (2021), processed for use as an example dataset in conformeR.
Zhao, W., Dovas, A., Spinazzi, E., et al. (2021). Deconvolution of cell type-specific drug responses in human tumor tissue with single-cell RNA-seq. Genome Medicine, 13, 82. GEO accession: GSE148842.