cbioportalR icon indicating copy to clipboard operation
cbioportalR copied to clipboard

How to get mRNA expression profiles

Open ypradat opened this issue 1 year ago • 2 comments

Dear @karissawhiting ,

I am opening another issue as I have been unable to load mRNA expression profiles from cbioportal. I tried the following.

set_cbioportal_db("public")

mycancerstudy <- "blca_tcga_pan_can_atlas_2018"

# get patient and sample lists for the study
mypatientlist <- available_patients(mycancerstudy)$patientId
mysamplelist <- available_samples(mycancerstudy)$sampleId

# check available molecular profiles and select the molecular profile for mRNA withouth Zscore transfo
geneticprofiles <- available_profiles(study_id=mycancerstudy) %>% pull(molecularProfileId)
geneticprofiles <- geneticprofiles[grepl("mrna", geneticprofiles)]
geneticprofiles <- geneticprofiles[!grepl("Zscores", geneticprofiles)]

# select the one i want
geneticprofile <- "tblca_tcga_pan_can_atlas_2018_rna_seq_v2_mrna"

# TRY 1: does not work
sample_study_pairs <- data.frame(sample_id=mysamplelist)
sample_study_pairs$study_id <- mycancerstudy
sample_study_pairs$molecular_profile_id <- geneticprofile
df_data <- get_genetics_by_sample(sample_study_pairs=sample_study_pairs, add_hugo=T)

# TRY 2: does not work either
body_api <- list(entrezGeneIds = EntrezGenes,
                             sampleIds = mysamplelist) %>%
                        purrr::discard(is.null)

body_url <- paste0("molecular-profiles/", geneticprofile, "/mrna-percentile/fetch?")
res <- cbp_api(url_path=body_url,
               method="post",
               body=body_api,
               base_url="www.cbioportal.org")
result <- purrr::map_dfr(res$content, ~purrr::list_flatten(.x))

I check on the API documentation here https://www.cbioportal.org/api/swagger-ui/index.html#/mRNA%20Percentile and was very surprised to see that the example request for mrna, i.e https://www.cbioportal.org/api/molecular-profiles/acc_tcga_rna_seq_v2_mrna/mrna-percentile/fetch?sampleId=TCGA-OR-A5J2-01, returns nothing in the body.

Can you advise on the procedure to retrieve mRNA expression profiles?

My settings are as in #70 .

Best regards, Yoann Pradat

ypradat avatar Jan 17 '24 17:01 ypradat