generated from u-brite/team-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ovarian-data-rgs.Rmd
127 lines (99 loc) · 2.63 KB
/
ovarian-data-rgs.Rmd
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
---
output:
html_document: default
pdf_document: default
---
title: "Recount3_and_Deseq2"
output: html_document
date: "2022-08-06"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library("recount3")
```
```{r}
ovarian_recount3 <- recount3::create_rse_manual(
project = "OV",
project_home = "data_sources/tcga",
organism = "human",
annotation = "gencode_v26",
type = "gene"
)
```
```{r message= FALSE, warning= FALSE, echo=FALSE}
#install.packages("BiocManager")
#BiocManager::install(c("tximport", "GenomicFeatures"))
#library(BiocManager)
#library(GenomicFeatures)
#library(TxDb.Hsapiens.UCSC.hg19.knownGene)
library(DESeq2)
library(tibble)
library(ggplot2)
```
```{r}
#head(ovarian_recount3)
ovarian_counts <- ovarian_recount3@assays@data@listData$raw_counts
```
```{r}
Normal_vs_Tumor <- ovarian_recount3[["tcga.gdc_cases.samples.sample_type"]]
#head(Normal_vs_Tumor)
```
```{r}
sampleTable <- data.frame(sampleName = ovarian_recount3[["tcga.gdc_cases.case_id"]],
condition = Normal_vs_Tumor)
sampleTable$condition <- factor(sampleTable$condition)
dds <- DESeqDataSetFromMatrix(ovarian_counts, sampleTable, ~condition)
dds <- DESeq(dds)
res <- results(dds)
```
```{r}
res
```
```{r}
resOrdered <- res[order(res$pvalue),]
summary(res)
```
```{r}
res05 <- results(dds, alpha=0.05)
summary(res05)
```
```{r}
plotMA(res, ylim= c(-2,2))
```
```{r}
plotCounts(dds, gene=which.min(res$padj), intgroup="condition")
```
```{r}
resultsNames(dds)
```
```{r}
#BiocManager::install("apeglm")
#library(apeglm)
resLFC <- lfcShrink(dds, coef="condition_Recurrent.Tumor_vs_Primary.Tumor")
```
```{r}
resLFC
```
```{r}
plotMA(resLFC, ylim= c(-2,2))
```
```{r}
#BiocManager::install("vsn")
ntd <- normTransform(dds)
library("vsn")
meanSdPlot(assay(ntd))
```
```{r}
col = c("Primary Tumor"= "#481567FF", "Recurrent Tumor"= "#2D708EFF", "Solid Tissue Normal"= "#29AF7FFF")
counts <- counts(dds['ENSG00000258886.2',], normalized = TRUE)
m <- list(counts = as.numeric(counts), group= sampleTable$condition)
m <- as_tibble(m)
q <- ggplot(m, aes(group, counts)) + geom_boxplot(aes(fill= group)) + geom_jitter(width = 0.1) + aes(color= group) + scale_fill_manual(values = alpha(col,.3)) +scale_color_manual(values = alpha(col, 1.0)) + theme(text = element_text(size = 13)) + theme(axis.text.y = element_text(size = 17)) + theme(legend.position="none")
q <- q + labs(y = "Normalized Counts ", title = "Expression of HIGD1AP17")
q
```
```{r}
#write.csv(res,"C:/results_ovarian_cancer.csv")
```