MyNixOS website logo
Description

Estimating Dynamic Correlation.

Implementations for two different Bayesian models of differential co-expression. scdeco.cop() fits the bivariate Gaussian copula model from Zichen Ma, Shannon W. Davis, Yen-Yi Ho (2023) <doi:10.1111/biom.13701>, while scdeco.pg() fits the bivariate Poisson-Gamma model from Zhen Yang, Yen-Yi Ho (2022) <doi:10.1111/biom.13457>.

scDECO logo

DOI DOI

Description

scDECO is an R package for estimating differential co-expression in single-cell RNA-seq data.

Differential co-expression refers to correlation between two random variables $X_1, X_2$ changing with respect to the value of some covariate(s).

differential coexpression

The package contains implementations for two different Bayesian models:

  1. scDECO.cop: fits a bivariate Gaussian copula model with flexible, covariate-dependent, optionally zero-inflated marginals
  2. scDECO.pg: fits a zero-inflated bivariate Poisson-Gamma model with correlation imparted through a latent bivariate normal variable

Tutorial

Quick video tutorial on the package:

youtube image

Installation

devtools::install_github("YenYiHo-Lab/scDECO")
library(scDECO)

Usage

scdeco.cop

n <- 2500

x.use <- rnorm(n)
w.use <- runif(n,-1,1)
marginals.use <- c("ZINB", "ZIGA")

# simulate data
y.use <- scdeco.sim.cop(marginals=marginals.use, x=x.use,
                    eta1.true=c(-2, 0.8), eta2.true=c(-2, 0.8),
                    beta1.true=c(1, 0.5), beta2.true=c(1, 1),
                    alpha1.true=7, alpha2.true=3,
                    tau.true=c(-0.2, .3), w=w.use)

Parameters:

  • marginals: The two marginals. Options are NB, ZINB, GA, ZIGA, Beta, ZIBEta
  • x: The vector (or matrix) containing the covariate values to be regressed for mean and rho parameters.
  • eta1.true: The coefficients of the 1st marginal's zero-inflation parameter.
  • eta2.true: The coefficients of the 2nd marginal's zero-inflation parameter.
  • beta1.true: The coefficients of the 1st marginal's mean parameter.
  • beta2.true: The coefficients of the 2nd marginal's mean parameter.
  • alpha1.true: The coefficient of the 1st marginal's second parameter.
  • alpha2.true: The coefficient of the 2nd marginal's second parameter.
  • tau.true: The coefficients of the correlation parameter.
  • w: A vector (or matrix) containing the covariate values to be regressed for zero-inflation parameters.

This will simulate a 2-column matrix of NROW(x) rows of observations from the scdeco.cop model.

# fit the model
mcmc.out <- scdeco.cop(y=y.use, x=x.use, marginals=marginals.use, w=w.use,
                     n.mcmc=5000, burn=1000, thin=10)

Parameters:

  • y: 2-column matrix with the dependent variable observations.
  • n.mcmc: The number of MCMC iterations to run.
  • burn: The number of MCMC iterations to burn from the beginning of the chain.
  • thin: The number of MCMC iterations to thin.

This will return a matrix where the columns correspond to the different parameters of the model and the rows correspond to MCMC samples where the burn and thin has already been incorporated.

One can obtain estimates and confidence intervals for each parameter by looking at quantiles of these MCMC samples.

# extract estimates and confidence intervals
lowerupper <- t(apply(mcmc.out, 2, quantile, c(0.025, 0.5, 0.975)))
estmat <- cbind(lowerupper[,1],
                c(c(-2, 0.8), c(-2, 0.8), c(1, 0.5), c(1, 1), 7, 3, c(-0.2, .3)),
                lowerupper[,c(2,3)])
colnames(estmat) <- c("lower", "trueval", "estval", "upper")
estmat

scdeco.pg

n <- 2500
b.use <- c(-3,0.1)

# simulate the data
simdat <- scdeco.sim.pg(N=n, b0=b.use[1], b1=b.use[2],
                        phi1=4, phi2=4, phi3=1/7,
                        mu1=15, mu2=15, mu3=7,
                        tau0=-2, tau1=0.4)

Parameters:

  • N: Sample size for the simulated data.
  • b0: The intercept coefficient of the zero-inflation parameter.
  • b1: The slope coefficient of the zero-inflation parameter.
  • phi1: The over-dispersion parameter of the 1st ZINB marginal.
  • phi2: The over-dispersion parameter of the 2nd ZINB marginal.
  • phi3: The over-dispersion parameter of the ZINB covariate vector.
  • mu1: The mean parameter of the 1st ZINB marginal.
  • mu2: The mean parameter of the 2nd ZINB marginal.
  • mu3: The mean parameter of the ZINB covariate vector.
  • tau0: The intercept coefficient of the correlation parameter.
  • tau1: The slope coefficient of the correlation parameter.

This will simulate a 3-column matrix of $N$ rows, where the first two columns are observations and the third column is the ZINB covariate which will be used in regressing the correlation parameter of the scdeco.pg model.

# fit the model
mcmc.out <- scdeco.pg(dat=simdat,
                      b0=b.use[1], b1=b.use[2],
                      adapt_iter=500,
                      update_iter=500,
                      coda_iter=5000,
                      coda_thin=10,
                      coda_burnin=1000)

Parameters:

  • dat: The 3-column matrix where the first two columns are observations and the third column is the ZINB covariate. An additional covariate can be added as a 4th column if desired.
  • adapt_iter: The number of adaptive iterations to run.
  • update_iter: The number of update iterations to run.
  • coda_iter: The number of MCMC iterations to run after the adapt and update.
  • coda_thin: The number of MCMC iterations to burn from the coda_iter iterations.
  • coda_burnin: The number of MCMC iterations to thin from the coda_burnin iterations.

This will return a matrix where the columns correspond to the different parameters of the model and the rows correspond to MCMC samples where the adapt, update, burn, and thin has already been incorporated.

One can obtain estimates and confidence intervals for each parameter by looking at quantiles of these MCMC samples using the same code as in the scdeco.cop example.

Model Details

For details on the exact models, please see the vignettes of the scDECO R package.

Please Cite

Zichen Ma, Shannon W. Davis, Yen-Yi Ho, Flexible Copula Model for Integrating Correlated Multi-Omics Data from Single-Cell Experiments, Biometrics, Volume 79, Issue 2, June 2023, Pages 1559–1572, https://doi.org/10.1111/biom.13701

Zhen Yang, Yen-Yi Ho, Modeling Dynamic Correlation in Zero-Inflated Bivariate Count Data with Applications to Single-Cell RNA Sequencing Data, Biometrics, Volume 78, Issue 2, June 2022, Pages 766–776, https://doi.org/10.1111/biom.13457

Contact

If you have any questions or found any issues, please contact: [email protected].

Metadata

Version

0.1.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows