-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrnaseqGene.R
89 lines (54 loc) · 1.71 KB
/
rnaseqGene.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
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
library(rnaseqGene)
dir <- system.file("extdata", package="airway", mustWork=TRUE)
list.files(dir)
csvfile <- file.path(dir, "sample_table.csv")
coldata <- read.csv(csvfile, row.names=1, stringsAsFactors=FALSE)
coldata
coldata$names <- coldata$Run
dir <- "/home/islam/airway"
coldata$files <- file.path(dir, "quants", paste0(coldata$names,"_quant"), "quant.sf")
file.exists(coldata$files)
# makeLinkedTxome
# check the latest genomes versions
hashfile <- file.path(system.file("extdata",package="tximeta"),"hashtable.csv")
hashtable <- read.csv(hashfile,stringsAsFactors=FALSE)
hashtable[,"organism"]
se <- tximeta(coldata,useHub=FALSE)
gse <- summarizeToGene(se)
assay(gse)
assayNames(gse)
head(assay(gse), 3)
colSums(assay(gse))
rowRanges(gse)
seqinfo(rowRanges(gse))
colData(gse)
gse$dex <- factor(gse$dex, levels=c("untrt","trt"))
gse$cell <- factor(gse$cell, unique(gse$cell))
levels(gse$cell)
dds <- DESeqDataSet(gse, design = ~ cell + dex)
keep <- rowSums(counts(dds)) > 1
dds <- dds[keep,]
nrow(dds)
lambda <- 10^seq(from = -1, to = 2, length = 1000)
cts <- matrix(rpois(1000*100, lambda), ncol = 100)
library("vsn")
meanSdPlot(cts, ranks = FALSE)
log.cts.one <- log2(cts + 1)
meanSdPlot(log.cts.one, ranks = FALSE)
dds <- DESeq(dds)
res <- results(dds)
res
summary(res)
mcols(res, use.names = TRUE)
library("apeglm")
resultsNames(dds)
#results(dds, contrast = c("cell", "N061011", "N61311"))
res <- results(dds, contrast=c("dex","trt","untrt"))
summary(res)
DESeq2::plotMA(res)
res <- lfcShrink(dds, coef="dex_trt_vs_untrt", type="apeglm")
DESeq2::plotMA(res, ylim = c(-5, 5))
res.05 <- results(dds, alpha = 0.05)
table(res.05$padj < 0.05)
resLFC1 <- results(dds, lfcThreshold=1)
table(resLFC1$padj < 0.1)