Learn R Programming

MineICA (version 1.12.0)

plotDensOneAnnotInAllComp: Tests if groups of samples are differently distributed on the components and do the corresponding plots.

Description

Given a variable of the phenotype data (i.e vector of sample annotations), this function tests if the groups of samples formed by this variable are differently distributed on the components, in terms of contribution values. The distribution of the groups on the components are represented using density plots. It is possible to restrict the tests and the plots to a subset of samples and/or components.

Usage

plotDensOneAnnotInAllComp(icaSet, keepVar, path = NULL, samples, keepComp, keepLev = NULL, colours = NULL, legend.title = NULL, doPlot = TRUE, cutoff = 0.05, onlySign = TRUE, resTests)

Arguments

icaSet
an object of class IcaSet
keepVar
a variable label, i.e the label of a column of the pheno data of icaSet available in (varLabels(icaSet)) wich contains the groups of interest
path
the directory where the plots will be located
samples
a subset of sample names available in samplenames(icaSet), if NULL (default) all samples are used
keepComp
a subset of components available in indComp(icaSet), if NULL (default) all components are used
keepLev
the groups of interest, i.e the levels of the annotation keepVar to be considered
colours
A vector of colours indexed by the elements of keepLev, if NULL the colours are generated automatically using annot2Color
legend.title
title of the legend
cutoff
The threshold p-value for statistical significance
doPlot
if TRUE (default), the plots are drawn, else if FALSE only test results are returned
onlySign
if TRUE (default), only the significant results are plotted
resTests
a vector of p-values per component, if NULL (default) the p-values are calculated using Wilcoxon or Kruskal-Wallis test

Value

Returns a data.frame of dimensions 'components x 1' containing the results of the non-parametric tests (Wilcoxon or Kruskal-Wallis tests) that test if the groups of interest are differently distributed on the components

Details

Wilcoxon or Kruskal-Wallis tests are applied depending on the number of groups of interest from the considered annotation (argument keepLev). The plots are saved in individual files (one file per component) in arg 'path' if specified or in the current directory if not specificied. Ech individual file is nameb 'index-of-component_colAnnot.png.' Recall that the sample-contribution values are contained in A(icaSet), and the sample annotations in pData(icaSet).

One png image is created by plot and located in path. Each image is named by 'index-of-component_keepVar.png'.

See Also

wilcoxOrKruskalOnA, codewriteHtmlResTestsByAnnot, codewilcox.test, codekruskal.test

Examples

Run this code
## Not run: 
# ## load an example of IcaSet
# data(icaSetCarbayo)
# 
# ## have a look at the sample annotations which are available
# varLabels(icaSetCarbayo)
# 
# ## with doPlot=TRUE trace the contributions of the samples according
# ## to their grade on the components
# restests <- plotDensOneAnnotInAllComp(icaSet=icaSetCarbayo, keepVar="GRADE",
#                                                 doPlot=FALSE)
# ## End(Not run)

Run the code above in your browser using DataLab