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 class 'spec_tbl_df'
test_stratification_cellularity(
.data,
.formula,
.sample = NULL,
.transcript = NULL,
.abundance = NULL,
method = "cibersort",
reference = X_cibersort,
...
)
# S4 method for class 'tbl_df'
test_stratification_cellularity(
.data,
.formula,
.sample = NULL,
.transcript = NULL,
.abundance = NULL,
method = "cibersort",
reference = X_cibersort,
...
)
# S4 method for class 'tidybulk'
test_stratification_cellularity(
.data,
.formula,
.sample = NULL,
.transcript = NULL,
.abundance = NULL,
method = "cibersort",
reference = X_cibersort,
...
)
# S4 method for class 'SummarizedExperiment'
test_stratification_cellularity(
.data,
.formula,
.sample = NULL,
.transcript = NULL,
.abundance = NULL,
method = "cibersort",
reference = X_cibersort,
...
)
# S4 method for class '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)
tidybulk::se_mini |>
test_stratification_cellularity(
survival::Surv(days, dead) ~ .,
cores = 1
)
#> # A tibble: 22 × 6
#> .cell_type cell_type_proportions .low_cellularity_exp…¹
#> <chr> <list> <dbl>
#> 1 cibersort.B.cells.naive <tibble [5 × 7]> 3.35
#> 2 cibersort.B.cells.memory <tibble [5 × 7]> 3.35
#> 3 cibersort.Plasma.cells <tibble [5 × 7]> NA
#> 4 cibersort.T.cells.CD8 <tibble [5 × 7]> 3.22
#> 5 cibersort.T.cells.CD4.naive <tibble [5 × 7]> 2.43
#> 6 cibersort.T.cells.CD4.memory.re… <tibble [5 × 7]> 2.77
#> 7 cibersort.T.cells.CD4.memory.ac… <tibble [5 × 7]> 3.8
#> 8 cibersort.T.cells.follicular.he… <tibble [5 × 7]> 3.35
#> 9 cibersort.T.cells.regulatory..T… <tibble [5 × 7]> 3.22
#> 10 cibersort.T.cells.gamma.delta <tibble [5 × 7]> NA
#> # ℹ 12 more rows
#> # ℹ abbreviated name: ¹.low_cellularity_expected
#> # ℹ 3 more variables: .high_cellularity_expected <dbl>, pvalue <dbl>,
#> # plot <list>