waldronlab / cBioPortalData

Integrate the cancer genomics portal, cBioPortal, using MultiAssayExperiment
https://waldronlab.io/cBioPortalData/
30 stars 12 forks source link

Error trying to obtain mutation data with getDataByGenes #61

Closed sajo25 closed 2 years ago

sajo25 commented 2 years ago

Hi! I'm using cBioPortalData in place of cgdsr to calculate the alteration frequency of different genes, but when I try to use getDataByGenes() to obtain mutation data for genes that are not altered (i.e. there's no data) I get an error, which causes my loop to break.

 x <- getDataByGenes(
         api = cbio,
         studyId = "gbm_tcga_pub",
         genes = c("ACTB"),
         by = "hugoGeneSymbol",
         molecularProfileIds = "gbm_tcga_pub_mutations"
)

Error in byGeneList[mutation] <- mutationData(api, molecularProfileIds[mutation], : replacement has length zero In addition: Warning message: In mutationData(api, molecularProfileIds[mutation], entrezGeneIds, : No data found for molecularProfileId: gbm_tcga_pub_mutations

In contrast, when I do this for cna, the function simply returns an empty list.

x <- getDataByGenes(
       api = cbio,
       studyId = "gbm_tcga_pub",
       genes = c("ACTB"),
       by = "hugoGeneSymbol",
       molecularProfileIds = "gbm_tcga_pub_cna_rae"
)

x named list()

Would it be possible to modify the function so that it also returns an empty list in the case of mutations?

LiNk-NY commented 2 years ago

Hi @sajo25 You have a good point. Thank you for reporting this. I will look into it. Best regards, Marcel