TCGA工具-GDCRNATools学习笔记

介绍

GDCRNATools 是一个R包,提供标准的,易于使用和全面的管道,用于下载,组织和综合分析GDC门户中的RNA表达数据,重点是解读癌症中lncRNA-mRNA相关的ceRNA调控网络。

许多分析可以使用 GDCRNATools,包括差异基因表达分析(limma(Ritchie等人2015), edgeR(Robinson,McCarthy和Smyth 2010)和 DESeq2(Love,Huber和Anders 2014)),单变量生存分析( CoxPH和KM),竞争内源RNA网络分析(超几何测试,Pearson相关分析,调节相似性分析,灵敏度Pearson偏相关)和功能富集分析(GO,KEGG,DO)。除了一些常规的可视化方法,如火山图,散点图和气泡图等,GDCRNATools中开发了三个简单的闪亮应用程序,允许用户在本地网页上显示结果。

这个用户友好的软件包允许研究人员通过简单运行一些功能并集成他们自己的管道进行分析,如分子亚型分类, 加权相关网络分析(WGCNA)(Langfelder和Horvath 2008),以及TF-miRNA共同调控网络分析等,轻松进入工作流程。

简介

GDCRNATools
GDCRNATools is an R package which provides a standard,
easy-to-use and comprehensive pipeline for downloading,
organizing, and integrative analyzing RNA expression data in the GDC portal with an emphasis on deciphering the lncRNA-mRNA related ceRNAs regulatory network in cancer. Here we provide code of the basic steps for data analysis by GDCRNATools. Detailed instructions can be found here:
http://htmlpreview.github.io/?https://github.com/Jialab-UCR/Jialab-UCR.github.io/blob/master/GDCRNATools_manual.html

1. GDCRNATools package installation

# Get the current working directory, make sure that it is 
# writable, otherwise, change to a new directory
getwd()
#setwd(workingDirectory)

# installation of GDCRNATools from Bioconductor
source("https://bioconductor.org/biocLite.R")
biocLite("GDCRNATools")

library(GDCRNATools)

2. Quick start

A small internal dataset is used here to show the most basic steps for ceRNAs network analysis in GDCRNATools

2.1 Normalization of HTSeq-Counts data

### load RNA counts data
data(rnaCounts)
rnaCounts[1:5,1:5]
    
### load miRNAs counts data
data(mirCounts)
mirCounts[1:5,1:5]
    
### Normalization of RNAseq data
rnaExpr <- gdcVoomNormalization(counts = rnaCounts, filter = FALSE)
rnaExpr[1:5,1:5]
    
### Normalization of miRNAs data
mirExpr <- gdcVoomNormalization(counts = mirCounts, filter = FALSE)
mirExpr[1:5,1:5]

2.2 Parse and filter RNAseq metadata

metaMatrix.RNA <- gdcParseMetadata(project.id = 'TCGA-CHOL',
                                   data.type  = 'RNAseq', 
                                   write.meta = FALSE)
metaMatrix.RNA <- gdcFilterDuplicate(metaMatrix.RNA)
metaMatrix.RNA <- gdcFilterSampleType(metaMatrix.RNA)
metaMatrix.RNA[1:5,]

2.3 ceRNAs network analysis

### Identification of differentially expressed genes ###

DEGAll <- gdcDEAnalysis(counts     = rnaCounts, 
                        group      = metaMatrix.RNA$sample_type, 
                        comparison = 'PrimaryTumor-SolidTissueNormal', 
                        method     = 'limma')
DEGAll[1:5,]
    
### All DEGs
deALL <- gdcDEReport(deg = DEGAll, gene.type = 'all')
deALL[1:5,]
    
### DE long-noncoding genes
deLNC <- gdcDEReport(deg = DEGAll, gene.type = 'long_non_coding')
deLNC[1:5,]

### DE protein coding genes
dePC <- gdcDEReport(deg = DEGAll, gene.type = 'protein_coding')
dePC[1:5,]

### ceRNAs network analysis of DEGs

ceOutput <- gdcCEAnalysis(lnc         = rownames(deLNC), 
                          pc          = rownames(dePC), 
                          lnc.targets = 'starBase', 
                          pc.targets  = 'starBase', 
                          rna.expr    = rnaExpr, 
                          mir.expr    = mirExpr)
ceOutput[1:5,]

    
### Export ceRNAs network to Cytoscape

ceOutput2 <- ceOutput[ceOutput$hyperPValue<0.01 
    & ceOutput$corPValue<0.01 & ceOutput$regSim != 0,]

###### Export edges

edges <- gdcExportNetwork(ceNetwork = ceOutput2, net = 'edges')
edges[1:5,]

