A data.frame containing the graph
description. It must have two columns n1 and
n2, each row denoting that there is an edge from
n1 to n2. Node labels in columns n1 and n2
of dataGraph must correspond to node IDs in column
id of nodeAttrs.
edgeWeight
The column of dataGraph used to weight
edges.
nodeAttrs
A data.frame with node description, see
function nodeAttrs.
nodeShape
Denotes the column of nodeAttrs
used to attribute the node shapes.
nodeCol
Denotes the column of nodeAttrs
used to color the nodes in the graph.
nodeName
Denotes the column of nodeAttrs
used as labels for the nodes in the graph.
col
A vector of colors, for the nodes, indexed by
the unique elements of nodeCol column from
nodeAttrs. If missing, colors will be
automatically attributed.
shape
A vector of shapes indexed by the unique
elements of column nodeShape from
nodeAttrs. If missing, shapes will be
automatically attributed.
title
Title for the plot
reciproCol
Denotes the column of dataGraph
containing TRUE if the row defines a reciprocal
node, else FALSE. See
annotReciprocal.
tkplot
If TRUE, performs interactive plot with
function tkplot, else uses plot.igraph.
...
Additional parameters as required by
tkplot.
Details
You have to slighly move the nodes to see cliques because
strongly related nodes are often superimposed. The
edgeWeight column is used to weight the edges
within the fruchterman.reingold layout available in the
package igraph.
The argument nodeCol typically denotes the column
containing the names of the datasets. Colors are
automatically attributed to the nodes using palette Set3
of package RColorBrewer. The corresponding colors
can be directly specified in the 'col' argument. In that
case, 'col' must be a vector of colors indexed by the
unique elements contained in nodeCol column (e.g
dataset ids).
As for colors, one can define the column of
nodeAttrs that is used to define the node shapes.
The corresponding shapes can be directly specified in the
shape argument. In that case, shape must be
one of c("circle","square", " vcsquare",
"rectangle", "crectangle", "vrectangle") and must be
indexed by the unique elements of nodeShape
column.
Unfortunately, shapes can't be taken into account when
tkplot is TRUE (interactive plot).
If reciproCol is not missing, it is used to color
the edges, either in grey if the edge is not reciprocal
or in black if the edge is reciprocal.
dat1 <- data.frame(matrix(rnorm(10000),ncol=10,nrow=1000))
rownames(dat1) <- paste("g", 1:1000, sep="")
colnames(dat1) <- paste("s", 1:10, sep="")
dat2 <- data.frame(matrix(rnorm(10000),ncol=10,nrow=1000))
rownames(dat2) <- paste("g", 1:1000, sep="")
colnames(dat2) <- paste("s", 1:10, sep="")
## run ICA
resJade1 <- runICA(X=dat1, nbComp=3, method = "JADE")
resJade2 <- runICA(X=dat2, nbComp=3, method = "JADE")
## build params
params <- buildMineICAParams(resPath="toy/")
## build IcaSet object
icaSettoy1 <- buildIcaSet(params=params, A=data.frame(resJade1$A), S=data.frame(resJade1$S),
dat=dat1, alreadyAnnot=TRUE)$icaSet
icaSettoy2 <- buildIcaSet(params=params, A=data.frame(resJade2$A), S=data.frame(resJade2$S),
dat=dat2, alreadyAnnot=TRUE)$icaSet
icaSets <- list(icaSettoy1, icaSettoy2)
resCompareAn <- compareAn(icaSets=list(icaSettoy1,icaSettoy2), labAn=c("toy1","toy2"),
type.corr="pearson", level="genes", cutoff_zval=0)
## Build a graph where edges correspond to maximal correlation value (useVal="cor"),
dataGraph <- compareAn2graphfile(listPairCor=resCompareAn, useMax=TRUE, useVal="cor", file="myGraph.txt")
## construction of the data.frame with the node description
nbComp <- rep(3,2) #each IcaSet contains 3 components
nbAn <- 2 # we are comparing 2 IcaSets
# labels of components created as comp*i*
labComp <- foreach(icaSet=icaSets, nb=nbComp, an=1:nbAn) %do% {
paste(rep("comp",sum(nb)),1:nbComp(icaSet),sep = "")}
# creation of the data.frame with the node description
nodeDescr <- nodeAttrs(nbAn = nbAn, nbComp = nbComp, labComp = labComp,
labAn = c("toy1","toy2"), file = "nodeInfo.txt")
## Plot correlation graph, slightly move the attached nodes to make the cliques visible
## use tkplot=TRUE to have an interactive graph
res <- plotCorGraph(title = "Compare toy 1 and 2", dataGraph = dataGraph, nodeName = "indComp", tkplot = FALSE,
nodeAttrs = nodeDescr, edgeWeight = "cor", nodeShape = "labAn", reciproCol = "reciprocal")
## Not run:
## load two microarray datasets
library(breastCancerMAINZ)
library(breastCancerVDX)
data(mainz)
data(vdx)
## Define a function used to build two examples of IcaSet objects
treat <- function(es, annot="hgu133a.db") {
es <- selectFeatures_IQR(es,10000)
exprs(es) <- t(apply(exprs(es),1,scale,scale=FALSE))
colnames(exprs(es)) <- sampleNames(es)
resJade <- runICA(X=exprs(es), nbComp=10, method = "JADE", maxit=10000)
resBuild <- buildIcaSet(params=buildMineICAParams(), A=data.frame(resJade$A), S=data.frame(resJade$S),
dat=exprs(es), pData=pData(es), refSamples=character(0),
annotation=annot, typeID= typeIDmainz,
chipManu = "affymetrix", mart=mart)
icaSet <- resBuild$icaSet
}
## Build the two IcaSet objects
icaSetMainz <- treat(mainz)
icaSetVdx <- treat(vdx)
icaSets <- list(icaSetMainz, icaSetVdx)
labAn <- c("Mainz", "Vdx")
## correlations between gene projections of each pair of IcaSet
resCompareAn <- compareAn(icaSets = icaSets, level = "genes", type.corr= "pearson",
labAn = labAn, cutoff_zval=0)
## construction of the correlation graph using previous output
dataGraph <- compareAn2graphfile(listPairCor=resCompareAn, useMax=TRUE, file="corGraph.txt")
## construction of the data.frame with the node description
nbComp <- rep(10,2) #each IcaSet contains 10 components
nbAn <- 2 # we are comparing 2 IcaSets
# labels of components created as comp*i*
labComp <- foreach(icaSet=icaSets, nb=nbComp, an=1:nbAn) %do% {
paste(rep("comp",sum(nb)),1:nbComp(icaSet),sep = "")}
# creation of the data.frame with the node description
nodeDescr <- nodeAttrs(nbAn = nbAn, nbComp = nbComp, labComp = labComp,
labAn = labAn, file = "nodeInfo.txt")
## Plot correlation graph, slightly move the attached nodes to make the cliques visible
res <- plotCorGraph(title = "Compare two ICA decomsitions obtained on \n two
microarray-based data of breast tumors", dataGraph = dataGraph, nodeName = "indComp",
nodeAttrs = nodeDescr, edgeWeight = "cor", nodeShape = "labAn", reciproCol = "reciprocal")
## 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(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/plotCorGraph.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plotCorGraph
> ### Title: Plots graph using
> ### Aliases: plotCorGraph
>
> ### ** Examples
>
> dat1 <- data.frame(matrix(rnorm(10000),ncol=10,nrow=1000))
> rownames(dat1) <- paste("g", 1:1000, sep="")
> colnames(dat1) <- paste("s", 1:10, sep="")
> dat2 <- data.frame(matrix(rnorm(10000),ncol=10,nrow=1000))
> rownames(dat2) <- paste("g", 1:1000, sep="")
> colnames(dat2) <- paste("s", 1:10, sep="")
>
> ## run ICA
> resJade1 <- runICA(X=dat1, nbComp=3, method = "JADE")
> resJade2 <- runICA(X=dat2, nbComp=3, method = "JADE")
>
> ## build params
> params <- buildMineICAParams(resPath="toy/")
>
> ## build IcaSet object
> icaSettoy1 <- buildIcaSet(params=params, A=data.frame(resJade1$A), S=data.frame(resJade1$S),
+ dat=dat1, alreadyAnnot=TRUE)$icaSet
> icaSettoy2 <- buildIcaSet(params=params, A=data.frame(resJade2$A), S=data.frame(resJade2$S),
+ dat=dat2, alreadyAnnot=TRUE)$icaSet
> icaSets <- list(icaSettoy1, icaSettoy2)
>
> resCompareAn <- compareAn(icaSets=list(icaSettoy1,icaSettoy2), labAn=c("toy1","toy2"),
+ type.corr="pearson", level="genes", cutoff_zval=0)
>
> ## Build a graph where edges correspond to maximal correlation value (useVal="cor"),
> dataGraph <- compareAn2graphfile(listPairCor=resCompareAn, useMax=TRUE, useVal="cor", file="myGraph.txt")
>
> ## construction of the data.frame with the node description
> nbComp <- rep(3,2) #each IcaSet contains 3 components
> nbAn <- 2 # we are comparing 2 IcaSets
> # labels of components created as comp*i*
> labComp <- foreach(icaSet=icaSets, nb=nbComp, an=1:nbAn) %do% {
+ paste(rep("comp",sum(nb)),1:nbComp(icaSet),sep = "")}
>
> # creation of the data.frame with the node description
> nodeDescr <- nodeAttrs(nbAn = nbAn, nbComp = nbComp, labComp = labComp,
+ labAn = c("toy1","toy2"), file = "nodeInfo.txt")
>
> ## Plot correlation graph, slightly move the attached nodes to make the cliques visible
> ## use tkplot=TRUE to have an interactive graph
> res <- plotCorGraph(title = "Compare toy 1 and 2", dataGraph = dataGraph, nodeName = "indComp", tkplot = FALSE,
+ nodeAttrs = nodeDescr, edgeWeight = "cor", nodeShape = "labAn", reciproCol = "reciprocal")
Warning messages:
1: In brewer.pal(nbAn, "Set3") :
minimal value for n is 3, returning requested palette with 3 different levels
2: In layout_with_fr(list(6, TRUE, c(0, 1, 2, 3, 4, 5), c(5, 4, 4, :
Argument `area' is deprecated and has no effect
3: In layout_with_fr(list(6, TRUE, c(0, 1, 2, 3, 4, 5), c(5, 4, 4, :
Argument `repulserad' is deprecated and has no effect
>
>
> ## Not run:
> ##D ## load two microarray datasets
> ##D library(breastCancerMAINZ)
> ##D library(breastCancerVDX)
> ##D data(mainz)
> ##D data(vdx)
> ##D
> ##D ## Define a function used to build two examples of IcaSet objects
> ##D treat <- function(es, annot="hgu133a.db") {
> ##D es <- selectFeatures_IQR(es,10000)
> ##D exprs(es) <- t(apply(exprs(es),1,scale,scale=FALSE))
> ##D colnames(exprs(es)) <- sampleNames(es)
> ##D resJade <- runICA(X=exprs(es), nbComp=10, method = "JADE", maxit=10000)
> ##D resBuild <- buildIcaSet(params=buildMineICAParams(), A=data.frame(resJade$A), S=data.frame(resJade$S),
> ##D dat=exprs(es), pData=pData(es), refSamples=character(0),
> ##D annotation=annot, typeID= typeIDmainz,
> ##D chipManu = "affymetrix", mart=mart)
> ##D icaSet <- resBuild$icaSet
> ##D }
> ##D ## Build the two IcaSet objects
> ##D icaSetMainz <- treat(mainz)
> ##D icaSetVdx <- treat(vdx)
> ##D
> ##D icaSets <- list(icaSetMainz, icaSetVdx)
> ##D labAn <- c("Mainz", "Vdx")
> ##D
> ##D ## correlations between gene projections of each pair of IcaSet
> ##D resCompareAn <- compareAn(icaSets = icaSets, level = "genes", type.corr= "pearson",
> ##D labAn = labAn, cutoff_zval=0)
> ##D
> ##D ## construction of the correlation graph using previous output
> ##D dataGraph <- compareAn2graphfile(listPairCor=resCompareAn, useMax=TRUE, file="corGraph.txt")
> ##D
> ##D ## construction of the data.frame with the node description
> ##D nbComp <- rep(10,2) #each IcaSet contains 10 components
> ##D nbAn <- 2 # we are comparing 2 IcaSets
> ##D # labels of components created as comp*i*
> ##D labComp <- foreach(icaSet=icaSets, nb=nbComp, an=1:nbAn) %do% {
> ##D paste(rep("comp",sum(nb)),1:nbComp(icaSet),sep = "")}
> ##D
> ##D # creation of the data.frame with the node description
> ##D nodeDescr <- nodeAttrs(nbAn = nbAn, nbComp = nbComp, labComp = labComp,
> ##D labAn = labAn, file = "nodeInfo.txt")
> ##D
> ##D ## Plot correlation graph, slightly move the attached nodes to make the cliques visible
> ##D res <- plotCorGraph(title = "Compare two ICA decomsitions obtained on \n two
> ##D microarray-based data of breast tumors", dataGraph = dataGraph, nodeName = "indComp",
> ##D nodeAttrs = nodeDescr, edgeWeight = "cor", nodeShape = "labAn", reciproCol = "reciprocal")
> ##D
> ## End(Not run)
>
>
>
>
>
> dev.off()
null device
1
>