Installation

The development version of SplattDR can be installed from Github:

#devtools::install(...elt())

Quickstart

Differential expression tests require a SingleCellExperiment object with a Dose column in the colData slot. To demonstrate its application we generate a simulated dose-response dataset using splattDR.

# Load packages
## TODO: Reduce requirements - look for redundancy
suppressPackageStartupMessages({
  library(dplyr)
  library(ggplot2)
  library(SingleCellExperiment)
  library(splatter)
  #library(MAST)
  library(splattdr)
  library(snseq.stats)
})

# Load sample parameters derived from a real dose-response dataset
data(params)

# Define doses and number of cells per dose
sim.dose = c(0, 0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30)
dose.prob = rep(1/9, 9)

# Simulate dose response data from parameter estimates
sim = splatSimulateDR(params, dose.names = sim.dose, dose.prob = dose.prob, verbose = FALSE)

Basic overview of the dataset such as number of genes etc... for more details on singlecellobject see splatter and SingleCellExperiment packages. TODO: Define outputs

de.prob = getParam(params, 'de.prob')
de.prob
nGenes = getParam(params, 'nGenes')
nGenes

Bayes differential expression test - basic overview of the test and demonstrate. Define what the priors contain and explain the individual elements

# Calculate Bayes prior hyperparameters
priors = sceCalcPriors(sim)

Priors has several elements. - Data list: define - priors

priors$priors #Subset once we have the data output as final
priors$m

To calculate the Bayes factors for individual genes we use the new_bayesDETest function

#R Run
bayes.out = bayesDETest(priors)

Explain the output in details l_likelihood, l_prior_odds, l_Bayes_factor_01

head(bayes.out)

More details exp_bf since this is the criteria for filtering DE Genes How to pick the threshold (1/10 or 1/3) cite the paper Kass Bayes Factor

# plot(cumsum(bayes.out[!is.na(bayes.out$exp_bf), 'exp_bf']), type = 'l')
# abline(h = 1/3, col = 'red')
# abline(h = 1/10, col = 'blue')
hist(log(bayes.out$exp_bf), breaks = 100)
abline(v = log(1/3), col = 'red')
abline(v = log(1/10), col = 'blue')

Advanced parameter setting for Bayes

Fixed vs. calculated prior alter and prior null


Changing the variances




satabdisaha1288/scBT documentation built on June 1, 2025, 4:06 p.m.