亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

R語(yǔ)言使用cgdsr包獲取TCGA數(shù)據(jù)示例詳解

 更新時(shí)間:2022年06月25日 10:29:01   作者:Z_Y_H  
這篇文章主要為大家介紹了R語(yǔ)言使用cgdsr包獲取TCGA數(shù)據(jù)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

TCGA數(shù)據(jù)源

眾所周知,TCGA數(shù)據(jù)庫(kù)是目前最綜合全面的癌癥病人相關(guān)組學(xué)數(shù)據(jù)庫(kù),包括的測(cè)序數(shù)據(jù)有:

DNA Sequencing

miRNA Sequencing

Protein Expression

mRNA Sequencing

Total RNA Sequencing

Array-based Expression

DNA Methylation

Copy Number

TCGA數(shù)據(jù)庫(kù)探索工具

知名的腫瘤研究機(jī)構(gòu)都有著自己的TCGA數(shù)據(jù)庫(kù)探索工具,比如:

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包里面

這里介紹如何使用R語(yǔ)言的cgdsr包來(lái)獲取任意TCGA數(shù)據(jù)。

cgdsr包:R語(yǔ)言工具包,可以下載TCGA數(shù)據(jù)。
DT包:data.table包,簡(jiǎn)稱DT包,是R語(yǔ)言中的數(shù)據(jù)可視化工具包。DT包可以將Javascript中的方法運(yùn)用到R中,也能將矩陣或者數(shù)據(jù)表在網(wǎng)頁(yè)中可視化為表格,以及其它的一些功能。

> setwd("C:/Users/YLAB/Documents/R/win-library/4.1/")
> install.packages("R.methodsS3_1.8.1.zip",repos=NULL)#安裝
> install.packages("R.oo_1.24.0.zip",repos=NULL)#安裝
> install.packages("data.table")
> BiocManager::install("cgdsr", force = TRUE)#安裝
> library(cgdsr)
> library(DT)
#創(chuàng)建一個(gè)cgdsr對(duì)象
> mycgds <- CGDS("http://www.cbioportal.org/")
#檢查下載是否成功,如果是FAILED就是沒(méi)成功。
> test(mycgds)
getCancerStudies...  OK
getCaseLists (1/2) ...  OK
getCaseLists (2/2) ...  OK
getGeneticProfiles (1/2) ...  OK
getGeneticProfiles (2/2) ...  OK
getClinicalData (1/1) ...  OK
getProfileData (1/6) ...  OK
getProfileData (2/6) ...  OK
getProfileData (3/6) ...  OK
getProfileData (4/6) ...  OK
getProfileData (5/6) ...  OK
getProfileData (6/6) ...  OK
all_TCGA_studies <- getCancerStudies(mycgds)
> DT::datatable(all_TCGA_studies)

查看任意數(shù)據(jù)集的樣本列表方式

上表的cancer_study_id其實(shí)就是數(shù)據(jù)集的名字,我們?nèi)我膺x擇一個(gè)數(shù)據(jù)集,比如stad_tcga_pub ,可以查看它里面有多少種樣本列表方式。

stad2014 <- "stad_tcga_pub"
## 獲取在stad2014數(shù)據(jù)集中有哪些表格(每個(gè)表格都是一個(gè)樣本列表)
all_tables <- getCaseLists(mycgds, stad2014)
dim(all_tables) ## 共6種樣本列表方式
[1] 6 5
DT::datatable(all_tables[,1:3])

查看任意數(shù)據(jù)集的數(shù)據(jù)形式

## 而后獲取可以下載哪幾種數(shù)據(jù),一般是mutation,CNV和表達(dá)量數(shù)據(jù)
all_dataset <- getGeneticProfiles(mycgds, stad2014)
DT::datatable(all_dataset,
                  extensions = 'FixedColumns',
                  options = list(                    #dom = 't',
                    scrollX = TRUE,
                    fixedColumns = TRUE
                  ))

一般來(lái)說(shuō),TCGA的一個(gè)項(xiàng)目數(shù)據(jù)就幾種,如下:

選定數(shù)據(jù)形式及樣本列表后獲取感興趣基因的信息,下載mRNA數(shù)據(jù)

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

樣本個(gè)數(shù)差異很大,不同癌癥熱度不一樣。

選定樣本列表獲取臨床信息

