R: Time Course Analysis for Detecting Differentially Expressed...
tc
R Documentation
Time Course Analysis for Detecting Differentially Expressed Genes
Description
Performs the Time Course Analysis from Acosta (2015) for detecting
differentially expressed genes in time course experiments for gene
expression data.
Usage
tc(data, designs, tPoints = NULL,
method = c("active vs complementary", "groups conformation"),
activeTP = NULL, alpha = 0.05, B = 100, lambda = 0.5,
PER = FALSE, BCa = FALSE, gamma = 0.95, R = 1000, ...)
Arguments
data
a list with matrices or data.frames representing genes' expression levels
at each time point. The rows of each matrix correspond to the genes in
the experiment, and the columns correspond to the replicates. Treatment
replicates are to the left, control replicates to the right.
designs
a list with a vector for each time point, of length equal to the number
of columns in the respective matrix or data.frame in data, with
1's for the treatment replicates and 2's for the control replicates.
tPoints
a character vector with the names of the timepoints.
method
if "active vs complementary", an analysis following the active vs
complementary time points approach (Acosta, 2015) is performed. If "groups
conformation", an analysis following the groups conformation through
time approach (Acosta, 2015) is performed. The default is both.
activeTP
numeric. The index of the active timepoint in tPoints for the
active vs complementary time points approach. If NULL
(default), the active time point is selected via inertia ratios.
alpha
between 0 and 1. Desired level for controlling the false discovery
rate (FDR).
B
Number of bootstrap or permutation replications for estimating the FDR.
lambda
Parameter for the estimation of pi0 and, further, the
estimation of the FDR (see Storey, 2002).
PER
If FALSE (default), bootstrap replications are used to estimate
the FDR. If TRUE, permutation replications are used instead.
BCa
If TRUE, a BCa confidence upper bound for the FDR is computed
(see Efron and Tibshirani, 1994).
gamma
Confidence level for the FDR's BCa upper confidence bound.
R
Number of bootstrap replications for the computation of the FDR's
BCa upper confidence bound.
...
additional arguments for parallel computation in boot
function (see Details).
Details
In the active vs complementary time points approach, the
time point that maximizes the inertia ratio is selected as the
active time point. Then, a Single Time Point Analysis (stp)
is performed on this time point and plots of the behavior throughout the
time course of the differentially expressed genes identified in this time
point are displayed.
In the groups conformation through time approach, a Single Time
Point Analysis (stp) is performed at each time point and plots
are displayed showing the behaviour of the differential expression process
throughout the time course; that is, how many genes are differentially
expressed and how strong is the differential expression at each time point.
For details on the computations performed in this function, see Acosta
(2015).
Additional parameters in the '...' argument are used for parallel
computation in bootstrap calculations. These are supplied to calls to the
boot function in package boot. With this in mind, the use
of additional arguments must be restricted to arguments parallel
and ncpus from function boot.
Value
tc returns an object of class 'TC', which is a
list with components:
iRatios
inertia ratios for each time point.
gct
results for the groups conformation through time approach.
A list with an object of class 'STP' for each timepoint.
act
results for the active vs complementary time points approach.
A list with an object of class 'STP' for each timepoint.
activeTP
the index of the active timepoint in tPoints used in the
active vs complementary time points approach.
tPoints
a character vector with the names of the timepoints.
call
The matched call.
Warning
If argument BCa=TRUE, computations may take a considerable
amount of time.
Acosta, J. P. (2015) Strategy for Multivariate Identification of
Differentially Expressed Genes in Microarray Data. Unpublished MS
thesis. Universidad Nacional de Colombia, Bogot'a.
Storey, J. D. (2002) A direct approach to false discovery rates.
Journal of the Royal Statistical Society: Series B (Statistical Methodology),
64(3): 479–498.
Efron B. and Tibshirani R. J. (1994) An Introduction to the
Bootstrap. Chapman & Hall/CRC, 1993.
See Also
stp for Single Time Point Analysis;
plot.TC, print.TC, summary.TC.
Examples
## Time course analysis for 500 genes with 10 treatment
## replicates and 10 control replicates
tPts <- c("h0", "12h", "24h")
n <- 500; p <- 20; p1 <- 10
Z <- vector("list", 3)
des <- vector("list", 3)
for(tp in 1:3){ des[[tp]] <- c(rep(1, p1), rep(2, (p-p1))) }
mu <- as.matrix(rexp(n, rate=1))
### h0 time point (no diff. expr.)
Z[[1]] <- t(apply(mu, 1, function(mui) rnorm(p, mean=mui, sd=1)))
### h12 time point (diff. expr. begins)
Z[[2]] <- t(apply(mu, 1, function(mui) rnorm(p, mean=mui, sd=1)))
#### Up regulated genes
Z[[2]][1:5,1:p1] <- Z[[2]][1:5,1:p1] +
matrix(runif(5*p1, 1, 3), nrow=5)
#### Down regulated genes
Z[[2]][6:15,(p1+1):p] <- Z[[2]][6:15,(p1+1):p] +
matrix(runif(10*(p-p1), 1, 2), nrow=10)
### h24 time point (maximum differential expression)
Z[[3]] <- t(apply(mu, 1, function(mui) rnorm(p, mean=mui, sd=1)))
#### 5 up regulated genes
Z[[3]][1:5,1:p1] <- Z[[3]][1:5,1:p1] + 5
#### 10 down regulated genes
Z[[3]][6:15,(p1+1):p] <- Z[[3]][6:15,(p1+1):p] + 4
resTC <- tc(Z, des)
resTC
summary(resTC)
plot(resTC)
## Not run:
## Phytophthora Infestans Time Course Analysis (takes time...)
dataPI <- phytophthora
desPI <- vector("list", 4)
for(tp in 1:4){ desPI[[tp]] <- c(rep(1, 8), rep(2, 8)) }
resPI <- tc(dataPI, desPI)
resPI
summary(resPI)
plot(resPI)
## End(Not run)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(acde)
Loading required package: boot
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/acde/tc.Rd_%03d_medium.png", width=480, height=480)
> ### Name: tc
> ### Title: Time Course Analysis for Detecting Differentially Expressed
> ### Genes
> ### Aliases: tc
>
> ### ** Examples
>
> ## Time course analysis for 500 genes with 10 treatment
> ## replicates and 10 control replicates
> tPts <- c("h0", "12h", "24h")
> n <- 500; p <- 20; p1 <- 10
> Z <- vector("list", 3)
> des <- vector("list", 3)
> for(tp in 1:3){ des[[tp]] <- c(rep(1, p1), rep(2, (p-p1))) }
> mu <- as.matrix(rexp(n, rate=1))
> ### h0 time point (no diff. expr.)
> Z[[1]] <- t(apply(mu, 1, function(mui) rnorm(p, mean=mui, sd=1)))
> ### h12 time point (diff. expr. begins)
> Z[[2]] <- t(apply(mu, 1, function(mui) rnorm(p, mean=mui, sd=1)))
> #### Up regulated genes
> Z[[2]][1:5,1:p1] <- Z[[2]][1:5,1:p1] +
+ matrix(runif(5*p1, 1, 3), nrow=5)
> #### Down regulated genes
> Z[[2]][6:15,(p1+1):p] <- Z[[2]][6:15,(p1+1):p] +
+ matrix(runif(10*(p-p1), 1, 2), nrow=10)
> ### h24 time point (maximum differential expression)
> Z[[3]] <- t(apply(mu, 1, function(mui) rnorm(p, mean=mui, sd=1)))
> #### 5 up regulated genes
> Z[[3]][1:5,1:p1] <- Z[[3]][1:5,1:p1] + 5
> #### 10 down regulated genes
> Z[[3]][6:15,(p1+1):p] <- Z[[3]][6:15,(p1+1):p] + 4
>
> resTC <- tc(Z, des)
> resTC
Time course analysis for detecting differentially expressed
genes in microarray data.
Inertia ratios (%):
t1 t2 t3
5.39 8.23 19.45
Active timepoint: t3
TIME POINT: t1.
Achieved FDR: 80.6%.
Inertia ratio: %.
tstar: 1.223, pi0: 1, B: 100.
Differentially expressed genes:
down-reg. no-diff. up-reg.
27 445 28
Results:
psi1 psi2 Q-value Diff. expr.
1 -2.224 1.271 0.806 up-reg.
2 1.984 1.511 0.806 up-reg.
3 -2.990 1.546 0.806 up-reg.
4 2.588 1.266 0.806 up-reg.
5 -0.522 1.253 0.806 up-reg.
6 -3.112 1.241 0.806 up-reg.
7 -0.425 1.475 0.806 up-reg.
8 -2.115 1.633 0.806 up-reg.
9 -2.891 1.448 0.806 up-reg.
10 -1.684 1.374 0.806 up-reg.
...
*More results are available in the objects:
$ac, $qvalues and $dgenes.
TIME POINT: t2.
Achieved FDR: 5%.
Inertia ratio: %.
tstar: 2.524, pi0: 1, B: 100.
Differentially expressed genes:
down-reg. no-diff. up-reg.
7 487 6
Results:
psi1 psi2 Q-value Diff. expr.
1 7.758 4.647 0.000 up-reg.
2 4.562 4.448 0.000 up-reg.
3 0.209 3.005 0.016 up-reg.
4 2.674 2.975 0.016 up-reg.
5 2.955 2.590 0.049 up-reg.
6 -1.410 2.524 0.050 up-reg.
7 -0.144 -3.645 0.003 down-reg.
8 0.241 -3.415 0.008 down-reg.
9 7.394 -3.530 0.008 down-reg.
10 0.220 -3.179 0.011 down-reg.
11 -0.520 -3.243 0.011 down-reg.
12 5.721 -2.699 0.034 down-reg.
13 4.072 -2.549 0.050 down-reg.
14 -2.124 -2.243 0.124 no-diff.
15 -2.473 -2.136 0.178 no-diff.
16 0.720 -2.088 0.182 no-diff.
17 -0.660 -2.091 0.182 no-diff.
18 1.423 -2.058 0.196 no-diff.
19 -1.407 -1.946 0.278 no-diff.
20 4.382 -1.861 0.351 no-diff.
21 -4.281 -1.819 0.366 no-diff.
22 6.722 1.809 0.366 no-diff.
23 2.559 1.757 0.392 no-diff.
...
*More results are available in the objects:
$ac, $qvalues and $dgenes.
TIME POINT: t3.
Achieved FDR: 0.5%.
Inertia ratio: %.
tstar: 4.523, pi0: 1, B: 100.
Differentially expressed genes:
down-reg. no-diff. up-reg.
10 485 5
Results:
psi1 psi2 Q-value Diff. expr.
1 11.155 9.447 0.000 up-reg.
2 4.442 7.967 0.000 up-reg.
3 8.056 7.349 0.000 up-reg.
4 7.076 7.899 0.000 up-reg.
5 7.814 7.881 0.000 up-reg.
6 2.276 -6.033 0.000 down-reg.
7 6.748 -6.225 0.000 down-reg.
8 10.532 -5.838 0.000 down-reg.
9 6.035 -6.252 0.000 down-reg.
10 5.111 -6.070 0.000 down-reg.
11 4.564 -7.681 0.000 down-reg.
12 5.300 -6.197 0.000 down-reg.
13 3.621 -6.722 0.000 down-reg.
14 4.387 -5.184 0.001 down-reg.
15 3.605 -4.523 0.005 down-reg.
16 -0.799 2.532 0.146 no-diff.
17 1.763 -2.118 0.258 no-diff.
18 0.007 -2.076 0.264 no-diff.
19 -1.145 -1.979 0.300 no-diff.
20 -0.109 1.760 0.451 no-diff.
21 -2.052 -1.721 0.451 no-diff.
22 -3.278 1.739 0.451 no-diff.
23 -2.009 -1.714 0.451 no-diff.
24 -2.681 -1.550 0.566 no-diff.
25 -2.943 1.580 0.566 no-diff.
...
*More results are available in the objects:
$ac, $qvalues and $dgenes.
> summary(resTC)
Time course analysis for detecting differentially
expressed genes in microarray data.
Inertia ratios (%):
t1 t2 t3
5.39 8.23 19.45
Active vs complementary time points analysis:
Active timepoint: t3
Achieved FDR: 0.47 %.
Differentially expressed genes:
down-reg. no-diff. up-reg.
10 485 5
Groups conformation through time analysis:
Differentially expressed genes:
t2 vs t3
down-reg. no-diff. up-reg. Sum
down-reg. 6 1 0 7
no-diff. 4 483 0 487
up-reg. 0 1 5 6
Sum 10 485 5 500
> plot(resTC)
>
> ## Not run:
> ##D ## Phytophthora Infestans Time Course Analysis (takes time...)
> ##D dataPI <- phytophthora
> ##D desPI <- vector("list", 4)
> ##D for(tp in 1:4){ desPI[[tp]] <- c(rep(1, 8), rep(2, 8)) }
> ##D resPI <- tc(dataPI, desPI)
> ##D resPI
> ##D summary(resPI)
> ##D plot(resPI)
> ## End(Not run)
>
>
>
>
>
> dev.off()
null device
1
>