-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtme-genomic-interaction.Rmd
More file actions
127 lines (96 loc) · 4.48 KB
/
Copy pathtme-genomic-interaction.Rmd
File metadata and controls
127 lines (96 loc) · 4.48 KB
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
# **TME and genomic interaction**
## Loading packages
```{r, eval=TRUE, warning=FALSE, message=FALSE}
library(IOBR)
```
## Genomic data prepare
In this section, we are going to use the MAF data of TCGA-STAD cohort as an example dataset. This dataset could be found in multiple places, here we show two ways to get it.
### Using TCGAbiolinks to download genomic data
R Bioconductor package **[TCGAbiolinks](https://bioconductor.org/packages/TCGAbiolinks/)** provides an R interface of [GDC data portal](https://portal.gdc.cancer.gov/), which stores updating TCGA data. You can check and install this package with the following code.
```{r, eval=FALSE}
if (!requireNamespace("TCGAbiolinks", quietly = TRUE)) {
BiocManager::install("TCGAbiolinks")
}
```
Then you can query, download and prepare the required dataset.
```{r, eval=FALSE}
library(TCGAbiolinks)
query <- GDCquery(
project = "TCGA-STAD",
data.category = "Simple Nucleotide Variation",
access = "open",
data.type = "Masked Somatic Mutation",
workflow.type = "Aliquot Ensemble Somatic Variant Merging and Masking"
)
GDCdownload(query)
maf <- GDCprepare(query)
```
This `maf` object is a `data.frame`, you can use `read.maf()` from R package **[Maftools](https://github.com/PoisonAlien/maftools)** to convert it to a MAF object.
In this example, we used the maf file of TCGA-STAD to extract the SNPs in it,and then transformed it into a non-negative matrix.
```{r,message=FALSE,warning=FALSE}
(load("TCGA-STAD.maf.RData"))
mut_list <- make_mut_matrix(maf = maf, isTCGA = T, category = "multi")
mut <- mut_list$snp
```
## Identifying Mutations Associated with TME
The microenvironmental data from the TCGA-STAD expression matrix was merged. The Cuzick or Wilcoxon test was used to identify genetic variants associated with microenvironmental factors. CD_8_T_effector was used as the target variable in this example.
```{r, fig.show= 'hide'}
tcga_stad_sig <- load_data("tcga_stad_sig")
res <- tryCatch(
{
find_mutations(
mutation_matrix = mut,
signature_matrix = tcga_stad_sig,
id_signature_matrix = "ID",
signature = "CD_8_T_effector",
palette = "nrc",
min_mut_freq = 0.01,
plot = TRUE,
jitter = TRUE
)
},
error = function(e) {
message("find_mutations error: ", e$message)
NULL
}
)
```
## OncoPrint of result
```{r echo=FALSE, fig.cap='OncoPrint', out.width='95%', fig.asp=.85, fig.align='center'}
knitr::include_graphics(rep("./fig/0-OncoPrint-CD_8_T_effector.png", 1))
```
## Boxplot of top 10 mutated genes
```{r echo=FALSE, fig.cap='Top 10 mutated genes', out.width='95%', fig.asp=.85, fig.align='center'}
knitr::include_graphics(rep("./fig/4-Relevant_mutations_binary.png", 1))
```
## Other methods to obtaind genomic data
### Using TCGAmutations
As its name, the R package **[TCGAmutations](https://github.com/PoisonAlien/TCGAmutations)** provides pre-compiled, curated somatic mutations from 33 TCGA cohorts along with relevant clinical information for all sequenced samples. You can install it similar to the **TCGAbiolinks**.
```{r, eval=FALSE}
if (!requireNamespace("TCGAmutations", quietly = TRUE)) {
BiocManager::install("PoisonAlien/TCGAmutations")
}
```
It's quite simple to use:
```{r, eval=FALSE}
maf <- TCGAmutations::tcga_load(study = "STAD")
# Change `source` argument to Firehose for MAF files from Broad Firehose
# maf = TCGAmutations::tcga_load(study = "STAD", source = "Firehose")
```
### Using maftools
If you are a user of R package **[Maftools](https://github.com/PoisonAlien/maftools)**, you can access and load the data in a similar way (because the author of **TCGAmutations** and **Maftools** is the same person).
```{r, eval=FALSE}
# The following github can be changed to gitee
# it maybe fast in China mainland
maftools::tcgaAvailable(repo = "github")
maftools::tcgaLoad("STAD", repo = "github")
```
MAF data transformation
To prepare the data for the downstream analysis. We need to extract the SNV data in it and transform it into a non-negative matrix.
```{r, eval=FALSE}
mut_list <- make_mut_matrix(maf = maf, isTCGA = TRUE, category = "multi")
```
## References
Wang et al., (2019). The UCSCXenaTools R package: a toolkit for accessing genomics data from UCSC Xena platform, from cancer multi-omics to single-cell RNA-seq. Journal of Open Source Software, 4(40), 1627, https://doi.org/10.21105/joss.01627
Gu, Z. (2022) Complex Heatmap Visualization. iMeta.
Anand Mayakonda et al., (2018) Maftools: efficient and comprehensive analysis of somatic variants in cancer. Genome Research