## 如果我們需要繪制survival curve,那么需要獲取clinical數(shù)據(jù)
clinicaldata <- getClinicalData(mycgds, my_table)
DT::datatable(clinicaldata,
                  extensions = 'FixedColumns',
                  options = list(                    #dom = 't',
                    scrollX = TRUE,
                    fixedColumns = TRUE
                  ))

綜合性獲取

只需要根據(jù)癌癥列表選擇自己感興趣的研究數(shù)據(jù)集即可,然后選擇好感興趣的數(shù)據(jù)形式及對(duì)應(yīng)的樣本量。就可以獲取對(duì)應(yīng)的信息:

library(cgdsr)
library(DT)
 mycgds <- CGDS("http://www.cbioportal.org")   
##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"

下載mRNA數(shù)據(jù)

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 list
expr=getProfileData(mycgds,c('BRCA1','BRCA2'),mygeneticprofile,mycaselist)
DT::datatable(expr)

很簡(jiǎn)單就得到了指定基因在指定癌癥的表達(dá)量

獲取病例列表的臨床數(shù)據(jù)

myclinicaldata = 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下載點(diǎn)突變信息

#突變基因名稱集合
mutGene=c("EGFR", "PTEN", "TP53", "ATRX")
#檢索基因和遺傳圖譜的基因組圖譜數(shù)據(jù)
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下載拷貝數(shù)變異數(shù)據(jù)

mutGene=c("TP53","UGT2B7","CYP3A4")
cna<-getProfileData(mycgds,mutGene,"gbm_tcga_gistic","gbm_tcga_sequenced")
cna<-apply(cna,2,function(x) as.character(factor(x,levels = c(-2:2),labels = c("HOMDEL","HETLOSS","DIPLOID","GAIN","AMP"))))
cna[is.na(cna)]=""
cna[cna=="DIPLOID"]=""
DT::datatable(cna)

把拷貝數(shù)及點(diǎn)突變信息結(jié)合畫(huà)熱圖

下面的函數(shù),主要是配色比較復(fù)雜,其實(shí)原理很簡(jiǎn)單,就是一個(gè)熱圖。

library(ComplexHeatmap)
library(grid)
conb <- data.frame(matrix(paste(as.matrix(cna),as.matrix(mut_df),sep = ";"),                          nrow=nrow(cna),ncol=ncol(cna),                          dimnames=list(row.names(mut_df),colnames(cna))))
mat <- as.matrix(t(conb))
DT::datatable((mat)) 
alt <- apply(mat,1,function(x)strsplit(x,";"))
alt <- unique(unlist(alt))
alt <- alt[which(alt !="")]
alt <-c("background",alt)
alter_fun = list(  background = function(x,y,w,h){    grid.rect(x,y,w-unit(0.5,"mm"),h-unit(0.5,"mm"),              gp=gpar(fill="#CCCCCC",col=NA))  },  HOMDEL = function(x,y,w,h){    grid.rect(x,y,w-unit(0.5,"mm"),h-unit(0.5,"mm"),              gp=gpar(fill="blue3",col=NA))  },  HETLOSS = function(x,y,w,h){    grid.rect(x,y,w-unit(0.5,"mm"),h-unit(0.5,"mm"),              gp=gpar(fill="cadetblue1",col=NA))  },  GAIN = function(x,y,w,h){    grid.rect(x,y,w-unit(0.5,"mm"),h-unit(0.5,"mm"),              gp=gpar(fill="pink",col=NA))  },  AMP = function(x,y,w,h){    grid.rect(x,y,w-unit(0.5,"mm"),h-unit(0.5,"mm"),              gp=gpar(fill="red",col=NA))  },  MUT = function(x,y,w,h){    grid.rect(x,y,w-unit(0.5,"mm"),h-unit(0.5,"mm"),              gp=gpar(fill="#008000",col=NA))  })
col <- c("MUT"="#008000","AMP"="red","HOMDEL"="blue3",         "HETLOSS"="cadetblue1","GAIN"="pink")
alt = intersect(names(alter_fun),alt)
alt_fun_list <- alter_fun[alt]
col <- col[alt]
oncoPrint(mat=mat,alter_fun = alt_fun_list,          get_type = function(x) strsplit(x,";")[[1]],          col = col)

以上就是R語(yǔ)言使用cgdsr包獲取TCGA數(shù)據(jù)示例詳解的詳細(xì)內(nèi)容,更多關(guān)于R語(yǔ)言cgdsr獲取TCGA數(shù)據(jù)的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評(píng)論