run_fastTopics.RdThis function runs the fastTopics model on the provided count matrix, performs differential expression analysis, computes p-values, and returns the factor matrices along with differential expression results.
run_fastTopics(
count_matrix,
nTopics = 10,
n_s = 1000,
n_c = 1,
baseline_method = "constant",
bl_celltype_cells = NULL,
bl_celltype_peak_file = NULL,
fdr_cutoff = 0.05,
outdir,
genome = "hg19",
...
)A numeric matrix or sparse matrix of counts with cells as rows and peaks as columns.
An integer specifying the number of topics to fit. Default is 10.
Number of samples for the DE analysis (default: 1000).
Number of cores for parallel processing in DE analysis (default: 1).
Additional arguments passed to fastTopics::fit_topic_model().
A list containing the factor matrices Fmat and Lmat, differential expression results de_res, p-values matrix p_jk and caculated baseline baseline.
The function ensures that the count matrix has cells as rows and peaks as columns.
It then runs the fastTopics model, performs differential expression analysis,
computes local false discovery rates (lfdr), and calculates p-values for each peak-topic pair.
If locfdr::locfdr fails, it binarizes Fmat based on a threshold and computes p_jk.
if (FALSE) { # \dontrun{
# Assuming 'counts' is your count matrix
results <- run_fastTopics(counts, nTopics = 5)
} # }