Deconvolution

deconvolute(
  bulk_gene_expression,
  model = NULL,
  method = deconvolution_methods,
  single_cell_object = NULL,
  cell_type_annotations = NULL,
  batch_ids = NULL,
  cell_type_column_name = NULL,
  normalize_results = FALSE,
  verbose = FALSE,
  assay_name = NULL,
  ...
)

Arguments

bulk_gene_expression

A matrix with the bulk data. Rows are genes, columns are samples.

model

(Optional) The signature matrix, or for Rectangle a path to the .pkl file returned by build_model(). If NULL, the signature will be computed internally and will not be saved. To reuse a signature, build it first with build_model().

method

A string specifying the method.

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.

batch_ids

A vector of the ids of the samples or individuals.

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.

normalize_results

Whether the deconvolution results should be normalized. Negative values will be put to 0, and the estimates will be normalized to sum to 1. Defaults to NULL.

verbose

Whether to produce an output on the console.

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

A matrix with the probabilities of each cell-type for each individual. Rows are individuals, columns are cell types.

Examples

# More examples can be found in the unit tests at tests/testthat/test-c-deconvolute.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, ]


deconv_bisque <- deconvolute(
  bulk, NULL, "bisque", single_cell_data,
  cell_type_annotations, batch_ids
)
#> You requested to run bisque which is currently not installed. Do you want to install the packages required for it: cozygene/bisque (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 cozygene/bisque@HEAD
#> lpSolve  (NA -> 5.6.23) [CRAN]
#> quadprog (NA -> 1.5-8 ) [CRAN]
#> limSolve (NA -> 2.0.3 ) [CRAN]
#> Installing 3 packages: lpSolve, quadprog, limSolve
#> Installing packages into ‘/home/runner/work/_temp/Library’
#> (as ‘lib’ is unspecified)
#> ── R CMD build ─────────────────────────────────────────────────────────────────
#> * checking for file ‘/tmp/RtmpaRZ4nB/remotes375f4ffa6d9d/cozygene-bisque-8640250/DESCRIPTION’ ... OK
#> * preparing ‘BisqueRNA’:
#> * checking DESCRIPTION meta-information ... OK
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> Omitted ‘LazyData’ from DESCRIPTION
#> * building ‘BisqueRNA_1.0.5.tar.gz’
#> 
#> Installing package into ‘/home/runner/work/_temp/Library’
#> (as ‘lib’ is unspecified)