deg: Differential Expression Gene extraction using TCC package

Description Usage Arguments Value Examples

View source: R/deg.R

Description

Differential expression gene using several methods from the pipeline of TCC packages.

Usage

1
deg(dat, gp, method, normalized, fdr)

Arguments

dat

dataframe: RNA-seq count table. row: samples, column: genes

gp

factor: group of data. E.g. factor(c(1,1,2,2)); factor(c('A','A','B','B'))

method

integer: Choose from the six pipe line numbers below 1:'DEGES/TbT', 2:'DEGES/edgeR', 3:'iDEGES/edgeR', 4: 'DEGES/DESeq', 5: iDEGES/DESeq, 6: iDEGES/DESeq2. The default value is 2

normalized

logical[defalut FALSE]: if the 'dat' has already normalized set to be TRUE.

fdr

numeric[defalut 0.05]: fdr value.

Value

TCC object and a result of 'TCC::estimateDE', without normalized count data.

Examples

 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
## Not run: 
# sample data of rna-seq
fpkm_rep3 <- rskodat::fpkm[1:6]
fpkm_rep2 <- rskodat::fpkm[c(1,2,4,5)]
fpkm_norep <- rskodat::fpkm[c(1,4)]

# aruguments
idx1 <- rep(c(1,2), each = 3)
idx2 <- rep(c(1,2), each = 2)
idx3 <- c(1,2)

# two-group with replicate
# If you choose 4,5,or 6 which using DESeq, you should load library TCC.
res1 <- deg(dat = fpkm_rep3, gp = idx1, fdr = 0.05, method = 1)
res2 <- deg(dat = fpkm_rep3, gp = idx1, fdr = 0.05, method = 2)
res3 <- deg(dat = fpkm_rep3, gp = idx1, fdr = 0.05, method = 3)
res4 <- deg(dat = fpkm_rep3, gp = idx1, fdr = 0.05, method = 4)
res5 <- deg(dat = fpkm_rep3, gp = idx1, fdr = 0.05, method = 5)
res6 <- deg(dat = fpkm_rep3, gp = idx1, fdr = 0.05, method = 6)

# get result of estimateDE
head(res3$deg)

# draw MA-plot
TCC::plot.TCC(res3$tcc)

# redraw with ggplot2
res3$res[c]
deg_dat <- res3m$deg %>% filter(comp %in% levels(.$comp)[1:3])
num_de <- res3m$num_deg %>% filter(comp %in% levels(.$comp)[1:3])

ggplot2::ggplot(deg_dat, ggplot2::aes(x = a.value, y = m.value, colour = fct)) +
  ggplot2::geom_point(size = 0.3) +
  ggplot2::scale_color_manual(values =
    c("non-DEG"="#BEBEBE80", "up"="#FF000080", "down" ="#0000FF80")) +
  ggplot2::theme_minimal(base_size = 15) +
  ggplot2::labs(x = "A=(log2(G2)+log2(G1))/2", y = "M=log2(G2)-log2(G1)", colour = "") +
  ggplot2::theme(legend.position = "top") +
  ggplot2::guides(colour = ggplot2::guide_legend(override.aes = list(alpha=1, size = 5))) +
  ggplot2::geom_text(data = add_de, ggplot2::aes(x = x, y = y, label = value, colour = key),
    size = 5, show.legend = F) +
  ggplot2::facet_wrap(~comp, ncol = 3)

## End(Not run)

shkonishi/rskoseq documentation built on April 18, 2021, 3:50 p.m.