R/methods.R
, R/methods_SE.R
test_stratification_cellularity-methods.Rd
test_stratification_cellularity() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with additional columns for the statistics from the hypothesis test.
test_stratification_cellularity(
.data,
.formula,
.sample = NULL,
.transcript = NULL,
.abundance = NULL,
method = "cibersort",
reference = X_cibersort,
...
)
# S4 method for spec_tbl_df
test_stratification_cellularity(
.data,
.formula,
.sample = NULL,
.transcript = NULL,
.abundance = NULL,
method = "cibersort",
reference = X_cibersort,
...
)
# S4 method for tbl_df
test_stratification_cellularity(
.data,
.formula,
.sample = NULL,
.transcript = NULL,
.abundance = NULL,
method = "cibersort",
reference = X_cibersort,
...
)
# S4 method for tidybulk
test_stratification_cellularity(
.data,
.formula,
.sample = NULL,
.transcript = NULL,
.abundance = NULL,
method = "cibersort",
reference = X_cibersort,
...
)
# S4 method for SummarizedExperiment
test_stratification_cellularity(
.data,
.formula,
.sample = NULL,
.transcript = NULL,
.abundance = NULL,
method = "cibersort",
reference = X_cibersort,
...
)
# S4 method for RangedSummarizedExperiment
test_stratification_cellularity(
.data,
.formula,
.sample = NULL,
.transcript = NULL,
.abundance = NULL,
method = "cibersort",
reference = X_cibersort,
...
)
A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment))
A formula representing the desired linear model. The formula can be of two forms: multivariable (recommended) or univariable Respectively: \"factor_of_interest ~ .\" or \". ~ factor_of_interest\". The dot represents cell-type proportions, and it is mandatory. If censored regression is desired (coxph) the formula should be of the form \"survival::Surv\(y, dead\) ~ .\"
The name of the sample column
The name of the transcript/gene column
The name of the transcript/gene abundance column
A string character. Either \"cibersort\", \"epic\" or \"llsr\". The regression method will be chosen based on being multivariable: lm or cox-regression (both on logit-transformed proportions); or univariable: beta or cox-regression (on logit-transformed proportions). See .formula for multi- or univariable choice.
A data frame. The transcript/cell_type data frame of integer transcript abundance
Further parameters passed to the method deconvolve_cellularity
A consistent object (to the input) with additional columns for the statistics from the hypothesis test (e.g., log fold change, p-value and false discovery rate).
A consistent object (to the input) with additional columns for the statistics from the hypothesis test (e.g., log fold change, p-value and false discovery rate).
A consistent object (to the input) with additional columns for the statistics from the hypothesis test (e.g., log fold change, p-value and false discovery rate).
`r lifecycle::badge("maturing")`
This routine applies a deconvolution method (e.g., Cibersort; DOI: 10.1038/nmeth.3337) and passes the proportions inferred into a generalised linear model (DOI:dx.doi.org/10.1007/s11749-010-0189-z) or a cox regression model (ISBN: 978-1-4757-3294-8)
Underlying method for the test: data deconvolve_cellularity( !!.sample, !!.transcript, !!.abundance, method=method, reference = reference, action="get", ... ) [..] mutate(.high_cellularity = .proportion > median(.proportion)) survival::survdiff(data = data, .my_formula)
library(dplyr)
library(tidyr)
tidybulk::se_mini |>
test_stratification_cellularity(
survival::Surv(days, dead) ~ .,
cores = 1
)
#> # A tibble: 22 × 6
#> .cell_type cell_t…¹ .low_…² .high…³ pvalue plot
#> <chr> <list> <dbl> <dbl> <dbl> <list>
#> 1 cibersort.B.cells.naive <tibble> 3.35 0.65 0.0389 <ggsrvplt>
#> 2 cibersort.B.cells.memory <tibble> 3.35 0.65 0.0389 <ggsrvplt>
#> 3 cibersort.Plasma.cells <tibble> NA NA NA <NULL>
#> 4 cibersort.T.cells.CD8 <tibble> 3.22 0.783 0.299 <ggsrvplt>
#> 5 cibersort.T.cells.CD4.naive <tibble> 2.43 1.57 0.502 <ggsrvplt>
#> 6 cibersort.T.cells.CD4.memory.res… <tibble> 2.77 1.23 0.782 <ggsrvplt>
#> 7 cibersort.T.cells.CD4.memory.act… <tibble> 3.8 0.2 0.0455 <ggsrvplt>
#> 8 cibersort.T.cells.follicular.hel… <tibble> 3.35 0.65 0.0389 <ggsrvplt>
#> 9 cibersort.T.cells.regulatory..Tr… <tibble> 3.22 0.783 0.774 <ggsrvplt>
#> 10 cibersort.T.cells.gamma.delta <tibble> NA NA NA <NULL>
#> # … with 12 more rows, and abbreviated variable names ¹cell_type_proportions,
#> # ².low_cellularity_expected, ³.high_cellularity_expected