Skip to contents

This function plots graphs informing on the fit of the mixed modeling of the gene expression performed in TcGSA, for 1 or several gene sets.

Usage

plotFit.GS(
  x,
  expr,
  design,
  subject_name = "Patient_ID",
  time_name = "TimePoint",
  colnames_ID,
  plot_type = c("Fit", "Residuals Obs", "Residuals Est", "Histogram Obs"),
  GeneSetsList,
  color = c("genes", "time", "subjects"),
  marginal_hist = TRUE,
  gg.add = list(theme())
)

Arguments

x

a tcgsa object for clustTrend, or a ClusteredTrends object for print.ClusteredTrends and plot.ClusteredTrends.

expr

a matrix or dataframe of gene expression. Its dimension are \(n\)x\(p\), with the \(p\) samples in column and the \(n\) genes in row.

design

a matrix or dataframe containing the experimental variables that used in the model, namely subject_name, time_name, and covariates_fixed and time_covariates if applicable. Its dimension are \(p\)x\(m\) and its row are is in the same order as the columns of expr.

subject_name

the name of the factor variable from design that contains the information on the repetition units used in the mixed model, such as the patient identifiers for instance. Default is 'Patient_ID'. See Details.

time_name

the name of a numeric variable from design that contains the information on the time replicates (the time points at which gene expression was measured). Default is 'TimePoint'. See Details.

colnames_ID

the name of the variable from design that contains the column names of the expr expression data matrix. See Details.

plot_type

a character string indicating the type of plot to be drawn. The options are 'Fit', 'Residuals Obs', 'Residuals Est' or 'Histogram Obs'.

GeneSetsList

a character string containing the names of the gene set whose fit is being checked. If several gene sets are being checked, can be a character list or vector of the names of those gene sets.

color

a character string indicating which color scale should be used. One of the 3 : 'genes', 'time', 'subjects', otherwise, no coloring is used.

marginal_hist

a logical flag indicating whether marginal histograms should be drawn. Only used for 'Fit' plot type. Default is 'TRUE'

gg.add

A list of instructions to add to the ggplot2 instructions. See +.gg. Default is list(theme()), which adds nothing to the plot.

References

Hejblum BP, Skinner J, Thiebaut R, (2015) Time-Course Gene Set Analysis for Longitudinal Gene Expression Data. PLOS Comput. Biol. 11(6):e1004310. doi: 10.1371/journal.pcbi.1004310

Author

Boris P. Hejblum

Examples


if(interactive()){

data(data_simu_TcGSA)

tcgsa_sim_1grp <- TcGSA.LR(expr=expr_1grp, gmt=gmt_sim, design=design, 
                          subject_name="Patient_ID", time_name="TimePoint",
                          time_func="linear", crossedRandom=FALSE)
plotFit.GS(x=tcgsa_sim_1grp, expr=expr_1grp, design=design,
         subject_name="Patient_ID", time_name="TimePoint",
         colnames_ID="Sample_name", 
         plot_type="Residuals Obs", 
         GeneSetsList=c("Gene set 1", "Gene set 2", "Gene set 3",
                        "Gene set 4", "Gene set 5"),
         color="genes", gg.add=list(guides(color=FALSE))
)

plotFit.GS(x=tcgsa_sim_1grp, expr=expr_1grp, design=design,
          subject_name="Patient_ID", time_name="TimePoint",
          colnames_ID="Sample_name", 
          plot_type="Histogram Obs", 
          GeneSetsList=c("Gene set 1", "Gene set 5"),
          color="genes", gg.add=list(guides(fill=FALSE))
          )
          
plotFit.GS(x=tcgsa_sim_1grp, expr=expr_1grp, design=design,
          subject_name="Patient_ID", time_name="TimePoint",
          colnames_ID="Sample_name", 
          plot_type="Histogram Obs", 
          GeneSetsList=c("Gene set 1", "Gene set 2", "Gene set 3",
                    "Gene set 4", "Gene set 5"),
          color="genes")
}