knitr::opts_chunk$set(cache = TRUE)

Installation

library(cBioPortalData)
library(AnVIL)

Introduction

The cBioPortal for Cancer Genomics website is a great resource for interactive exploration of study datasets. However, it does not easily allow the analyst to obtain and further analyze the data.

We've developed the cBioPortalData package to fill this need to programmatically access the data resources available on the cBioPortal.

The cBioPortalData package provides an R interface for accessing the cBioPortal study data within the Bioconductor ecosystem.

It downloads study data from the cBioPortal API (the full API specification can be found here https://cbioportal.org/api) and uses Bioconductor infrastructure to cache and represent the data.

We demonstrate common use cases of cBioPortalData and curatedTCGAData during Bioconductor conference workshops.

We use the MultiAssayExperiment (@Ramos2017-og) package to integrate, represent, and coordinate multiple experiments for the studies available in the cBioPortal. This package in conjunction with curatedTCGAData give access to a large trove of publicly available bioinformatic data. Please see our JCO Clinical Cancer Informatics publication here (@Ramos2020-ya).

Citations

Our free and open source project depends on citations for funding. When using cBioPortalData, please cite the following publications:

citation("MultiAssayExperiment")
citation("cBioPortalData")

Overview

Data Structures

Data are provided as a single MultiAssayExperiment per study. The MultiAssayExperiment representation usually contains SummarizedExperiment objects for expression data and RaggedExperiment objects for mutation and CNV-type data. RaggedExperiment is a data class for representing 'ragged' genomic location data, meaning that the measurements per sample vary.

For more information, please see the RaggedExperiment and SummarizedExperiment vignettes.

Identifying available studies

As we work through the data, there are some datasest that cannot be represented as MultiAssayExperiment objects. This can be due to a number of reasons such as the way the data is handled, presence of mis-matched identifiers, invalid data types, etc. To see what datasets are currently not building, we can look refer to getStudies() with the buildReport = TRUE argument.

cbio <- cBioPortal()
studies <- getStudies(cbio, buildReport = TRUE)
head(studies)

The last two columns will show the availability of each studyId for either download method (pack_build for cBioDataPack and api_build for cBioPortalData).

Choosing download method

There are two main user-facing functions for downloading data from the cBioPortal API.

Two main functions

cBioDataPack: Obtain Study Data as Zipped Tarballs

This function will access the packaged data from \url{cBioPortal.org/datasets} and return an integrative MultiAssayExperiment representation.

## Use ask=FALSE for non-interactive use
laml <- cBioDataPack("laml_tcga", ask = FALSE)
laml

cBioPortalData: Obtain data from the cBioPortal API

This function provides a more flexible and granular way to request a MultiAssayExperiment object from a study ID, molecular profile, gene panel, sample list.

acc <- cBioPortalData(api = cbio, by = "hugoGeneSymbol", studyId = "acc_tcga",
    genePanelId = "IMPACT341",
    molecularProfileIds = c("acc_tcga_rppa", "acc_tcga_linear_CNA")
)
acc

Note. To avoid overloading the API service, the API was designed to only query a part of the study data. Therefore, the user is required to enter either a set of genes of interest or a gene panel identifier.

Considerations

Note that cBioPortalData and cBioDataPack obtain data diligently curated by the cBio Portal data team. The original data and curation lies in the https://github.com/cBioPortal/cBioPortal GitHub repository. However, despite the curation efforts there may be some inconsistencies in identifiers in the data. This causes our software to not work as intended though we have made efforts to represent all the data from both API and tarball formats.

metadata

You may notice that the metadata() may have some additional data that was not able to be integrated in the MultiAssayExperiment.

metadata(acc)

Build prompts

You will also get a message for studyIds whose data has not been fully integrated into a MultiAssayExperiment.

cat(
    "Our testing shows that '%s' is not currently building.\n",
    "  Use 'downloadStudy()' to manually obtain the data.\n",
    "  Proceed anyway? [y/n]: y"
)

Manual downloads

For this reason, we have also provided the downloadStudy, untarStudy, and loadStudy functions to allow researchers to simply download the data and potentially, manually curate it. Generally, we advise researchers to report inconsistencies in the data in the cBioPortal data repository.

Clearing the cache

cBioDataPack

In cases where a download is interrupted, the user may experience a corrupt cache. The user can clear the cache for a particular study by using the removeCache function. Note that this function only works for data downloaded through the cBioDataPack function.

removeCache("laml_tcga")

cBioPortalData

For users who wish to clear the entire cBioPortalData cache, it is recommended that they use:

unlink("~/.cache/cBioPortalData/")

Example Analysis: Kaplan-Meier Plot

We can use information in the colData to draw a K-M plot with a few variables from the colData slot of the MultiAssayExperiment. First, we load the necessary packages:

library(survival)
library(survminer)

We can check the data to lookout for any issues.

table(colData(laml)$OS_STATUS)
class(colData(laml)$OS_MONTHS)

Now, we clean the data a bit to ensure that our variables are of the right type for the subsequent survival model fit.

collaml <- colData(laml)
collaml[collaml$OS_MONTHS == "[Not Available]", "OS_MONTHS"] <- NA
collaml$OS_MONTHS <- as.numeric(collaml$OS_MONTHS)
colData(laml) <- collaml

We specify a simple survival model using SEX as a covariate and we draw the K-M plot.

fit <- survfit(
    Surv(OS_MONTHS, as.numeric(substr(OS_STATUS, 1, 1))) ~ SEX,
    data = colData(laml)
)
ggsurvplot(fit, data = colData(laml), risk.table = TRUE)

Data update requests

If you are interested in a particular study dataset that is not currently building, please open an issue at our GitHub repository and we will do our best to resolve the issues with the code base. Data issues can be opened at the cBioPortal data repository.

We appreciate your feedback!

sessionInfo

Click to see session info

sessionInfo()

References



waldronlab/MultiAssayExperimentData documentation built on May 4, 2024, 2:29 p.m.