Deconvolution with spacedeconv
deconvolute.Rd
Perform cell type deconvolution with spacedeconv.
Usage
deconvolute(
spatial_obj,
signature = NULL,
single_cell_obj = NULL,
cell_type_col = "cell_ontology_class",
method = NULL,
batch_id_col = NULL,
assay_sc = "counts",
assay_sp = "counts",
return_object = TRUE,
verbose = FALSE,
...
)
Arguments
- spatial_obj
A SpatialExperiment
- signature
Gene Expression Signature
- single_cell_obj
A SingleCellExperiment
- cell_type_col
Column name of the single_cell_obj where the cell type can be found
- method
Deconvolution Method to use, see deconvolution_methods() for a full list of available methods
- batch_id_col
column name of batch ids in single cell object
- assay_sc
which single cell assay to use for computation
- assay_sp
which spatial assay to use for computation
- return_object
Return an Object or result Table, TRUE = Object
- verbose
display more detailed information
- ...
Further parameters passed to the selected deconvolution method
Examples
# more examples can be found in the documentation website
data("spatial_data_2")
spatial_data_2 <- spacedeconv::preprocess(spatial_data_2)
#> ── spacedeconv ─────────────────────────────────────────────────────────────────
#> ℹ testing parameter
#> ✔ parameter OK [44ms]
#>
#> ℹ Removing 85 observations with umi count below threshold
#> ✔ Removed 85 observations with umi count below threshold [639ms]
#>
#> ℹ Removing 13418 variables with all zero expression
#> Warning: There are 13 mitochondrial genes present. Consider removing them.
#> ✔ Removed 13418 variables with all zero expression [631ms]
#>
#> ℹ Removing duplicated genes
#> ✔ Removed duplicated genes [48ms]
#>
#> ℹ Checking for ENSEMBL Identifiers
#> ! Warning: ENSEMBL identifiers detected in gene names
#> ℹ Checking for ENSEMBL Identifiers
#> ℹ Consider using Gene Names for first-generation deconvolution tools
#> ℹ Checking for ENSEMBL Identifiers
#> ✔ Finished Preprocessing [6ms]
#>
spatial_data_2 <- spacedeconv::normalize(spatial_data_2)
#> ── spacedeconv ─────────────────────────────────────────────────────────────────
#> ℹ testing parameter
#> ✔ parameter OK [12ms]
#>
#> ℹ Normalizing using cpm
#> ✔ Finished normalization using cpm [2.3s]
#>
#> ℹ Please note the normalization is stored in an additional assay
deconvolution <- spacedeconv::deconvolute(
spatial_obj = spatial_data_2,
method = "estimate",
)
#> ── spacedeconv ─────────────────────────────────────────────────────────────────
#> ℹ testing parameter
#> ✔ parameter OK [15ms]
#>
#>
#>
#> ── Spatial
#> Assays: "counts" and "cpm"
#> Genes: 23173
#> → without expression: 0 (0%)
#> Spots: 1225
#> Spots under tissue: 1225 (100%)
#> Median Genes Per Spot: 4795
#> → without expression: 0 (0%)
#> Umi count range: 536 - 64683
#> Spots with UMI count below 500: 0 (0%)
#> ✔ Rownames set
#> ✔ Colnames set
#> ℹ deconvoluting
#> Error in loadNamespace(x): there is no package called ‘immunedeconv’
#> ✖ deconvoluting [163ms]
#>