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 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 for which a signature/model can be built are AutoGeneS, BSeq-Sc, DWLS, CIBERSORTx, MOMF, Scaden

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
)
#> You requested to run momf which is currently not installed. Do you want to install the packages required for it: omnideconv/MOMF (Yes/no/cancel) 
#> To install the dependencies for all methods at once, run devtools::install_github("omnideconv/omnideconv", dependencies = c("Imports", "Suggests"))
#> Using github PAT from envvar GITHUB_PAT. Use `gitcreds::gitcreds_set()` and unset GITHUB_PAT in .Renviron (or elsewhere) if you want to use the more secure git credential store instead.
#> Downloading GitHub repo omnideconv/MOMF@HEAD
#> RcppEigen    (NA -> 0.3.4.0.2) [CRAN]
#> cpp11        (NA -> 0.5.0    ) [CRAN]
#> rgl          (NA -> 1.3.1    ) [CRAN]
#> RcppArmad... (NA -> 14.0.2-1 ) [CRAN]
#> matlib       (NA -> 1.0.0    ) [CRAN]
#> Installing 5 packages: RcppEigen, cpp11, rgl, RcppArmadillo, matlib
#> Installing packages into ‘/home/runner/work/_temp/Library’
#> (as ‘lib’ is unspecified)
#> ── R CMD build ─────────────────────────────────────────────────────────────────
#> * checking for file ‘/tmp/RtmpBpfbf5/remotes337a48eaa55c/omnideconv-MOMF-83a5673/DESCRIPTION’ ... OK
#> * preparing ‘MOMF’:
#> * checking DESCRIPTION meta-information ... OK
#> * cleaning src
#> * installing the package to process help pages
#> * saving partial Rd database
#> * cleaning src
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> * looking to see if a ‘data/datalist’ file should be added
#> * building ‘MOMF_0.2.0.tar.gz’
#> 
#> Installing package into ‘/home/runner/work/_temp/Library’
#> (as ‘lib’ is unspecified)