Skip to contents

TidySampleData convert data from PseudobulkList into a dataframe for each sample across cell types of the top differentially expressed genes for a contrast

Usage

TidySampleData(
  av.exprs.list,
  result.list,
  P.Value.filter,
  logFC.filter,
  top_n_genes = NULL
)

Arguments

av.exprs.list

object returned by `PseudobulkList` summed or average counts

result.list

object returned by object returned by `GetContrastResultsRaw()` or `GetContrastResults()`

P.Value.filter

filter results

logFC.filter

filter results

top_n_genes

instead of stat thresholds above, get expression of n genes specified by this param, subsets each celltype by the top n genes ranked by t statistic.

Value

a list of tidy dataframes by celltype

Examples

if (FALSE) {
av = scglmmr::PseudobulkList(rawcounts = umi,
                             metadata = meta,
                             sample_col = "sample",
                             celltype_col = "celltype",
                             avg_or_sum = 'average')
fit_res = scglmmr::GetContrastResultsRaw(limma.fit.object.list = fit,
                                        coefficient.number = 1,
                                        contrast.name = "foldchangedifference")
le_expr = scglmmr::TopGenesTidySampleExprs(av.exprs.list = av, result.list = fit_res, P.Value.filter = 0.2, logFC.filter=0.1, top_n_genes = 20)
}