R: Tests association between qualitative variables and...
qualVarAnalysis
R Documentation
Tests association between qualitative variables and components.
Description
This function tests if the groups of samples formed by
the variables are differently distributed on the
components, in terms of contribution value (i.e of values
in matrix A(icaSet)). The distribution of the
samples on the components are represented using either
density plots of boxplots. It is possible to restrict the
tests and the plots to a subset of samples and/or
components.
An object of class
MineICAParams
providing the parameters of the analysis.
icaSet
An object of class
IcaSet.
keepVar
The variable labels to be considered, must
be a subset of varLabels(icaSet).
keepComp
A subset of components, must be included
in indComp(icaSet). By default, all components are
used.
keepSamples
A subset of samples, must be included
in sampleNames(icaSet). By default, all samples
are used.
adjustBy
The way the p-values of the Wilcoxon and
Kruskal-Wallis tests should be corrected for multiple
testing: "none" if no p-value correction has to be
done, "component" if the p-values have to be
corrected by component, "variable" if the p-values
have to be corrected by variable
method
The correction method, see
p.adjust for details, default is
"BH" for Benjamini & Hochberg.
doPlot
If TRUE (default), the plots are done, else
only tests are performed.
addPoints
If TRUE, points are superimposed on the
boxplot.
typePlot
The type of plot, either "density"
or "boxplot".
onlySign
If TRUE (default), only the significant
results are plotted.
cutoff
A threshold p-value for statistical
significance.
colours
A vector of colours indexed by the
variable levels, if missing the colours are automatically
generated using annot2Color.
path
A directory _within resPath(params)_ where
the files containing the plots and the p-value results
will be located. Default is "qualVarAnalysis/".
typeImage
The type of image file to be used.
filename
The name of the HTML file containing the
p-values of the tests, if NULL no file is created.
Details
This function writes an HTML file containing the results
of the tests as a an array of dimensions 'variables *
components' containing the p-values of the tests. When a
p-value is considered as significant according to the
threshold cutoff, it is written in bold and filled
with a link pointing to the corresponding plot. One image
is created by plot and located into the sub-directory
"plots/" of path. Each image is named by
index-of-component_var.png. Wilcoxon or Kruskal-Wallis
tests are performed depending on the number of groups of
interest in the considered variable (argument
keepLev).
Value
Returns A data.frame of dimensions 'components x
variables' containing the p-values of the non-parametric
tests (Wilcoxon or Kruskal-Wallis tests) wich test if the
samples groups defined by each variable are differently
distributed on the components.
## load an example of IcaSet
data(icaSetCarbayo)
## build MineICAParams object
params <- buildMineICAParams(resPath="carbayo/")
## Define the directory containing the results
dir <- paste(resPath(params), "comp2annot/", sep="")
## Run tests, make no adjustment of the p-values,
# for variable grade and components 1 and 2,
# and plot boxplots when 'doPlot=TRUE'.
qualVarAnalysis(params=params, icaSet=icaSetCarbayo, adjustBy="none", typePlot="boxplot",
keepVar="GRADE", keepComp=1:2, path=dir, doPlot=FALSE)
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(MineICA)
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Loading required package: Biobase
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
Loading required package: plyr
Loading required package: ggplot2
Loading required package: scales
Loading required package: foreach
Loading required package: xtable
Loading required package: biomaRt
Loading required package: gtools
Loading required package: GOstats
Loading required package: Category
Loading required package: stats4
Loading required package: AnnotationDbi
Loading required package: IRanges
Loading required package: S4Vectors
Attaching package: 'S4Vectors'
The following object is masked from 'package:plyr':
rename
The following objects are masked from 'package:base':
colMeans, colSums, expand.grid, rowMeans, rowSums
Attaching package: 'IRanges'
The following object is masked from 'package:plyr':
desc
Loading required package: Matrix
Attaching package: 'Matrix'
The following object is masked from 'package:S4Vectors':
expand
Loading required package: graph
Attaching package: 'graph'
The following object is masked from 'package:plyr':
join
Attaching package: 'GOstats'
The following object is masked from 'package:AnnotationDbi':
makeGOGraph
Loading required package: cluster
Loading required package: marray
Loading required package: limma
Attaching package: 'limma'
The following object is masked from 'package:BiocGenerics':
plotMA
Loading required package: mclust
Package 'mclust' version 5.2
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: RColorBrewer
Loading required package: colorspace
Loading required package: igraph
Attaching package: 'igraph'
The following objects are masked from 'package:graph':
degree, edges, intersection, union
The following objects are masked from 'package:IRanges':
simplify, union
The following objects are masked from 'package:S4Vectors':
compare, union
The following object is masked from 'package:gtools':
permute
The following objects are masked from 'package:BiocGenerics':
normalize, union
The following objects are masked from 'package:stats':
decompose, spectrum
The following object is masked from 'package:base':
union
Loading required package: Rgraphviz
Loading required package: grid
Attaching package: 'Rgraphviz'
The following objects are masked from 'package:IRanges':
from, to
The following objects are masked from 'package:S4Vectors':
from, to
Loading required package: annotate
Loading required package: XML
Attaching package: 'XML'
The following object is masked from 'package:graph':
addNode
Attaching package: 'annotate'
The following object is masked from 'package:Rgraphviz':
toFile
Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Attaching package: 'Hmisc'
The following object is masked from 'package:AnnotationDbi':
contents
The following objects are masked from 'package:xtable':
label, label<-
The following objects are masked from 'package:plyr':
is.discrete, summarize
The following objects are masked from 'package:Biobase':
combine, contents
The following object is masked from 'package:BiocGenerics':
combine
The following objects are masked from 'package:base':
format.pval, round.POSIXt, trunc.POSIXt, units
Loading required package: fastICA
Loading required package: JADE
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/MineICA/qualVarAnalysis.Rd_%03d_medium.png", width=480, height=480)
> ### Name: qualVarAnalysis
> ### Title: Tests association between qualitative variables and components.
> ### Aliases: qualVarAnalysis
>
> ### ** Examples
>
> ## load an example of IcaSet
> data(icaSetCarbayo)
>
> ## build MineICAParams object
> params <- buildMineICAParams(resPath="carbayo/")
>
> ## Define the directory containing the results
> dir <- paste(resPath(params), "comp2annot/", sep="")
>
> ## Run tests, make no adjustment of the p-values,
> # for variable grade and components 1 and 2,
> # and plot boxplots when 'doPlot=TRUE'.
> qualVarAnalysis(params=params, icaSet=icaSetCarbayo, adjustBy="none", typePlot="boxplot",
+ keepVar="GRADE", keepComp=1:2, path=dir, doPlot=FALSE)
1 2
GRADE 0.01569781 0.006969333
>
>
>
>
>
> dev.off()
null device
1
>