Skip to contents

SCMixedPoisson - Fit a gene level Poisson count mixed generalized linear model.

Usage

SCMixedPoisson(
  gene_data,
  metadata,
  model_formula = "gene ~ offset(log(nUMI)) + timepoint + (1|subjectid)",
  test_variable = NULL,
  covariate_variables = NULL,
  celltype_genes_test = NULL,
  save_path
)

Arguments

gene_data

matrix of raw single cell UMI counts genes as COLUMNS and cells as ROWS; i.e. a transpose t() of Bioconductor or Seurat raw.data slots if genes_test is specified, columns must contain all genes from genes_test i.e. umi_matrix = t(seurat_raw_counts[unique(unlist((genes_test)), ])

metadata

metadata for each cell used for fitting model

model_formula

example: 'gene ~ offset(log(nUMI)) + timepoint + (1|subjectid)' the 'gene~' and '(1|subjectid)' variables should be kept the same. The variable 'timepoint' can be altered to be any treatment or perturbation effect being tested. User can also specify 'covariate_variables' to make formula gene~offset(nUMI) + covariate1 + covariate2 + test_variable + (1|subjectid) automatically.

test_variable

the column of metadata coding the perturbation variable. e.g. 'timepoint' for formula: gene ~ timepoint + (1|subjectid)'

covariate_variables

a vector of variables in metadata to add to the model as covariates; this is only used if model_formula is NULL; otherwise speify directly

celltype_genes_test

An R list indexed by cell type: the subset of genes to test for each cell type.

save_path

file path to save intermediate results for each cell type.

Value

a results matrix for all genes across all cell types tested.

Examples

results = SCMixedPoisson(gene_data = gene_data,
  lme4metadata = meta_data,
  model_formula = 'gene ~ offset(log(nUMI)) + timepoint + (1|sampleid)',
  celltype_genes_test = celltype_indexed_gene_vector
)
#> Error in SCMixedPoisson(gene_data = gene_data, lme4metadata = meta_data,     model_formula = "gene ~ offset(log(nUMI)) + timepoint + (1|sampleid)",     celltype_genes_test = celltype_indexed_gene_vector): unused argument (lme4metadata = meta_data)