Title: | Survival Extension of the Generalized Berk-Jones Test |
---|---|
Description: | Implements an extension of the Generalized Berk-Jones (GBJ) statistic for survival data, sGBJ. It computes the sGBJ statistic and its p-value for testing the association between a gene set and a time-to-event outcome with possible adjustment on additional covariates. Detailed method is available at Villain L, Ferte T, Thiebaut R and Hejblum BP (2021) <doi:10.1101/2021.09.07.459329>. |
Authors: | Laura Villain [aut, cre], Thomas Ferte [aut], Rodolphe Thiebault [aut], Boris P. Hejblum [aut] |
Maintainer: | Laura Villain <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.0 |
Built: | 2025-02-02 05:41:36 UTC |
Source: | https://github.com/lauravillain/sgbj |
Compute the epsilon matrix by permutation for the sGBJ_scores()
function.
.epsilon_matrix(Z, nperm, surv, factor_matrix, covariates = NULL, dat)
.epsilon_matrix(Z, nperm, surv, factor_matrix, covariates = NULL, dat)
Z |
the score vector returned by |
nperm |
number of permutations performed to estimate the |
surv |
a |
factor_matrix |
a |
covariates |
a |
dat |
data used to fit survival model returned by |
The epsilon matrix.
Compute the survival score
.survival_scores(factor_matrix, covariates = NULL, surv)
.survival_scores(factor_matrix, covariates = NULL, surv)
factor_matrix |
a |
covariates |
a matrix nxl of the covariates to adjust. Default is |
surv |
a |
A list of length 3 with the updated factor_matrix (same as factor_matrix but removing columns for which survival model failed to converge), the Z matrix and the data used to fit survival model.
This function is the main function of the sGBJ package to perform Gene Set Analysis in the context of time-to-event outcome.
sGBJ(surv, factor_matrix, covariates = NULL, nperm = 300)
sGBJ(surv, factor_matrix, covariates = NULL, nperm = 300)
surv |
a |
factor_matrix |
a |
covariates |
a |
nperm |
number of permutations performed to estimate the |
The sGBJ statistic and its associated p-value associated
n <- 100 surv_data <- data.frame(Time = runif(n = n, min = 0, max = 100), event = rbinom(n = n, size = 1, prob = 0.5)) surv <- survival::Surv(time = surv_data$Time, event = surv_data$event) factor_matrix <- data.frame(P1 = rnorm(n = n), P2 = rnorm(n = n)) sGBJ::sGBJ(surv,factor_matrix, nperm = 2)
n <- 100 surv_data <- data.frame(Time = runif(n = n, min = 0, max = 100), event = rbinom(n = n, size = 1, prob = 0.5)) surv <- survival::Surv(time = surv_data$Time, event = surv_data$event) factor_matrix <- data.frame(P1 = rnorm(n = n), P2 = rnorm(n = n)) sGBJ::sGBJ(surv,factor_matrix, nperm = 2)
Compute the sGBJ statistic along with its p-value quantifying the association between a gene set and survival outcome
sGBJ_scores(surv, factor_matrix, covariates = NULL, nperm = 300)
sGBJ_scores(surv, factor_matrix, covariates = NULL, nperm = 300)
surv |
a |
factor_matrix |
a |
covariates |
a |
nperm |
number of permutations performed to estimate the |
a list containing the sGBJ statistic estimation and its associated p-value
n <- 100 surv_data <- data.frame(Time = runif(n = n, min = 0, max = 100), event = rbinom(n = n, size = 1, prob = 0.5)) surv <- survival::Surv(time = surv_data$Time, event = surv_data$event) factor_matrix <- data.frame(P1 = rnorm(n = n), P2 = rnorm(n = n)) sGBJ::sGBJ_scores(surv,factor_matrix, nperm = 2) # with covariates covariates <- data.frame(age = runif(n = n, 60, 90)) sGBJ_scores(surv,factor_matrix, nperm = 2, covariates = covariates)
n <- 100 surv_data <- data.frame(Time = runif(n = n, min = 0, max = 100), event = rbinom(n = n, size = 1, prob = 0.5)) surv <- survival::Surv(time = surv_data$Time, event = surv_data$event) factor_matrix <- data.frame(P1 = rnorm(n = n), P2 = rnorm(n = n)) sGBJ::sGBJ_scores(surv,factor_matrix, nperm = 2) # with covariates covariates <- data.frame(age = runif(n = n, 60, 90)) sGBJ_scores(surv,factor_matrix, nperm = 2, covariates = covariates)
An adaptation of GBJ::calc_scores_stats()
to survival context.
Wrapper of sGBJ_scores() function.
surv_calc_scores_stats(null_model, factor_matrix, nperm = 300)
surv_calc_scores_stats(null_model, factor_matrix, nperm = 300)
null_model |
An R cox model fitted with |
factor_matrix |
An |
nperm |
Number of permutations (default is 300) |
A list with the elements:
test_stats |
The |
cor_mat |
The |
n <- 100 surv_data <- data.frame(Time = runif(n = n, min = 0, max = 100), event = rbinom(n = n, size = 1, prob = 0.5)) surv <- survival::Surv(time = surv_data$Time, event = surv_data$event) factor_matrix <- data.frame(P1 = rnorm(n = n), P2 = rnorm(n = n)) covariates <- data.frame(age = runif(n = n, 60, 90)) null_model <- survival::coxph(surv ~ age, data = covariates, x = TRUE) surv_reg_stats <- surv_calc_scores_stats(null_model = null_model, factor_matrix = factor_matrix, nperm = 2)#nperm = 300) GBJ::GBJ(test_stats=surv_reg_stats$test_stats, cor_mat=surv_reg_stats$cor_mat)
n <- 100 surv_data <- data.frame(Time = runif(n = n, min = 0, max = 100), event = rbinom(n = n, size = 1, prob = 0.5)) surv <- survival::Surv(time = surv_data$Time, event = surv_data$event) factor_matrix <- data.frame(P1 = rnorm(n = n), P2 = rnorm(n = n)) covariates <- data.frame(age = runif(n = n, 60, 90)) null_model <- survival::coxph(surv ~ age, data = covariates, x = TRUE) surv_reg_stats <- surv_calc_scores_stats(null_model = null_model, factor_matrix = factor_matrix, nperm = 2)#nperm = 300) GBJ::GBJ(test_stats=surv_reg_stats$test_stats, cor_mat=surv_reg_stats$cor_mat)