1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852
|
---
title: "Case Studies"
bibliography: bibliography.bib
vignette: >
%\VignetteIndexEntry{8. Case Studies}
%\VignetteEngine{knitr::rmarkdown}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(dpi = 300)
knitr::opts_chunk$set(cache=FALSE)
```
```{r message = FALSE, warning = FALSE, include = FALSE}
library(TCGAbiolinks)
library(SummarizedExperiment)
library(dplyr)
library(DT)
```
# Introduction
This vignette shows a complete workflow of the TCGAbiolinks package.
The code is divided in 4 case study:
1. Expression pipeline (BRCA)
2. Expression pipeline (GBM)
3. Integration of DNA methylation and RNA expression pipeline (COAD)
4. ELMER pipeline (KIRC)
# Case study n. 1: Pan Cancer downstream analysis BRCA
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
library(SummarizedExperiment)
library(TCGAbiolinks)
query.exp <- GDCquery(
project = "TCGA-BRCA",
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "STAR - Counts",
sample.type = c("Primary Tumor","Solid Tissue Normal")
)
GDCdownload(
query = query.exp,
files.per.chunk = 100
)
brca.exp <- GDCprepare(
query = query.exp,
save = TRUE,
save.filename = "brcaExp.rda"
)
# get subtype information
infomation.subtype <- TCGAquery_subtype(tumor = "BRCA")
# get clinical data
information.clinical <- GDCquery_clinic(project = "TCGA-BRCA",type = "clinical")
# Which samples are Primary Tumor
samples.primary.tumour <- brca.exp$barcode[brca.exp$shortLetterCode == "TP"]
# which samples are solid tissue normal
samples.solid.tissue.normal <- brca.exp$barcode[brca.exp$shortLetterCode == "NT"]
```
Using `TCGAnalyze_DEA`, we identified 4,815 differentially expression genes (DEG) (log
fold change >=1 and FDR < 1%) between 113 normal and 1106 BRCA samples. In
order to understand the underlying biological process from DEGs we performed an
enrichment analysis using `TCGAnalyze_EA_complete` function.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
dataPrep <- TCGAanalyze_Preprocessing(
object = brca.exp,
cor.cut = 0.6
)
dataNorm <- TCGAanalyze_Normalization(
tabDF = dataPrep,
geneInfo = geneInfoHT,
method = "gcContent"
)
dataFilt <- TCGAanalyze_Filtering(
tabDF = dataNorm,
method = "quantile",
qnt.cut = 0.25
)
dataDEGs <- TCGAanalyze_DEA(
mat1 = dataFilt[,samples.solid.tissue.normal],
mat2 = dataFilt[,samples.primary.tumour],
Cond1type = "Normal",
Cond2type = "Tumor",
fdr.cut = 0.01 ,
logFC.cut = 2,
method = "glmLRT",
pipeline = "edgeR"
)
```
TCGAbiolinks outputs bar chart with the number of genes for the main categories of
three ontologies (GO:biological process, GO:cellular component, and GO:molecular
function, respectively).
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
ansEA <- TCGAanalyze_EAcomplete(
TFname = "DEA genes Normal Vs Tumor",
RegulonList = dataDEGs$gene_name
)
TCGAvisualize_EAbarplot(
tf = rownames(ansEA$ResBP),
GOBPTab = ansEA$ResBP,
GOCCTab = ansEA$ResCC,
GOMFTab = ansEA$ResMF,
PathTab = ansEA$ResPat,
nRGTab = dataDEGs$gene_name,
nBar = 10
)
```
The figure resulted from the code above is shown below.
```{r, fig.width=6, fig.height=4, echo = FALSE, fig.align="center",hide=TRUE, message=FALSE,warning=FALSE}
library(png)
library(grid)
img <- readPNG("case1_EA.png")
grid.raster(img)
```
The Kaplan-Meier analysis was used to compute survival univariate curves, and
log-Ratio test was computed to assess the statistical significance by using
TCGAanalyze_SurvivalKM function; starting with 3,390 DEGs genes we found 555
significantly genes with p.value <0.05.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
group1 <- TCGAquery_SampleTypes(colnames(dataFilt), typesample = c("NT"))
group2 <- TCGAquery_SampleTypes(colnames(dataFilt), typesample = c("TP"))
dataSurv <- TCGAanalyze_SurvivalKM(
clinical_patient = dataClin,
dataGE = dataFilt,
Genelist = rownames(dataDEGs),
Survresult = FALSE,
ThreshTop = 0.67,
ThreshDown = 0.33,
p.cut = 0.05,
group1 = group1,
group2 = group2
)
```
Cox-regression analysis was used to compute survival multivariate curves, and cox
p-value was computed to assess the statistical significance by using
TCGAnalyze_SurvivalCoxNET function. Survival multivariate analysis found 160
significantly genes according to the cox p-value FDR 5.00e-02. From DEGs that we
found to correlate significantly with survival by both univariate and multivariate
analyses we analyzed the following network.
The interactome network graph was generated using STRING.,org.Hs.string version
10 (Human functional protein association network). The network graph was resized
by dnet package considering only multivariate survival genes, with strong interaction
(threshold = 700) we obtained a subgraphsub graph of 24 nodes and 31 edges.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
require(dnet) # to change
org.Hs.string <- dRDataLoader(RData = "org.Hs.string")
TabCoxNet <- TCGAvisualize_SurvivalCoxNET(
dataClin,
dataFilt,
Genelist = rownames(dataSurv),
scoreConfidence = 700,
org.Hs.string = org.Hs.string,
titlePlot = "Case Study n.1 dnet"
)
```
The figure resulted from the code above is shown below.
```{r, fig.width=6, fig.height=4, echo = FALSE, fig.align="center",hide=TRUE, message=FALSE,warning=FALSE}
library(png)
library(grid)
img <- readPNG("case1_dnet.png")
grid.raster(img)
```
# Case study n. 2: Pan Cancer downstream analysis LGG
We focused on the analysis of LGG samples. In particular, we used TCGAbiolinks
to download 293 samples with molecular subtypes. Link the complete [complete code](https://gist.github.com/tiagochst/277651ebed998fd3d1952d3fbc376ef2).
.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
library(TCGAbiolinks)
library(SummarizedExperiment)
query.exp <- GDCquery(
project = "TCGA-LGG",
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "STAR - Counts",
sample.type = c("Primary Tumor")
)
GDCdownload(query.exp)
lgg.exp <- GDCprepare(
query = query.exp,
save = FALSE
)
```
First, we searched for possible outliers using the `TCGAanalyze_Preprocessing`
function, which performs an Array Array Intensity correlation AAIC.
We used all samples in expression data which contain molecular subtypes, filtering
out samples without molecular information, and using only IDHmut-codel (n=85),
IDHmut-non-codel (n=141) and IDHwt (n=56), NA (11), to define a square
symmetric matrix of pearson correlation among all samples (n=293).
According to this matrix we found no samples with low correlation (cor.cut = 0.6)
that can be identified as possible outliers, so we continued our analysis
with 70 samples.
Second, using the `TCGAanalyze_Normalization` function we normalized mRNA
transcripts and miRNA, using EDASeq package. This function does use
Within-lane normalization procedures to adjust for GC-content effect
(or other gene-level effects) on read counts: loess robust local regression,
global-scaling, and full-quantile normalization [@risso2011gc] and
between-lane normalization procedures to adjust for distributional differences
between lanes (e.g., sequencing depth): global-scaling and full-quantile
normalization [@bullard2010evaluation].
Third, using the `TCGAanalyze_Filtering` function we applied 3 filters removing
features / mRNAs with low signal across samples obtaining 4578, 4284,
1187 mRNAs respectively.
Then we applied two Hierarchical cluster analysis on 1187 mRNAs after the three
filters described above, the first cluster using as method ward.D2, and the
second with ConsensusClusterPlus.
After the two clustering analysis, with cut.tree = 4 we obtained n= 4 expression clusters (EC).
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
library(dplyr)
dataPrep <- TCGAanalyze_Preprocessing(
object = lgg.exp,
cor.cut = 0.6
)
dataNorm <- TCGAanalyze_Normalization(
tabDF = dataPrep,
geneInfo = geneInfoHT,
method = "gcContent"
)
datFilt <- dataNorm %>%
TCGAanalyze_Filtering(method = "varFilter") %>%
TCGAanalyze_Filtering(method = "filter1") %>%
TCGAanalyze_Filtering(method = "filter2",foldChange = 1)
data_Hc2 <- TCGAanalyze_Clustering(
tabDF = datFilt,
method = "consensus",
methodHC = "ward.D2"
)
# Add cluster information to Summarized Experiment
colData(lgg.exp)$groupsHC <- paste0("EC",data_Hc2[[4]]$consensusClass)
```
The next steps will be to visualize the data. First, we created the survival plot.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
TCGAanalyze_survival(
data = colData(lgg.exp),
clusterCol = "groupsHC",
main = "TCGA kaplan meier survival plot from consensus cluster",
legend = "RNA Group",
height = 10,
risk.table = T,
conf.int = F,
color = c("black","red","blue","green3"),
filename = "survival_lgg_expression_subtypes.png"
)
```
The result is showed below:
```{r, fig.width=6, fig.height=4, echo = FALSE, fig.align="center",hide=TRUE, message=FALSE,warning=FALSE}
library(png)
library(grid)
img <- readPNG("case2_surv.png")
grid.raster(img)
```
We will also, create a heatmap of the expression.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
TCGAvisualize_Heatmap(
data = t(datFilt),
col.metadata = colData(lgg.exp)[,
c("barcode",
"groupsHC",
"paper_Histology",
"paper_IDH.codel.subtype")
],
col.colors = list(
groupsHC = c(
"EC1"="black",
"EC2"="red",
"EC3"="blue",
"EC4"="green3")
),
sortCol = "groupsHC",
type = "expression", # sets default color
scale = "row", # use z-scores for better visualization. Center gene expression level around 0.
title = "Heatmap from concensus cluster",
filename = "case2_Heatmap.png",
extremes = seq(-2,2,1),
color.levels = colorRampPalette(c("green", "black", "red"))(n = 5),
cluster_rows = TRUE,
cluster_columns = FALSE,
width = 1000,
height = 500
)
```
The result is shown below:
```{r, fig.width=6, fig.height=4, echo = FALSE, fig.align="center",hide=TRUE, message=FALSE,warning=FALSE}
library(jpeg)
library(grid)
img <- readJPEG("case2_Heatmap.jpg")
grid.raster(img)
```
Finally, we will take a look in the mutation genes. We will first download the MAF file
with `GDCquery`,`GDCdownload` and `GDCprepare`. In this example we will investigate the gene "ATR".
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
library(maftools)
library(dplyr)
query <- GDCquery(
project = "TCGA-LGG",
data.category = "Simple Nucleotide Variation",
access = "open",
data.type = "Masked Somatic Mutation",
workflow.type = "Aliquot Ensemble Somatic Variant Merging and Masking"
)
GDCdownload(query)
LGGmut <- GDCprepare(query)
# Selecting gene
LGGmut.atr <- LGGmut %>% dplyr::filter(Hugo_Symbol == "ATR")
dataMut <- LGGmut.atr[!duplicated(LGGmut.atr$Tumor_Sample_Barcode),]
dataMut$Tumor_Sample_Barcode <- substr(dataMut$Tumor_Sample_Barcode,1,12)
# Adding the Expression Cluster classification found before
dataMut <- merge(dataMut, cluster, by.y = "patient", by.x = "Tumor_Sample_Barcode")
```
# Case study n. 3: Integration of methylation and expression for ACC
In recent years, it has been described the relationship between
DNA methylation and gene expression and the study of this relationship
is often difficult to accomplish.
This case study will show the steps to investigate the relationship
between the two types of data.
First, we downloaded ACC DNA methylation data for HumanMethylation450k platforms, and ACC RNA expression data for Illumina HiSeq platform.
TCGAbiolinks adds by default the subtypes classification already published by researchers.
We will use this classification to do our examples.
So, selected the groups CIMP-low and CIMP-high to do RNA expression and DNA methylation comparison.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
library(TCGAbiolinks)
library(SummarizedExperiment)
#-----------------------------------
# STEP 1: Search, download, prepare |
#-----------------------------------
# 1.1 - DNA methylation
# ----------------------------------
query.met <- GDCquery(
project = "TCGA-ACC",
data.category = "DNA Methylation",
data.type = "Methylation Beta Value",
platform = "Illumina Human Methylation 450"
)
GDCdownload(
query = query.met,
files.per.chunk = 20,
directory = "case3/GDCdata"
)
acc.met <- GDCprepare(
query = query.met,
save = FALSE,
directory = "case3/GDCdata"
)
#-----------------------------------
# 1.2 - RNA expression
# ----------------------------------
query.exp <- GDCquery(
project = "TCGA-ACC",
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "STAR - Counts"
)
GDCdownload(
query = query.exp,
files.per.chunk = 20,
directory = "case3/GDCdata"
)
acc.exp <- GDCprepare(
query = query.exp,
save = FALSE,
directory = "case3/GDCdata"
)
```
For DNA methylation, we perform a DMC (different methylated CpGs) analysis, which will give the difference of DNA methylation for the probes of the groups and their significance value.
The output can be seen in a volcano plot.
Note: Depending on the number of samples this function can be very slow
due to the wilcoxon test, taking from hours to days.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
# na.omit
acc.met <- acc.met[rowSums(is.na(assay(acc.met))) == 0,]
# Volcano plot
acc.met <- TCGAanalyze_DMC(
data = acc.met,
groupCol = "subtype_MethyLevel",
group1 = "CIMP-high",
group2="CIMP-low",
p.cut = 10^-5,
diffmean.cut = 0.25,
legend = "State",
plot.filename = "case3/CIMP-highvsCIMP-low_metvolcano.png"
)
```
The figure resulted from the code above is shown below:
```{r, fig.width=6, fig.height=4, echo = FALSE, fig.align="center",hide=TRUE, message=FALSE,warning=FALSE}
library(png)
library(grid)
img <- readPNG("CIMP-highvsCIMP-low_metvolcano.png")
grid.raster(img)
```
For the expression analysis, we do a DEA (differential expression analysis) which will give the fold change
of gene expression and their significance value.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
#-------------------------------------------------
# 2.3 - DEA - Expression analysis - volcano plot
# ------------------------------------------------
acc.exp.aux <- subset(
acc.exp,
select = colData(acc.exp)$subtype_MethyLevel %in% c("CIMP-high","CIMP-low")
)
idx <- colData(acc.exp.aux)$subtype_MethyLevel %in% c("CIMP-high")
idx2 <- colData(acc.exp.aux)$subtype_MethyLevel %in% c("CIMP-low")
dataPrep <- TCGAanalyze_Preprocessing(
object = acc.exp.aux,
cor.cut = 0.6
)
dataNorm <- TCGAanalyze_Normalization(
tabDF = dataPrep,
geneInfo = geneInfoHT,
method = "gcContent"
)
dataFilt <- TCGAanalyze_Filtering(
tabDF = dataNorm,
qnt.cut = 0.25,
method = 'quantile'
)
dataDEGs <- TCGAanalyze_DEA(
mat1 = dataFilt[,idx],
mat2 = dataFilt[,idx2],
Cond1type = "CIMP-high",
Cond2type = "CIMP-low",
method = "glmLRT"
)
TCGAVisualize_volcano(
x = dataDEGs$logFC,
y = dataDEGs$FDR,
filename = "case3/Case3_volcanoexp.png",
x.cut = 3,
y.cut = 10^-5,
names = rownames(dataDEGs),
color = c("black","red","darkgreen"),
names.size = 2,
xlab = " Gene expression fold change (Log2)",
legend = "State",
title = "Volcano plot (CIMP-high vs CIMP-low)",
width = 10
)
```
The figure resulted from the code above is shown below:
```{r, fig.width=6, fig.height=4, echo = FALSE, fig.align="center",hide=TRUE, message=FALSE,warning=FALSE}
library(png)
library(grid)
img <- readPNG("figure5exp.png")
grid.raster(img)
```
Finally, using both previous analysis we do a starburst plot to select the genes
that are Candidate Biologically Significant.
Observation: over the time, the number of samples has increased and the clinical data updated.
We used only the samples that had a classification in the examples.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
#------------------------------------------
# 2.4 - Starburst plot
# -----------------------------------------
# If true the argument names of the genes in circle
# (biologically significant genes, has a change in gene
# expression and DNA methylation and respects all the thresholds)
# will be shown
# these genes are returned by the function see starburst object after the function is executed
starburst <- TCGAvisualize_starburst(
met = acc.met,
exp = dataDEGs,
genome = "hg19"
group1 = "CIMP-high",
group2 = "CIMP-low",
filename = "case3/starburst.png",
met.platform = "450K",
met.p.cut = 10^-5,
exp.p.cut = 10^-5,
diffmean.cut = 0.25,
logFC.cut = 3,
names = FALSE,
height = 10,
width = 15,
dpi = 300
)
```
The figure resulted from the code above is shown below:
```{r, fig.width=6, fig.height=4, echo = FALSE, fig.align="center",hide=TRUE, message=FALSE,warning=FALSE}
library(png)
library(grid)
img <- readPNG("figure5star.png")
grid.raster(img)
```
# Case study n. 4: ELMER pipeline - KIRC
An example of package to perform DNA methylation and RNA expression analysis is ELMER [@yao2015inferring,@elmer2,@yao2015demystifying].
ELMER, which is designed to combine DNA methylation and gene expression data from human tissues to infer multi-level cis-regulatory networks.
ELMER uses DNA methylation to
identify distal probes, and correlates them with the expression of nearby genes
to identify one or more transcriptional targets. Transcription factor (TF) binding
site analysis of those anti-correlated distal probes is coupled with expression analysis of all TFs to
infer upstream regulators. This package can be easily applied to TCGA public
available cancer data sets and custom DNA methylation and gene expression data sets.
ELMER analyses have the following steps:
1. Organize data as a *MultiAssayExperiment* object
2. Identify distal probes with significantly different DNA methylation level when comparing two sample groups.
3. Identify putative target genes for differentially methylated distal probes, using methylation vs. expression correlation
4. Identify enriched motifs for each probe belonging to a significant probe-gene pair
5. Identify master regulatory Transcription Factors (TF) whose expression associate with DNA methylation changes at multiple regulatory regions.
We will present this the study KIRC by TCGAbiolinks and
ELMER integration.
<div class="panel panel-info">
<div class="panel-heading">ELMER package</div>
<div class="panel-body">
For more information, please consult the ELMER package:
- http://bioconductor.org/packages/ELMER/
And the following articles:
- http://www.biorxiv.org/content/early/2017/06/11/148726.full.pdf
- https://www.ncbi.nlm.nih.gov/pubmed/26446758
- https://genomebiology.biomedcentral.com/articles/10.1186/s13059-015-0668-3
</div>
</div>
For the DNA methylation data we will search the platform HumanMethylation450.
After, we will download the data and prepared into a *SummarizedExperiment* object.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
library(TCGAbiolinks)
library(SummarizedExperiment)
library(ELMER)
library(parallel)
dir.create("case4")
setwd("case4")
#-----------------------------------
# STEP 1: Search, download, prepare |
#-----------------------------------
# 1.1 - DNA methylation
# ----------------------------------
query.met <- GDCquery(
project = "TCGA-KIRC",
data.category = "DNA Methylation",
data.type = "Methylation Beta Value",
platform = "Illumina Human Methylation 450"
)
GDCdownload(query.met)
kirc.met <- GDCprepare(
query = query.met,
save = TRUE,
save.filename = "kircDNAmet.rda",
summarizedExperiment = TRUE
)
```
For gene expression we will use Gene Expression Quantification.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
# Step 1.2 download expression data
#-----------------------------------
# 1.2 - RNA expression
# ----------------------------------
query.exp <- GDCquery(
project = "TCGA-KIRC",
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "STAR - Counts"
)
GDCdownload(query.exp,files.per.chunk = 20)
kirc.exp <- GDCprepare(
query = query.exp,
save = TRUE,
save.filename = "kircExp.rda"
)
```
A MultiAssayExperiment object from the r BiocStyle::Biocpkg("MultiAssayExperiment") package is the input for multiple main functions of r BiocStyle::Biocpkg("ELMER").
We will first need to get distal probes (2 KB away from TSS).
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
distal.probes <- get.feature.probe(genome = "hg38", met.platform = "450K")
```
To create it you can use the **createMAE** function. This function will keep only samples that
have both DNA methylation and gene expression.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
library(MultiAssayExperiment)
mae <- createMAE(
exp = kirc.exp,
met = kirc.met,
save = FALSE,
linearize.exp = TRUE,
filter.probes = distal.probes,
save.filename = "mae_kirc.rda",
met.platform = "450K",
genome = "hg38",
TCGA = TRUE
)
# Remove FFPE samples
mae <- mae[,!mae$is_ffpe]
```
We will execute ELMER to identify probes that are hypomethylated in tumor samples
compared to the normal samples.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
group.col <- "definition"
group1 <- "Primary Tumor"
group2 <- "Solid Tissue Normal"
direction <- "hypo"
dir.out <- file.path("kirc",direction)
dir.create(dir.out, recursive = TRUE)
#--------------------------------------
# STEP 3: Analysis |
#--------------------------------------
# Step 3.1: Get diff methylated probes |
#--------------------------------------
sig.diff <- get.diff.meth(
data = mae,
group.col = group.col,
group1 = group1,
group2 = group2,
minSubgroupFrac = 0.2,
sig.dif = 0.3,
diff.dir = direction, # Search for hypomethylated probes in group 1
cores = 1,
dir.out = dir.out,
pvalue = 0.01
)
#-------------------------------------------------------------
# Step 3.2: Identify significant probe-gene pairs |
#-------------------------------------------------------------
# Collect nearby 20 genes for Sig.probes
nearGenes <- GetNearGenes(
data = mae,
probes = sig.diff$probe,
numFlankingGenes = 20, # 10 upstream and 10 dowstream genes
cores = 1
)
pair <- get.pair(
data = mae,
group.col = group.col,
group1 = group1,
group2 = group2,
nearGenes = nearGenes,
minSubgroupFrac = 0.4, # % of samples to use in to create groups U/M
permu.dir = file.path(dir.out,"permu"),
permu.size = 100, # Please set to 100000 to get significant results
raw.pvalue = 0.05,
Pe = 0.01, # Please set to 0.001 to get significant results
filter.probes = TRUE, # See preAssociationProbeFiltering function
filter.percentage = 0.05,
filter.portion = 0.3,
dir.out = dir.out,
cores = 1,
label = direction
)
# Identify enriched motif for significantly hypomethylated probes which
# have putative target genes.
enriched.motif <- get.enriched.motif(
data = mae,
probes = pair$Probe,
dir.out = dir.out,
label = direction,
min.incidence = 10,
lower.OR = 1.1
)
TF <- get.TFs(
data = mae,
group.col = group.col,
group1 = group1,
group2 = group2,
minSubgroupFrac = 0.4,
enriched.motif = enriched.motif,
dir.out = dir.out,
cores = 1,
label = direction
)
```
From this analysis it is possible to verify the relationship between nearby 20
gene expression vs DNA methylation at this probe. The result of this is
show by the ELMER scatter plot.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
scatter.plot(
data = mae,
byProbe = list(probe = sig.diff$probe[1], numFlankingGenes = 20),
category = "definition",
dir.out = "plots",
lm = TRUE, # Draw linear regression curve
save = TRUE
)
```
The result is shown below:
```{r, fig.width=6, fig.height=4, echo = FALSE, fig.align="center",hide=TRUE, message=FALSE,warning=FALSE}
library(png)
library(grid)
img <- readPNG("case4_elmer.png")
grid.raster(img)
```
Each scatter plot showing the average DNA methylation level of sites with the UA6 motif in all KIRC samples plotted against the expression of the transcription factor ZNF677 and PEG3 respectively.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
scatter.plot(
data = mae,
byTF = list(
TF = c("RUNX1","RUNX2","RUNX3"),
probe = enriched.motif[[names(enriched.motif)[10]]]
),
category = "definition",
dir.out = "plots",
save = TRUE,
lm_line = TRUE
)
```
The result is shown below:
```{r, fig.width=6, fig.height=4, echo = FALSE, fig.align="center",hide=TRUE, message=FALSE,warning=FALSE}
library(png)
library(grid)
img <- readPNG("elmer1.png")
grid.raster(img)
```
You cen see the anticorrelated pairs of gene and probes by drawing a heatmap.
```{r,eval=FALSE,echo=TRUE,message=FALSE,warning=FALSE}
heatmapPairs(
data = mae,
group.col = "definition",
group1 = "Primary Tumor",
annotation.col = c("gender"),
group2 = "Solid Tissue Normal",
pairs = pair,
filename = "heatmap.pdf"
)
```
The result is shown below:
```{r, fig.width=6, fig.height=4, echo = FALSE, fig.align="center",hide=TRUE, message=FALSE,warning=FALSE}
library(jpeg)
library(grid)
img <- readJPEG("elmer2.jpg")
grid.raster(img)
```
The plot shows the odds ratio (x axis) for the selected motifs with lower boundary of OR above 1.8.
The range shows the 95% confidence interval for each Odds Ratio.
```{r, fig.width=6, fig.height=4, echo = FALSE, fig.align="center",hide=TRUE, message=FALSE,warning=FALSE}
library(png)
library(grid)
img <- readPNG("elmer3.png")
grid.raster(img)
```
******
# Session Information
******
```{r sessionInfo}
sessionInfo()
```
# References
|