Lifecycle:maturing R build status

{width="120px"}

We announce the new tidy and modular interface for a sccomp, which improves modularity, and clarity. The main change is the modularisation of sccomp in functions which can be linked with the pipe operator |>.

library(knitr)

tibble::tribble(
  ~Function, ~Description,
  "Estimation: `sccomp_stimate()`", "which is usually run once in the analysis (per model).",
  "Testing: `sccomp_test()` ", "which candy run multiple times, depending on how many contrasts you want to test (e.g. age, untreated vs treated). ",
  "Outlier removal: `sccomp_remove_outliers()` ", "which is usually run once after `sccomp_estimate()` in case you want to produce estimates not influenced by outlier data points.",
  "Unwanted variation removal: `sccomp_remove_unwanted_variation()`", " which is run after `sccomp_estimate()` and produces a dataset that just preserve the variability of your factor of interest. ",
  "Data replication: `sccomp_replicate()`", "which is run after `sccomp_estimate()` and produces a dataset representing the theoretical data distribution according to the model (from the posterior distribution).",
  "Plotting: `plot()` ", "which is run after `sccomp_test` and outputs a series of summary plots."
) |> 
  kable("html")

A reminder: what is sccomp

sccomp[^1] is a statistical model developed for differential variability analysis in compositional data, primarily used in cellular omics fields like single-cell genomics, proteomics, and microbiomics (Mangiola et al. 2023). It addresses limitations of existing methods in differential abundance analysis by incorporating several advanced features. sccomp effectively models compositional count data properties, which were previously not adequately addressed, and tackles cell-group-specific differential variability. This model uses a constrained Beta-binomial distribution to enable more precise analyses. Key capabilities of sccomp include improved differential abundance analyses through cross-sample information borrowing, outlier identification and exclusion, realistic data simulation, and facilitating cross-study knowledge transfer. By incorporating these features, sccomp provides a more comprehensive and accurate framework for analyzing cellular omics data, identifying crucial biological drivers such as disease progression markers in cancer and pathogen infection.

[^1]: Mangiola, Stefano, et al. "sccomp: Robust differential composition and variability analysis for single-cell data." Proceedings of the National Academy of Sciences 120.33 (2023): e2203828120.

Installation

Bioconductor

if (!requireNamespace("BiocManager")) install.packages("BiocManager")
BiocManager::install("sccomp")

Github

devtools::install_github("stemangiola/sccomp")
library(sccomp)
data("seurat_obj")

Deprecation of the function sccomp_glm()

The new framework

outlier_free_estimate = 
  seurat_obj |>

  # Estimate
  sccomp_estimate( 
    formula_composition = ~ type + continuous_covariate, 
    .sample =  sample, 
    .cell_group = cell_group
  ) |>

  # Remove outliers
  sccomp_remove_outliers() 


# Test
outlier_free_estimate |>
  sccomp_test(contrasts = "typehealthy") 

Replaces the old framework (that now will receive a deprecation warning)

  seurat_obj |>

  # Estimate
  sccomp_glm( 
    formula_composition = ~ type + continuous_covariate, 
    .sample =  sample, 
    .cell_group = cell_group, 
    check_outliers = TRUE,
    contrasts = "typehealthy"
  ) 

New functionalities

Removal of unwanted variation.

For visualisation purposes, we can select factor of interest we would like to preserve the effect for, end exclude all the rest. For example, if we want to produce a dataset with just the type effect, we can execute

outlier_free_estimate |>
  sccomp_remove_unwanted_variation(~ type)

Plotting

The bloating functionalities have been improved. Now, both discrete and continuous variables can be visualised overlaying the to reticle data distribution from the model. This helps the user understanding whether the model is descriptively adequate to the data.

For example, if the theoretical data distribution from the sccomp does not overlap with the observed data distribution, this is an indication that the probability distribution used by sccomp is not suitable for the data or a different model (design matrix) should be used.

outlier_free_estimate |>
  sccomp_test(contrasts = "typehealthy") |> 
  plot()

Now plotting the test against the continuous covariate

outlier_free_estimate |>
  sccomp_test(contrasts = "continuous_covariate") |> 
  plot()


stemangiola/tidyTranscriptomics documentation built on March 14, 2024, 4:24 p.m.