|
a |
|
b/R/build_gbm_se.R |
|
|
1 |
#' use curatedTCGAData and Brennan metadata to build an annotated GBM MAE |
|
|
2 |
#' @import curatedTCGAData |
|
|
3 |
#' @importFrom S4Vectors DataFrame |
|
|
4 |
#' @import BiocFileCache |
|
|
5 |
#' @param cache if not NULL, location of BiocFileCache instance |
|
|
6 |
#' @note Will cache the created SummarizedExperiment instance unless told not to. |
|
|
7 |
#' `rname` is `"brenn_gbm_se"`. |
|
|
8 |
#' @examples |
|
|
9 |
#' gbmse = build_gbm_se() |
|
|
10 |
#' |
|
|
11 |
#' # check effect of MGMT methylation on survival |
|
|
12 |
#' |
|
|
13 |
#' xm = gbmse[, gbmse$mgmt_status !="" & gbmse$vital_status !=""] |
|
|
14 |
#' library(survival) |
|
|
15 |
#' ss = Surv(xm$os_days, 1*(xm$vital_status=="DECEASED")) |
|
|
16 |
#' plot(survfit(ss~xm$mgmt_status), lty=1:2) |
|
|
17 |
#' legend(1100, .95, lty=c(1,2), legend=c("MGMT methylated", "unmethylated")) |
|
|
18 |
#' title("Time-on-study/vital status for 123 GBM patients analyzed in Brennan et al. PMID 24120142") |
|
|
19 |
#' survdiff(ss~xm$mgmt_status) |
|
|
20 |
#' @export |
|
|
21 |
build_gbm_se = function(cache=BiocFileCache::BiocFileCache()) { |
|
|
22 |
if (!is.null(cache)) { |
|
|
23 |
chk = bfcquery(cache, "brenn_gbm_se") |
|
|
24 |
if (nrow(chk)>0) return(readRDS(chk$rpath)) |
|
|
25 |
} |
|
|
26 |
mae = curatedTCGAData("GBM", assay="RNAseq2GeneNorm", dry.run=FALSE, version="2.0.1") |
|
|
27 |
se = experiments(mae)[[1]] |
|
|
28 |
colnames(se) = substr(colnames(se), 1, 12) |
|
|
29 |
br = get_brennan_clin() |
|
|
30 |
okids = intersect(colnames(se), rownames(br)) |
|
|
31 |
br = br[okids,] |
|
|
32 |
se = se[,okids] |
|
|
33 |
colData(se) = DataFrame(br) |
|
|
34 |
assayNames(se) = "RNAseq2GeneNorm" |
|
|
35 |
if (is.null(cache)) return(se) |
|
|
36 |
tf = tempfile() |
|
|
37 |
saveRDS(se, tf) |
|
|
38 |
bfcadd(cache, rname="brenn_gbm_se", fpath=tf, action="copy") |
|
|
39 |
readRDS(bfcquery(cache, "brenn_gbm_se")$rpath) |
|
|
40 |
} |
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|