##### Export nodes
nodes <- gdcExportNetwork(ceNetwork = ceOutput2, net = 'nodes')
nodes[1:5,]

3. Case study: TCGA-CHOL

3.1 Download data

# set up directories for downloaded data
project <- 'TCGA-CHOL'
rnadir <- paste(project, 'RNAseq', sep='/')
mirdir <- paste(project, 'miRNAs', sep='/')
    
### Download RNAseq data
gdcRNADownload(project.id     = 'TCGA-CHOL', 
               data.type      = 'RNAseq', 
               write.manifest = FALSE,
               method = 'gdc-client', ## use gdc-client tool to download data
               directory      = rnadir)

### Download miRNAs data
gdcRNADownload(project.id     = 'TCGA-CHOL', 
               data.type      = 'miRNAs', 
               write.manifest = FALSE,
               method = 'gdc-client', ## use gdc-client tool to download data
               directory      = mirdir)

3.2 Data organization

### Parse RNAseq metadata
metaMatrix.RNA <- gdcParseMetadata(project.id = 'TCGA-CHOL',
                                   data.type  = 'RNAseq', 
                                   write.meta = FALSE)

# Filter duplicated samples in RNAseq metadata
metaMatrix.RNA <- gdcFilterDuplicate(metaMatrix.RNA)
# Filter non-Primary Tumor and non-Solid Tissue Normal samples in RNAseq metadata
metaMatrix.RNA <- gdcFilterSampleType(metaMatrix.RNA)

### Parse miRNAs metadata
metaMatrix.MIR <- gdcParseMetadata(project.id = 'TCGA-CHOL',
                                   data.type  = 'miRNAs', 
                                   write.meta = FALSE)

# Filter duplicated samples in miRNAs metadata
metaMatrix.MIR <- gdcFilterDuplicate(metaMatrix.MIR)
# Filter non-Primary Tumor and non-Solid Tissue Normal samples in miRNAs metadata
metaMatrix.MIR <- gdcFilterSampleType(metaMatrix.MIR)

### Merge raw counts data
# Merge RNAseq data
rnaCounts <- gdcRNAMerge(metadata  = metaMatrix.RNA, 
                         path      = rnadir, 
                         organized = FALSE, ## if target data are in folders
                         data.type = 'RNAseq')

# Merge miRNAs data
mirCounts <- gdcRNAMerge(metadata  = metaMatrix.MIR,
                         path      = mirdir,
                         organized = FALSE, ## if target data are in folders
                         data.type = 'miRNAs')

### TMM normalization and voom transformation
# Normalization of RNAseq data
rnaExpr <- gdcVoomNormalization(counts = rnaCounts, filter = FALSE)

# Normalization of miRNAs data
mirExpr <- gdcVoomNormalization(counts = mirCounts, filter = FALSE)


### Differential gene expression analysis
DEGAll <- gdcDEAnalysis(counts     = rnaCounts, 
                        group      = metaMatrix.RNA$sample_type, 
                        comparison = 'PrimaryTumor-SolidTissueNormal', 
                        method     = 'limma')
#data(DEGAll)

# All DEGs
deALL <- gdcDEReport(deg = DEGAll, gene.type = 'all')

# DE long-noncoding
deLNC <- gdcDEReport(deg = DEGAll, gene.type = 'long_non_coding')

# DE protein coding genes
dePC <- gdcDEReport(deg = DEGAll, gene.type = 'protein_coding')

Volcano plot and Heatmap

#Volcano plot
gdcVolcanoPlot(DEGAll)
# Barplot
gdcBarPlot(deg = deALL, angle = 45, data.type = 'RNAseq')

#Heatmap
#Heatmap is generated based on the heatmap.2() function in gplots package.
degName = rownames(deALL)
gdcHeatmap(deg.id = degName, metadata = metaMatrix.RNA, rna.expr = rnaExpr)
image.png
image.png

3.3 Competing endogenous RNAs network analysis

(ceRNAs network analysis)

### The 3 steps of ceRNAs network analysis:
# Hypergeometric test
# Pearson correlation analysis
# Regulation pattern analysis

### All of the 3 steps can be performed in a single function


### ceRNAs network analysis using internal databases
ceOutput <- gdcCEAnalysis(lnc         = rownames(deLNC), 
                          pc          = rownames(dePC), 
                          lnc.targets = 'starBase', 
                          pc.targets  = 'starBase', 
                          rna.expr    = rnaExpr, 
                          mir.expr    = mirExpr)



### ceRNAs network analysis using user-provided datasets
# load miRNA-lncRNA interactions
data(lncTarget)
lncTarget[1:3]

# load miRNA-mRNA interactions
data(pcTarget)
pcTarget[1:3]

