cbioportalR icon indicating copy to clipboard operation
cbioportalR copied to clipboard

Pull virtual study details by session info

Open karissawhiting opened this issue 2 years ago • 0 comments

Currently there isn't a designated API endpoint for pulling data by virtual study ID. One way you could do this is by pulling the session info. For example:

resp <- httr::GET("https://www.cbioportal.org/api/session/virtual_study/6269715f04dc353874696f2a")
resp <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"), simplifyVector = FALSE)
df <- resp$data

df$studies %>% unlist()

                            id                       samples1                       samples2 
"luad_tcga_pan_can_atlas_2018"              "TCGA-69-8253-01"              "TCGA-97-8174-01" 
                      samples3                       samples4                       samples5 
             "TCGA-55-6983-01"              "TCGA-67-4679-01"              "TCGA-44-6776-01" 
                      samples6                       samples7                       samples8 
             "TCGA-L4-A4E6-01"              "TCGA-78-7148-01"              "TCGA-05-4426-01" 
                      samples9                      samples10                      samples11 
             "TCGA-MP-A4TE-01"              "TCGA-80-5608-01"              "TCGA-99-8025-01" 
                     samples12                      samples13                      samples14 
             "TCGA-55-A492-01"              "TCGA-75-6206-01"              "TCGA-78-7161-01" 
                     samples15                      samples16                      samples17 
             "TCGA-62-A46P-01"              "TCGA-50-8460-01"              "TCGA-55-6971-01" 

If we were able to pull sample IDs and their corresponding study IDs in the virtual study, we could then pull data by those pieces of information.

karissawhiting avatar Jun 13 '22 18:06 karissawhiting