-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDESeqAnalysis.R
35 lines (25 loc) · 1.06 KB
/
DESeqAnalysis.R
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
library(readr)
transcript_count_matrix <- data.frame(read_csv("Downloads/transcript_count_matrix.csv"))
rownames(transcript_count_matrix) = transcript_count_matrix$transcript_id
transcript_count_matrix$transcript_id = NULL
count_matrix = as.matrix(transcript_count_matrix)
pheno_data = read.csv("Downloads/phenotypedata.txt", row.names = 1)
dds <- DESeqDataSetFromMatrix(countData = count_matrix, colData = pheno_data, design = ~ light)
dds <- DESeq(dds)
res <- results(dds)
resOrdered <- res[order(res$log2FoldChange),] ##order by log fold change
restableordered <- data.frame(resOrdered)
restableordered <- na.omit(restableordered)
headrestableordered <- head(restableordered)
tailrestableordered <- tail(restableordered)
totaltable <- rbind(headrestableordered,tailrestableordered)
totaltablefolds <- totaltable[c(2)]
jpeg('foldchangegraph.jpg')
barplot(as.matrix(totaltablefolds),
main = "Most Extreme Changes by Fold Change",
ylab = "Fold Change",
col = "light green",
ylim = c(-40,40),
beside = TRUE)
dev.off()
View(totaltablefolds)