Differential analysis (colocalization)
RunDCA.Rd
Runs differential analysis on Moran's Z colocalization scores generated with the
Pixelator
data processing pipeline.
Usage
RunDCA(object, ...)
# S3 method for data.frame
RunDCA(
object,
target,
reference,
contrast_column,
group_vars = NULL,
alternative = c("two.sided", "less", "greater"),
conf_int = TRUE,
p_adjust_method = c("bonferroni", "holm", "hochberg", "hommel", "BH", "BY", "fdr"),
cl = NULL,
verbose = TRUE,
...
)
# S3 method for Seurat
RunDCA(
object,
target,
reference,
contrast_column,
assay = NULL,
group_vars = NULL,
alternative = c("two.sided", "less", "greater"),
conf_int = TRUE,
p_adjust_method = c("bonferroni", "holm", "hochberg", "hommel", "BH", "BY", "fdr"),
cl = NULL,
verbose = TRUE,
...
)
Arguments
- object
An object containing colocalization scores
- ...
Not yet implemented
- target
The name of the target group
- reference
The name of the reference group
- contrast_column
The name of the column where the group labels are stored. This column must include
target
andreference
.- group_vars
An optional character vector with column names to group the tests by.
- alternative
One of 'two.sided', 'less' or 'greater' (see
?wilcox.test
for details)- conf_int
Should confidence intervals be computed? (see
?wilcox.test
for details)- p_adjust_method
One of "bonferroni", "holm", "hochberg", "hommel", "BH", "BY" or "fdr". (see
?p.adjust
for details)- cl
A cluster object created by makeCluster, or an integer to indicate number of child-processes (integer values are ignored on Windows) for parallel evaluations. See Details on performance in the documentation for
pbapply
. The default is NULL, which means that no parallelization is used.- verbose
Print messages
- assay
Name of assay to use
Details
If you are working with a Seurat
object containing a CellGraphAssay
,
the polarization scores are accessed directly from the CellGraphAssay
.
A character vector or factor must be selected with contrast_column
from the
input data (or @meta.data slot from a Seurat
object) which holds the groups
to run the test for. The target
and reference
parameters should refer
to the names of the two groups used for the comparison and these names should be present in
the contrast_column
.
Additional groups
The test is always computed between target
and reference
, but it is possible
to add additional grouping variables with group_vars
. If group_vars
is used,
the test will be computed within each combination of groups. For instance, if we have annotated
cells into cell type populations across two conditions defined by target
and reference
,
we can pass the name of a cell annotation column with group_vars
to run the test
for each cell type.
See also
Other DA-methods:
RunDPA()
Examples
library(pixelatorR)
library(dplyr)
pxl_file <- system.file("extdata/five_cells",
"five_cells.pxl",
package = "pixelatorR")
# Seurat objects
seur1 <- seur2 <- ReadMPX_Seurat(pxl_file)
#> ✔ Created a 'Seurat' object with 5 cells and 80 targeted surface proteins
seur1$sample <- "Sample1"
seur2$sample <- "Sample2"
seur_merged <- merge(seur1, seur2, add.cell.ids = c("A", "B"))
# Subset data to run test on a few markers
seur_merged <- subset(seur_merged,
features = c("CD3", "CD4", "CD8", "CD19",
"CD20", "CD45RA", "CD45RO"))
# Run DCA
dca_markers <- RunDCA(seur_merged, contrast_column = "sample",
target = "Sample1", reference = "Sample2")
#> ℹ Splitting data by: marker_1, marker_2
#> ℹ Running 10 tests
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact confidence intervals with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact confidence intervals with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact confidence intervals with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact confidence intervals with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact confidence intervals with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact confidence intervals with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact confidence intervals with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact confidence intervals with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact confidence intervals with ties
#> Warning: cannot compute exact p-value with ties
#> Warning: cannot compute exact confidence intervals with ties
dca_markers
#> # A tibble: 10 × 15
#> estimate data_type target reference n1 n2 statistic p conf.low
#> <dbl> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl>
#> 1 0 pearson_z Sample1 Sample2 4 4 8 1 -10.8
#> 2 0 pearson_z Sample1 Sample2 5 5 12.5 1 -4.61
#> 3 -0.0000165 pearson_z Sample1 Sample2 5 5 12.5 1 -14.6
#> 4 0 pearson_z Sample1 Sample2 5 5 12.5 1 -11.2
#> 5 0 pearson_z Sample1 Sample2 4 4 8 1 -9.33
#> 6 0 pearson_z Sample1 Sample2 4 4 8 1 -12.7
#> 7 0 pearson_z Sample1 Sample2 4 4 8 1 -13.0
#> 8 0 pearson_z Sample1 Sample2 5 5 12.5 1 -14.7
#> 9 0 pearson_z Sample1 Sample2 5 5 12.5 1 -6.46
#> 10 -0.0000464 pearson_z Sample1 Sample2 5 5 12.5 1 -8.07
#> # ℹ 6 more variables: conf.high <dbl>, method <chr>, alternative <chr>,
#> # marker_1 <chr>, marker_2 <chr>, p_adj <dbl>