R/uni-cox.R
uni.cox.Rduni.cox Performs univariate cox proportional hazard model on every feature
uni.cox(X, surv.dat, surv.formula, filter = 0, genes = NULL)
| X | Matrix/surv.datframe of genomic features, continuous or binary (note cannot handle categorical surv.dat for the moment). |
|---|---|
| surv.dat | a surv.dat frame containing the survival information. This can be made of 2 or 3 columns. 1 or 2 for time, and one for status (where 1 is event and 0 is no event). |
| surv.formula | a survival formula with names matching those in surv.dat eg: Surv(time,status)~. |
| filter | a numeric value between 0 and 1 (1 not included) that is the lower bound for the proportion of patients having a genetic event (only for binary features). All features with an event rate lower than that value will be removed. Default is 0 (all features included). |
| genes | a character vector of gene names that will be the only ones to be kept. Default is NULL, all genes are used. |
tab A table of all the fits performed sorted by adjusted pvalues.
p An interactive plot of log(pvalue) by hazard ration.
KM List of survival plots of the top 10 most significant genes
library(gnomeR) library(dplyr) library(dtplyr) patients <- as.character(unique(mut$Tumor_Sample_Barcode))[1:200] gen.dat <- binmat(patients = patients,maf = mut)#> Warning: All samples were sequenced on the same platform. #> The specify.plat argument has been overwritten to FALSE.surv.dat <- clin.patients %>% filter(X.Patient.Identifier %in% abbreviate(patients,strict = TRUE, minlength = 9)) %>% select(X.Patient.Identifier,Overall.Survival..Months., Overall.Survival.Status) %>% rename(DMPID = X.Patient.Identifier, time = Overall.Survival..Months., status = Overall.Survival.Status) %>% mutate(time = as.numeric(as.character(time)), status = ifelse(status == "LIVING",0,1)) %>% filter(!is.na(time)) X <- gen.dat[match(surv.dat$DMPID, abbreviate(rownames(gen.dat),strict = TRUE, minlength = 9)),] uni.cox(X = X, surv.dat = surv.dat, surv.formula = Surv(time,status)~.,filter = 0.05)#> Warning: Loglik converged before variable 1 ; coefficient may be infinite.#> Warning: Vectorized input to `element_text()` is not officially supported. #> Results may be unexpected or may change in future versions of ggplot2.#> Warning: Vectorized input to `element_text()` is not officially supported. #> Results may be unexpected or may change in future versions of ggplot2.#> Warning: Vectorized input to `element_text()` is not officially supported. #> Results may be unexpected or may change in future versions of ggplot2.#> Warning: Vectorized input to `element_text()` is not officially supported. #> Results may be unexpected or may change in future versions of ggplot2.#> Warning: Vectorized input to `element_text()` is not officially supported. #> Results may be unexpected or may change in future versions of ggplot2.#> Warning: Vectorized input to `element_text()` is not officially supported. #> Results may be unexpected or may change in future versions of ggplot2.#> Warning: Vectorized input to `element_text()` is not officially supported. #> Results may be unexpected or may change in future versions of ggplot2.#> Warning: Vectorized input to `element_text()` is not officially supported. #> Results may be unexpected or may change in future versions of ggplot2.#> Warning: Vectorized input to `element_text()` is not officially supported. #> Results may be unexpected or may change in future versions of ggplot2.#> Warning: Vectorized input to `element_text()` is not officially supported. #> Results may be unexpected or may change in future versions of ggplot2.#> $tab #> Feature Coefficient HR Pvalue FDR MutationFrequency #> 1 EGFR 0.8400 2.32e+00 0.00821 0.2135489 0.1000 #> 2 MLL 0.9440 2.57e+00 0.01960 0.2266402 0.0643 #> 3 RB1 0.7210 2.06e+00 0.03480 0.2266402 0.0929 #> 4 CREBBP 0.9020 2.46e+00 0.03490 0.2266402 0.0571 #> 5 MLL2 0.5630 1.76e+00 0.08590 0.3411547 0.1000 #> 6 TP53 0.4000 1.49e+00 0.08780 0.3411547 0.4429 #> 7 ATRX -1.2100 2.98e-01 0.09180 0.3411547 0.0714 #> 8 NF1 0.6240 1.87e+00 0.14800 0.4551796 0.0643 #> 9 KRAS 0.4830 1.62e+00 0.15800 0.4551796 0.1286 #> 10 CDH1 -0.9720 3.78e-01 0.17500 0.4558340 0.0571 #> 11 APC -0.6500 5.22e-01 0.27000 0.6173839 0.0714 #> 12 KEAP1 0.4200 1.52e+00 0.29100 0.6173839 0.0786 #> 13 PTEN -0.6010 5.48e-01 0.30900 0.6173839 0.0571 #> 14 TERT 0.2970 1.35e+00 0.34800 0.6456599 0.1357 #> 15 EPHA5 -0.2680 7.65e-01 0.60300 0.9957052 0.0643 #> 16 PIK3CA 0.1600 1.17e+00 0.67100 0.9957052 0.1071 #> 17 NOTCH1 -0.2130 8.08e-01 0.67900 0.9957052 0.0714 #> 18 SMARCA4 -0.1840 8.32e-01 0.72100 0.9957052 0.0643 #> 19 ARID1A 0.1160 1.12e+00 0.78600 0.9957052 0.0786 #> 20 POLE -0.1180 8.88e-01 0.84100 0.9957052 0.0500 #> 21 FAT1 -0.0667 9.35e-01 0.86700 0.9957052 0.1071 #> 22 MLL3 -0.0621 9.40e-01 0.89400 0.9957052 0.0643 #> 23 STK11 0.0200 1.02e+00 0.96300 0.9957052 0.0857 #> 24 PTPRT -0.0143 9.86e-01 0.97800 0.9957052 0.0500 #> 25 ATM 0.0129 1.01e+00 0.97800 0.9957052 0.0714 #> 26 BRCA2 -18.2000 1.29e-08 0.99600 0.9957052 0.0500 #> #> $p#> #> #>#> Warning: minimal value for n is 3, returning requested palette with 3 different levels#> Warning: minimal value for n is 3, returning requested palette with 3 different levels#> #> $KM #> $KM[[1]]#> #> $KM[[2]]#> #> $KM[[3]]#> #> $KM[[4]]#> #> $KM[[5]]#> #> $KM[[6]]#> #> $KM[[7]]#> #> $KM[[8]]#> #> $KM[[9]]#> #> $KM[[10]]#> #>