plot_impulse: Plot impulse model fits

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/Impulse_DE_fin.R

Description

Plots impulse model fits for the specified gene IDs. In the case of two time courses, the fits for the combined, case and control data are plotted.

Usage

1
2
3
4
plot_impulse(gene_IDs, data_table, data_annotation, imp_fit_genes,
  control_timecourse = FALSE, control_name = NULL, case_name = NULL,
  file_name_part = "", title_line = "", sub_line = "",
  new_device = TRUE)

Arguments

gene_IDs

character vector of gene names to be plotted; must be part of the rownames of data_table

data_table

numeric matrix of expression values; genes should be in rows, samples in columns. Data should be properly normalized and log2-transformed as well as filtered for present or variable genes.

data_annotation

table providing co-variables for the samples including condition and time points. Time points must be numeric numbers.

imp_fit_genes

list of fitted impulse model values and parameters as produced by impulse_DE (list element impulse_fit_results).

control_timecourse

logical indicating whether a control time timecourse is part of the data set (TRUE) or not (FALSE). Default is FALSE.

control_name

character string specifying the name of the control condition in annotation_table.

case_name

character string specifying the name of the case condition in annotation_table. Should be set if more than two conditions are present in data_annotation.

file_name_part

character string to be used as file extention.

title_line

character string to be used as title for each plot.

sub_line

character string to be used as subtitle for each plot.

new_device

logical indicating whether each plot should be plotted into a new device (TRUE) or not (FALSE). Default is TRUE.

Value

Plots of the impulse model fits for the specified gene IDs.

Author(s)

Jil Sander

References

Chechik, G. and Koller, D. (2009) Timing of Gene Expression Responses to Envi-ronmental Changes. J. Comput. Biol., 16, 279-290.

See Also

impulse_DE, calc_impulse.

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
45
#' Install package longitudinal and load it
library(longitudinal)
#' Attach datasets
data(tcell)
#' check dimension of data matrix of interest
dim(tcell.10)
#' generate a proper annotation table
annot <- as.data.frame(cbind("Time" =
     sort(rep(get.time.repeats(tcell.10)$time,10)),
     "Condition" = "activated"), stringsAsFactors = FALSE)
#' Time columns must be numeric
annot$Time <- as.numeric(annot$Time)
#' rownames of annotation table must appear in data table
rownames(annot) = rownames(tcell.10)
#' since genes must be in rows, transpose data matrix using t()
#' consider 6 genes for now only
genes <- c("SIVA","CD69","ZNFN1A1","IL4R","MAP2K4","JUND")
tcell.10.filtered <- t(tcell.10[,genes])
#' generate a list object having the form of the output of impulse_DE
#' first the parameter fits and SSEs
impulse_parameters_case <- matrix(
    c(0.6,	18.6,	17.2,	17.4,	5.1,	40.2,	3.5,
      0.3,	-464.9,	18.3,	17.3,	-17.2,	35.3,	17.5,
      23.2,	18,	18.8,	18.5,	3,	37,	13.2,
      NA,	NA,	NA,	NA,	NA,	NA,	3.1,
      NA,	NA,	NA,	NA,	NA,	NA,	9.6,
      9.5,	17.5,	18.7,	17.5,	8,	48,	46.7),length(genes),7, byrow = TRUE)
rownames(impulse_parameters_case) <- genes
colnames(impulse_parameters_case) <- c("beta", "h0", "h1", "h2", "t1", "t2", "SSE")
#' then the fitted values for the time points
impulse_fits_case <- matrix(c(
    18.55,	18.43,	18.15,	17.73,	17.43,	17.24,	17.24,	17.24,	17.38,	17.38,
    16.22,	17.18,	17.7,	17.97,	18.12,	18.27,	18.26,	18.03,	17.3,	17.28,
    18,	18,	18.82,	18.82,	18.82,	18.82,	18.82,	18.82,	18.48,	18.48,
    15.93,	15.93,	15.93,	15.93,	15.93,	15.93,	15.93,	15.93,	15.93,	15.93,
    17.62,	17.62,	17.62,	17.62,	17.62,	17.62,	17.62,	17.62,	17.62,	17.62,
    17.5,	17.5,	17.5,	17.5,	18.18,	18.67,	18.67,	18.67,	17.98,	17.53)
    ,length(genes),length(unique(annot$Time)), byrow = TRUE)
rownames(impulse_fits_case) <- genes
colnames(impulse_fits_case) <- unique(annot$Time)
#' finalize list object
impulse_fit_genes <- list("impulse_parameters_case" = impulse_parameters_case,
                          "impulse_fits_case" = impulse_fits_case)
#' Plot expression values
plot_impulse(genes, tcell.10.filtered, annot, impulse_fit_genes)

ImpulseDE documentation built on April 28, 2020, 9:05 p.m.