Last active
November 22, 2017 18:39
-
-
Save tiagochst/05d37b42d5373f13dc0adef637a5efee to your computer and use it in GitHub Desktop.
Find most significant mutations for survival
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(maftools) | |
maf <- GDCquery_Maf("COAD",pipelines = "mutect2") | |
clinic <- GDCquery_clinic("TCGA-COAD") | |
colnames(clinic)[1] <- "Tumor_Sample_Barcode" | |
clinic$Overall_Survival_Status <- 1 | |
clinic$Overall_Survival_Status[which(clinic$vital_status != "dead")] <- 0 | |
clinic$time <- clinic$days_to_death | |
clinic$time[is.na(clinic$days_to_death)] <- clinic$days_to_last_follow_up[is.na(clinic$days_to_death)] | |
acc <- read.maf(maf = maf, clinicalData = clinic,isTCGA = T) | |
genes <- getGeneSummary(acc)$Hugo_Symbol[1:20] | |
tbl <- plyr::adply(genes,1, function(x){ | |
surv = mafSurvival(maf = acc, | |
genes = x, | |
fn = x, | |
time = 'time', | |
Status = 'Overall_Survival_Status', | |
isTCGA = TRUE) | |
pvalue <- surv$labels$subtitle | |
pvalue | |
},.progress = "text") | |
tbl$X1 <- genes | |
colnames(tbl) <- c("gene","pvalue") | |
tbl$pvalue <- gsub("P-value: ","",tbl$pvalue ) | |
tbl$pvalue <- as.numeric(tbl$pvalue) | |
tbl <- tbl[order(tbl$pvalue),] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment