前些天被TCGA的終結新聞刷屏,但是一直比較忙,還沒來得及仔細研讀,但是筆記本躺着的一些TCGA教程快發黴了,借此契機好好整理一下吧,預計二十篇左右的筆記
——jimmy
第一篇目錄
正文
TCGA數據源
衆所周知,TCGA數據庫是目前最綜合全面的癌症病人相關組學數據庫,包括的測序數據有:
DNA Sequencing
miRNA Sequencing
Protein Expression
mRNA Sequencing
Total RNA Sequencing
Array-based Expression
DNA Methylation
Copy Number
知名的腫瘤研究機構都有着自己的TCGA數據庫探索工具,比如:
Broad Institute FireBrowse portal, The Broad Institute
cBioPortal for Cancer Genomics, Memorial Sloan-Kettering Cancer Center
TCGA Batch Effects, MD Anderson Cancer Center
Regulome Explorer, Institute for Systems Biology
Next-Generation Clustered Heat Maps, MD Anderson Cancer Center
其中cBioPortal更是被包裝到R包裡面:http://www.cbioportal.org/cgds_r.jsp
這裡就介紹如何使用R語言的cgdsr包來獲取任意TCGA數據吧。
查看有多少不同的癌症數據集
cBioPortal是按照發表文章的方式來組織TCGA數據的,當然,裡面也還有很多非TCGA的數據集,所有的數據集如下所示:
library(cgdsr)library(DT)
# Get list of cancer studies at server## 獲取有哪些數據集
mycgds <- CGDS("http://www.cbioportal.org/public-portal/")
all_TCGA_studies <- getCancerStudies(mycgds)
#all_TCGA_studies[1:3, 1:2]#write.csv(all_TCGA_studies,paste0(Sys.time(),"all_TCGA_studies.csv"),row.names = F)
DT::datatable(all_TCGA_studies)
也可以去網站上面查看這些數據集的詳細信息:http://www.cbioportal.org/data_sets.jsp
查看任意數據集的樣本列表方式
上表的cancer_study_id其實就是數據集的名字,我們任意選擇一個數據集,比如stad_tcga_pub,可以查看它裡面有多少種樣本列表方式。
stad2014 <- "stad_tcga_pub"
## 獲取在stad2014數據集中有哪些表格(每個表格都是一個樣本列表)
all_tables <- getCaseLists(mycgds, stad2014)
dim(all_tables) ## 共11種樣本列表方式
## [1] 11 5
DT::datatable(all_tables[,1:3])
查看任意數據集的數據形式
## 而後獲取可以下載哪幾種數據,一般是mutation,CNV和表達量數據all_dataset <- getGeneticProfiles(mycgds, stad2014) DT::datatable(all_dataset, extensions = 'FixedColumns', options = list( #dom = 't', scrollX = TRUE, fixedColumns = TRUE ))
一般來說,TCGA的一個項目數據就幾種,如下:
選定數據形式及樣本列表後獲取感興趣基因的信息
my_dataset <- 'stad_tcga_pub_rna_seq_v2_mrna'
my_table <- "stad_tcga_pub_rna_seq_v2_mrna"
BRCA1 <- getProfileData(mycgds, "BRCA1", my_dataset, my_table)
dim(BRCA1)
## [1] 265 1
DT::datatable(BRCA1)
樣本個數差異很大,不同癌症熱度不一樣。
選定樣本列表獲取臨床信息
## 如果我們需要繪制survival curve,那麼需要獲取clinical數據clinicaldata <- getClinicalData(mycgds, my_table) DT::datatable(clinicaldata, extensions = 'FixedColumns', options = list( #dom = 't', scrollX = TRUE, fixedColumns = TRUE ))
綜合性獲取
隻需要根據癌症列表選擇自己感興趣的研究數據集即可,然後選擇好感興趣的數據形式及對應的樣本量。就可以獲取對應的信息:
library(cgdsr)
library(DT)
mycgds <- CGDS("http://www.cbioportal.org/public-portal/")
## mycancerstudy = getCancerStudies(mycgds)[25,1]
mycancerstudy = 'brca_tcga'
getCaseLists(mycgds,mycancerstudy)[,1]
## [1] "brca_tcga_3way_complete" "brca_tcga_all" ## [3] "brca_tcga_protein_quantification" "brca_tcga_sequenced" ## [5] "brca_tcga_cna" "brca_tcga_methylation_hm27" ## [7] "brca_tcga_methylation_hm450" "brca_tcga_mrna" ## [9] "brca_tcga_rna_seq_v2_mrna" "brca_tcga_rppa" ## [11] "brca_tcga_cnaseq"
getGeneticProfiles(mycgds,mycancerstudy)[,1]
## [1] "brca_tcga_rppa" ## [2] "brca_tcga_rppa_Zscores" ## [3] "brca_tcga_protein_quantification" ## [4] "brca_tcga_protein_quantification_zscores" ## [5] "brca_tcga_gistic" ## [6] "brca_tcga_mrna" ## [7] "brca_tcga_mrna_median_Zscores" ## [8] "brca_tcga_rna_seq_v2_mrna" ## [9] "brca_tcga_rna_seq_v2_mrna_median_Zscores" ## [10] "brca_tcga_linear_CNA" ## [11] "brca_tcga_methylation_hm450" ## [12] "brca_tcga_mutations"
mycaselist ='brca_tcga_rna_seq_v2_mrna'
mygeneticprofile = 'brca_tcga_rna_seq_v2_mrna'
# Get data slices for a specified list of genes, genetic profile and case liste
xpr=getProfileData(mycgds,c('BRCA1','BRCA2'),mygeneticprofile,mycaselist)
DT::datatable(expr)
是不是很簡單就得到了指定基因在指定癌症的表達量哦
# Get clinical data for the case listmyclinicaldata = getClinicalData(mycgds,mycaselist) DT::datatable(myclinicaldata, extensions = 'FixedColumns', options = list( #dom = 't', scrollX = TRUE, fixedColumns = TRUE ))
## Warning in instance$preRenderHook(instance): It seems your data is too ## big for client-side DataTables. You may consider server-side processing: ## http://rstudio.github.io/DT/server.html
從cBioPortal下載點突變信息
library(cgdsr)library(DT)
mycgds <- CGDS("http://www.cbioportal.org/public-portal/")
mutGene=c("EGFR", "PTEN", "TP53", "ATRX")
mut_df <- getProfileData(mycgds, caseList ="gbm_tcga_sequenced", geneticProfile = "gbm_tcga_mutations", genes = mutGene ) mut_df <- apply(mut_df,2,as.factor)
mut_df[mut_df == "NaN"] = ""
mut_df[is.na(mut_df)] = ""
mut_df[mut_df != ''] = "MUT"
DT::datatable(mut_df)
從cBioPortal下載拷貝數變異數據
把拷貝數及點突變信息結合畫熱圖
下面的函數,主要是配色比較複雜,其實原理很簡單,就是一個熱圖。
library(ComplexHeatmap)
代碼不好排版,如下:
出圖如下:
有話要說...