Created
November 8, 2018 17:29
-
-
Save chapmanb/26428c375d1d32761cb98e1669345cfa to your computer and use it in GitHub Desktop.
Query TCGA API for exome capture BED files -- thanks to Sehyun Oh
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
#!/usr/bin/env Rscript | |
library(GenomicDataCommons) | |
library(dplyr) | |
manifest = GenomicDataCommons::files() %>% | |
GenomicDataCommons::filter(~ cases.project.project_id == "TCGA-LUAD" & | |
experimental_strategy == "WXS" & | |
data_format == "BAM") %>% | |
GenomicDataCommons::manifest() | |
manifest = manifest %>% | |
slice(1:10) %>% | |
select(id, filename) | |
res = lapply(manifest$id, function(uuid) { | |
#con = curl::curl(paste0("https://api.gdc.cancer.gov/files/", uuid, "?pretty=true&fields=analysis.metadata.read_groups.target_capture_kit_target_region,analysis.metadata.read_groups.target_capture_kit_name,analysis.metadata.read_groups.target_capture_kit_vendor,analysis.metadata.read_groups.target_capture_kit_catalog_number")) | |
con = curl::curl(paste0("https://api.gdc.cancer.gov/files/", uuid, "?pretty=true&fields=analysis.metadata.read_groups.target_capture_kit_target_region")) | |
x = jsonlite::fromJSON(con) | |
return(x) | |
}) | |
y = lapply(res, function(x) unique(x$data$analysis$metadata$read_groups)) | |
y = do.call(rbind, y) | |
manifest = cbind(manifest, y) | |
print(manifest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment