The single_cell_object is expected to have rownames() and colnames()

build_model(
  single_cell_object,
  cell_type_annotations = NULL,
  method = deconvolution_methods,
  batch_ids = NULL,
  bulk_gene_expression = NULL,
  verbose = FALSE,
  cell_type_column_name = NULL,
  markers = NULL,
  assay_name = NULL,
  ...
)

Arguments

single_cell_object

A matrix or dataframe with the single-cell data. Rows are genes, columns are samples. Row and column names need to be set. Alternatively a SingleCellExperiment or an AnnData object can be provided. In that case, note that cell-type labels need to be indicated either directly providing a vector (cell_type_annotations) or by indicating the column name that indicates the cell-type labels (cell_type_column_name). (Anndata: obs object, SingleCellExperiment: colData object).

cell_type_annotations

A vector of the cell type annotations. Has to be in the same order as the samples in single_cell_object.

method

A string specifying the method. Supported methods are the ones in the variable 'deconvolution_methods'

batch_ids

A vector of the ids of the samples or individuals.

bulk_gene_expression

A matrix of bulk data. Rows are genes, columns are samples. Necessary for MOMF and Scaden, defaults to NULL. Row and column names need to be set

verbose

Whether to produce an output on the console.

cell_type_column_name

Name of the column in (Anndata: obs, SingleCellExperiment: colData), that contains the cell-type labels. Is only used if no cell_type_annotations vector is provided.

markers

Named list of cell type marker genes. This parameter is only used by BSeq-sc. The type of gene identifiers (names(markers)) must be the same as the ones used as feature/row names in the single_cell_object.

assay_name

Name of the assay/layer of the single_cell_object that should be used to extract the data

...

Additional parameters, passed to the algorithm used

Value

The signature matrix. Rows are genes, columns are cell types.

Examples

# More examples can be found in the unit tests at tests/testthat/test-b-buildmodel.R
data("single_cell_data_1")
data("cell_type_annotations_1")
data("batch_ids_1")
data("bulk")

single_cell_data <- single_cell_data_1[1:2000, 1:500]
cell_type_annotations <- cell_type_annotations_1[1:500]
batch_ids <- batch_ids_1[1:500]
bulk <- bulk[1:2000, ]

signature_matrix_momf <- build_model(
  single_cell_data, cell_type_annotations, "momf",
  bulk_gene_expression = bulk
)
#> Warning: RGL: unable to open X11 display
#> Warning: 'rgl.init' failed, running with 'rgl.useNULL = TRUE'.