library('TCGAbiolinks')
library('plyr')
library('devtools')
projects<- "TCGA-LUAD"
clin <- lapply(projects, function(p) {
message(paste(Sys.time(), 'processing project', p))
result <- tryCatch({
query <- GDCquery(project = p, data.category = 'Clinical')
GDCdownload(query)
GDCprepare_clinic(query, clinical.info = 'patient')
}, error = function(e) {
message(paste0('Error clinical: ', p))
return(NULL)
})
return(result)
})
names(clin) <- projects
## Merge all
clin_all <- rbind.fill(clin)
## Fix columns that have '' that should be NAs
for(j in seq_len(ncol(clin_all))) {
i <- which(clin_all[, j] == '')
if(length(i) > 0) clin_all[i, j] <- NA
}
save(clin_all, file = 'clin_all.Rdata')
write.table(clin_all, file = 'clin_all.tsv', quote = FALSE, row.names = FALSE,
sep = '\t')
Created
February 14, 2018 23:23
-
-
Save crazyhottommy/f3d1866cb771b81cda3b0f65d5f9174e to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment