waldronlab / cBioPortalData

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

An error occur when I use “cBioPortaldata” #78

Closed aaaaxiaoma closed 2 weeks ago

aaaaxiaoma commented 2 weeks ago

I noticed an issue when trying to Connect to the cBioPortalData database,the error is getMolecularProfiles(cbio, study_id): there is not the function:"getMolecularProfiles"

BiocManager::install("cBioPortalData") BiocManager::install("dplyr") BiocManager::install("ggplot2")

Load the libraries

library(cBioPortalData) library(dplyr) library(ggplot2)

Connect to the cBioPortalData database

cbio <- cBioPortal()

List available studies to find CPTAC datasets

studies <- getStudies(cbio) head(studies) # Preview available studies

Download CPTAC data for a specific study

Replace "study_id" with the actual CPTAC study ID you find from studies

Common examples: "brca_tcga" for breast cancer, "luad_tcga" for lung adenocarcinoma, etc.

study_id <- "brca_tcga" # Example, replace with the CPTAC study ID you need

Get molecular profile data for the study

profiles <- getMolecularProfiles(cbio, study_id)

Identify a protein expression profile (these vary by study)

Replace "profile_id" with the specific profile ID for protein expression data

profile_id <- "brca_tcga_rppa" # Example, replace with the profile ID for protein expression

Download the data for RHNO1 (or your gene of interest)

Replace profile_id and study_id with the appropriate IDs

query <- cBioDataPack( studyId = study_id, use_cache = TRUE )

Check if RHNO1 is present in the data

protein_data <- query$data$RPPA # Replace "RPPA" with the correct dataset for protein expression colnames(protein_data)

Filter for RHNO1 and relevant columns (cancer type and sample type)

Assuming the dataset has columns like 'sample_type' (normal/tumor) and 'cancer_type'

rhno1_data <- protein_data %>% filter(Hugo_Symbol == "RHNO1") %>% select(sample_type, cancer_type, expression_value)

Analyze the difference in RHNO1 expression between normal and cancer tissue

results <- rhno1_data %>% group_by(cancer_type) %>% summarize( logFC = mean(expression_value[sample_type == "Tumor"]) - mean(expression_value[sample_type == "Normal"]), p.value = t.test(expression_value[sample_type == "Tumor"], expression_value[sample_type == "Normal"], paired = FALSE)$p.value )

Add significance stars based on p-value thresholds

results <- results %>% mutate(significance = case_when( p.value < 0.001 ~ "", p.value < 0.01 ~ "", p.value < 0.05 ~ "", TRUE ~ "" ))

Print results

print(results)

Visualize the expression data

ggplot(rhno1_data, aes(x = cancer_type, y = expression_value, fill = sample_type)) + geom_boxplot(position = position_dodge(width = 0.8)) + labs(title = "RHNO1 Protein Expression in Normal and Tumor Tissues", x = "Cancer Type", y = "RHNO1 Expression") + theme_minimal() + scale_fill_manual(values = c("Normal" = "skyblue", "Tumor" = "salmon")) + theme(axis.text.x = element_text(angle = 45, hjust = 1))

Save the results to a CSV file

write.csv(results, "RHNO1_expression_analysis_results.csv", row.names = FALSE)

LiNk-NY commented 2 weeks ago

Hi @aaaaxiaoma That is not our code. We don't have a getMolecularProfiles function. Use molecularProfiles.

Best, Marcel