Builds a hierarchical signature model from single-cell RNA-seq data using
DESeq2-based marker gene selection and optional hierarchical clustering.
The resulting model can be passed to deconvolute() to avoid rebuilding
the signature for every bulk dataset.
build_model_rectanglepy(
single_cell_object,
cell_type_annotations,
bulk_gene_expression = NULL,
model_path = NULL,
optimize_cutoffs = TRUE,
p = 0.015,
lfc = 1.5,
n_cpus = NULL,
gene_expression_threshold = 0.5,
verbose = FALSE,
...
)A matrix with the single-cell data. Rows are genes, columns are cells. Row and column names must be set. Raw counts expected.
A vector of cell type labels, one per column of single_cell_object.
Optional. A matrix of bulk data (rows = genes, columns = samples). When provided, the signature is restricted to genes present in the bulk data.
Optional path where the signature pickle file should be
saved. If NULL (default), a temporary file is used. Providing a permanent
path allows the signature to be reused across R sessions by passing the
same path to deconvolute() or extract_signature_rectanglepy().
Whether to optimize p-value and log-fold-change cutoffs via grid search. Recommended but slow. Default: TRUE.
P-value cutoff for DE analysis. Only used if optimize_cutoffs = FALSE.
Log fold-change cutoff for DE analysis. Only used if optimize_cutoffs = FALSE.
Number of CPUs for DE analysis. NULL uses all available.
Minimum fraction of cells that must express a gene for it to be included in DE analysis. Default: 0.5.
Whether to print progress to the console. Default: FALSE.
Additional arguments, silently ignored. Allows extra parameters to pass through
the deconvolute() dispatcher without error.
Path to a pickle file containing the RectangleSignatureResult.
Pass this path as the signature argument to deconvolute() or
extract_signature_rectanglepy().