ceOutput <- gdcCEAnalysis(lnc         = rownames(deLNC), 
                          pc          = rownames(dePC), 
                          lnc.targets = lncTarget, 
                          pc.targets  = pcTarget, 
                          rna.expr    = rnaExpr, 
                          mir.expr    = mirExpr)
    
### Network visulization in Cytoscape

# Filter potential ceRNA interactions
ceOutput2 <- ceOutput[ceOutput$hyperPValue<0.01 & 
    ceOutput$corPValue<0.01 & ceOutput$regSim != 0,]


# Edges and nodes can be simply imported into Cytoscape 
# for network visualization
edges <- gdcExportNetwork(ceNetwork = ceOutput2, net = 'edges')
edges[1:5,]

nodes <- gdcExportNetwork(ceNetwork = ceOutput2, net = 'nodes')
nodes[1:5,]

write.table(edges, file='edges.txt', sep='\t', quote=F) ### Network of Cytoscape
write.table(nodes, file='nodes.txt', sep='\t', quote=F) ### Table of Cytoscape

### Correlation plot on a local webpage
shinyCorPlot(gene1    = rownames(deLNC), 
             gene2    = rownames(dePC), 
             rna.expr = rnaExpr, 
             metadata = metaMatrix.RNA)
image.png

3.4 Other downstream analyses

Univariate survival analysis

# CoxPH analysis
survOutput <- gdcSurvivalAnalysis(gene     = rownames(deALL), 
                                  method   = 'coxph', 
                                  rna.expr = rnaExpr, 
                                  metadata = metaMatrix.RNA)
# KM analysis
survOutput <- gdcSurvivalAnalysis(gene     = rownames(deALL), 
                                  method   = 'KM', 
                                  rna.expr = rnaExpr, 
                                  metadata = metaMatrix.RNA, 
                                  sep      = 'median')

# KM plot on a local webpage by shinyKMPlot
shinyKMPlot(gene = rownames(deALL), rna.expr = rnaExpr, 
            metadata = metaMatrix.RNA)
image.png

3.5 Functional enrichment analysis

All the functional enrichment analyses can be performed in a single function, including:

  • Gene Ontology (BP, CC, MF) analysis
  • KEGG pathway analysis
  • Disease Ontology analysis
    The speed was too slow and taked the top 100.
# Gene Ontology (BP, CC, MF) analysis #The speed is too slow and take the top 100.
enrichOutput <- gdcEnrichAnalysis(gene = rownames(deALL)[1:100], simplify = TRUE)
### This step may take a few minutes ###
# Step 1/5: BP analysis done!
# Step 2/5: CC analysis done!
# Step 3/5: MF analysis done!
# Step 4/5: KEGG analysis done!
# Step 5/5: DO analysis done!

#data(enrichOutput)

# Barplot
gdcEnrichPlot(enrichOutput, type = 'bar', category = 'GO', num.terms = 10)
write.csv(enrichOutput, "enrichOutput.csv")

# Bubble plot
gdcEnrichPlot(enrichOutput, type='bubble', category='GO', num.terms = 10)

# KEGG pathway analysis
gdcEnrichPlot(enrichOutput, type = "bar", category = "KEGG", num.terms = 10, bar.color = "dodgerblue")
#bar.color = "chocolate1"

# Disease Ontology analysis
gdcEnrichPlot(enrichOutput, category='DO',type = 'bubble', num.terms = 20)

# View pathway maps on a local webpage
library(pathview)

deg <- deALL$logFC
names(deg) <- rownames(deALL)
pathways <- as.character(enrichOutput$Terms[enrichOutput$Category=='KEGG'])

shinyPathview(deg, pathways = pathways, directory = 'pathview')
image.png

image.png

image.png
image.png

View pathway maps报错如下:
Listening on http://127.0.0.1:6042
Warning: Error in %in%: object 'gene.idtype.bods' not found
[No stack trace available]
暂时没有找到解决办法
参考:
GDCRNATools的安装与使用---TCGA数据下载与分析工具
TCGA数据下载和整理工具----GDCRNATools
GDCRNATools.workflow.R

生信技能树公益视频合辑:学习顺序是linux,r,软件安装,geo,小技巧,ngs组学!
B站链接
YouTube链接
生信工程师入门最佳指南
学徒培养
生信技能树 - 简书

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 195,783评论 5 462
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 82,360评论 2 373
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 142,942评论 0 325
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,507评论 1 267
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,324评论 5 358
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,299评论 1 273
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,685评论 3 386
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,358评论 0 254
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,652评论 1 293
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,704评论 2 312
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,465评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,318评论 3 313
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,711评论 3 299
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,991评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,265评论 1 251
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,661评论 2 342
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,864评论 2 335

推荐阅读更多精彩内容