Skip to contents

All functions

AggregateCellMetadata()
AggregateCellMetadata - take cell level metadata and collapse down to sample-level metadata for use in pseudobuk testing. This can be useful if you do not already have metadata for each sample in the experiment, but these data are stored in single cell metadata. For example, metadata for the donor ID, unique sample (e.g. donorid_timepoint), age, sex etc. Note these are all individual sample level data. Single cell intrinsic variables like nUMI cannot be collapsed down, only variables that are unique for each sample which are the columns of the pseudobulk data. Only include metadata that you intend to adjust models for as covariates or random effects because all variables will be referenced during count normalization and feature filtering.
AverageSampleModuleZscore()
AverageSampleModuleZscore apply the function calc_avg_module_zscore to a pseudobulklist.
BulkDesignMatrix()
BulkDesignMatrix - designmatrix for the main experiment factor - used in normalization
CombineResults()
CombineResults - For all cell types merge the gsea leading edge genes with their contrast model coefficieint and p value from limma / dream
EnrichmentJaccard()
EnrichmentJaccard - using gsea list and LeadingEdgeIndexed result, compute pairwise jaccard index of leadingedge genes within celltypes. saves a heatmap of modules for each cell type in savpath if saveplot = TRUE. Returns a gsea result dataframe with all celltypes combined and module annotated with average within celltype jaccard index and leadingedge genes.
ExtractResult()
ExtractResult - convenience function to return statistics for downstream analysis functions such as FgseaList. Returns results from list of dream or lmFit results from those functions natively (use model.fit.list = list(fit)) or from scglmmr::RunVoomLimma and scglmmr::dreamMixedModel
FgseaList()
FgseaList - wrapper around fast gene set enrichment analysis with the fgsea R package https://bioconductor.org/packages/release/bioc/html/fgsea.html to implement on a list of ranks indexec by cell type.
FitDream()
FitDream - run mixed effects model on aggregated (summed) data using the method 'dream' by Hoffman et. al. Bioinformatics (2021) doi.org/10.1093/bioinformatics/btaa687. Fits mixed model using lme4 with REML and voom weights.
FitLmer()
FitLmer - This is a simpler version of FitLmerContrast that makes no assumptions about structure of underlying data except that it can accomodate a mixed effects model formula and that there are multiple cell types to be separately fitted. fit a single cell mixed effects linear model. Designed to fit an aggregated gene module score. Fits a model to each cell cluster to test a grouping, treatment or combination factor; returns model fits for maximum flexibility
FitLmerContrast()
FitLmerContrast - for data with pre post treatment and 2 response groups; within each cell type contrast difference in fold change between groups, baseline difference, and fold change across groups of module scores.
GSEABarPlot()
GSEABarPlot - plot gsea results for a single cell type
GSEABubblePlot()
GSEABubblePlot plot gsea results for all cell types
GetContrastResults()
GetContrastResults - return results from a contrast fit on list of celltypes from RunVoomLimma using topTable
GetContrastResultsRaw()
GetContrastResultsRaw - calculate p values and return contrast results from modelfit with dreamMixedModel
GetGeneMatrix()
GetGeneMatrix get a gene matric for plotting genes by celltypes statistic from pseudobulk model results e.g. using heatmap pheatmap or complexheatmap
GetLeadingEdgeFull()
GetLeadingEdgeFull Get a tidy dataframe of ALL Leading Edge Genes from gene set enrichment for all cell types
GetLeadingEdgeGenes()
GetLeadingEdgeGenes get the leading edge genes from a single cell type / module combination
GetRankResults()
GetRankResults get list of gene ranks by t stat for fGSEA
GetRankResultsRaw()
GetRankResultsRaw get list of gene ranks by raw t statistic for fGSEA. for results returned by dreamMixedModel
GetTidySummary()
GetTidySummary - tidy data summary for a single cell type
HeatmapDiag()
HeatmapDiag utility function for `pheatmap` using `slanter` to order the maximum values across the matrix diagonal
LeadEdgeSampleHeatmap()
LeadEdgeSampleHeatmap make a heatmap of average expression for top or leading edge genes returned by LeadEdgeTidySampleExprs
LeadEdgeTidySampleExprs()
LeadEdgeTidySampleExprs - convert a PseudobulkList into a tidy dataframe for each sample across cell types of the leading edge genes from a gsea list
LeadingEdgeIndexed()
LeadingEdgeIndexed - extract leading edge genes from FgseaList results, return a new embedded list of named modules, indexed by celltype
Normalize()
Normalize - normalize summed gene counts across samples. This is a wrapper around edgeR functions `calcNormFactors` and `filterByExpr`.
NormalizePseudobulk()
NormalizePseudobulk
PlotFgsea()
PlotFgsea identical to GSEABubblePlot, returns plot for manual adjustment or saving and also clusters the map.
PlotGeneDistCohort()
PlotGeneDistCohort
PlotHypergeometric()
PlotHypergeometric - plot results returned by RunHypergeometricTest
PseudobulkList()
PseudobulkList - make a pseudobuk summed or average dataset for each samplexcelltype
RbindGseaResultList()
RbindGseaResultList - prepare gsea result list for visualization funcitons GseaBubblePlot or GseaBarPlot; called by PlotFgseaList
RunFgseaOnRankList()
RunFgseaOnRankList - wrapper around fast gene set enrichment analysis with the fgsea R package https://bioconductor.org/packages/release/bioc/html/fgsea.html
RunHypergeometricTest()
RunHypergeometricTest - run a hypergeometric test on results returned by GetContrastResults or GetContrastResultsRaw
RunVoomLimma()
RunVoomLimma
RunVoomLimma_covar()
RunVoomLimma_covar RunLimmaVoom with an option to adjust for a covariate within mRNA.
SCMixedPoisson()
SCMixedPoisson - Fit a gene level Poisson count mixed generalized linear model.
SubjectCelltypeTable()
SubjectCelltypeTable - quality control on sample level aggregation across cell types
TidySampleData()
TidySampleData convert data from PseudobulkList into a dataframe for each sample across cell types of the top differentially expressed genes for a contrast
WeightedCellModuleScore()
WeightedCellModuleScore - calculate the average or weighted aveage +/- scaling return dataframe of cells by average module score
calc_avg_module_zscore()
calc_avg_module_zscore - calculate average module z score of list of modules on a PseudobulkList This is equivalent to the average z score method used in in Kotliarov et. al. Nature Med 2020 zscore is calculated across both genes and samples it is adopted below to run on 'pseudobulk lists' (average "averagemetacell.list" or pseudobulk list created by PseudobulkList) this small wrapper is called by the AverageSampleModuleZscore. calculate signature score for each cell type, BTM, Subject function input = named list of modules, dataframe with subject as rows genes as columns