Skip to content

Instantly share code, notes, and snippets.

@tiagochst
Last active April 4, 2019 22:20
Show Gist options
  • Save tiagochst/b11d0bbb0327aa299a9f06b2ab103b41 to your computer and use it in GitHub Desktop.
Save tiagochst/b11d0bbb0327aa299a9f06b2ab103b41 to your computer and use it in GitHub Desktop.
Get all TCGA data for GENAVi https://junkdnalab.shinyapps.io/GENAVi/
library(TCGAbiolinks)
library(SummarizedExperiment)
dir.create(gsub(" |,", "_",TCGAbiolinks:::getGDCInfo()$data_release))
setwd(gsub(" |,", "_",TCGAbiolinks:::getGDCInfo()$data_release))
projects <- TCGAbiolinks:::getGDCprojects()$project_id
projects <- projects[grepl('^TCGA',projects,perl=T)]
for(proj in projects){
dir.create(proj,showWarnings = FALSE)
query <- GDCquery(project = proj,
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "HTSeq - Counts")
GDCdownload(query)
data <- GDCprepare(query = query,
save = FALSE)
#saveRDS(data, file = file.path(proj,"/SE_raw_counts_hg38_TCGA.rds"))
df <- as.data.frame(assay(data))
df <- cbind(rownames(df),df)
readr::write_csv(df,path = file.path(proj,"/raw_counts_hg38_TCGA.csv"))
samples <- cbind(rownames(colData(data)), colData(data))
readr::write_csv(as.data.frame(samples),path = file.path(proj,"metadata.csv"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment