| Back to Multiple platform build/check report for BioC 3.6 |
|
This page was generated on 2018-04-12 13:33:52 -0400 (Thu, 12 Apr 2018).
| Package 940/1472 | Hostname | OS / Arch | INSTALL | BUILD | CHECK | BUILD BIN | ||||||
| netresponse 1.38.0 Leo Lahti
| malbec1 | Linux (Ubuntu 16.04.1 LTS) / x86_64 | NotNeeded | OK | WARNINGS | |||||||
| tokay1 | Windows Server 2012 R2 Standard / x64 | NotNeeded | OK | WARNINGS | OK | |||||||
| veracruz1 | OS X 10.11.6 El Capitan / x86_64 | NotNeeded | OK | [ WARNINGS ] | OK |
| Package: netresponse |
| Version: 1.38.0 |
| Command: /Library/Frameworks/R.framework/Versions/Current/Resources/bin/R CMD check --no-vignettes --timings netresponse_1.38.0.tar.gz |
| StartedAt: 2018-04-12 07:04:46 -0400 (Thu, 12 Apr 2018) |
| EndedAt: 2018-04-12 07:08:19 -0400 (Thu, 12 Apr 2018) |
| EllapsedTime: 213.5 seconds |
| RetCode: 0 |
| Status: WARNINGS |
| CheckDir: netresponse.Rcheck |
| Warnings: 1 |
##############################################################################
##############################################################################
###
### Running command:
###
### /Library/Frameworks/R.framework/Versions/Current/Resources/bin/R CMD check --no-vignettes --timings netresponse_1.38.0.tar.gz
###
##############################################################################
##############################################################################
* using log directory ‘/Users/biocbuild/bbs-3.6-bioc/meat/netresponse.Rcheck’
* using R version 3.4.4 (2018-03-15)
* using platform: x86_64-apple-darwin15.6.0 (64-bit)
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘netresponse/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘netresponse’ version ‘1.38.0’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘netresponse’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking contents of ‘data’ directory ... OK
* checking data for non-ASCII characters ... OK
* checking data for ASCII and uncompressed saves ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking compilation flags in Makevars ... OK
* checking for GNU extensions in Makefiles ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking compiled code ... NOTE
File ‘netresponse/libs/netresponse.so’:
Found ‘_rand’, possibly from ‘rand’ (C)
Object: ‘netresponse.o’
Found ‘_srand’, possibly from ‘srand’ (C)
Object: ‘netresponse.o’
Compiled code should not call entry points which might terminate R nor
write to stdout/stderr instead of to the console, nor use Fortran I/O
nor system RNGs.
See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual.
* checking files in ‘vignettes’ ... WARNING
Files in the 'vignettes' directory but no files in 'inst/doc':
‘NetResponse.Rmd’, ‘NetResponse.md’, ‘TODO/TODO.Rmd’,
‘fig/NetResponse2-1.png’, ‘fig/NetResponse2b-1.png’,
‘fig/NetResponse3-1.png’, ‘fig/NetResponse4-1.png’,
‘fig/NetResponse5-1.png’, ‘fig/NetResponse7-1.png’,
‘fig/vdp-1.png’, ‘main.R’, ‘netresponse.bib’, ‘netresponse.pdf’
Package has no Sweave vignette sources and no VignetteBuilder field.
* checking examples ... OK
Examples with CPU or elapsed time > 5s
user system elapsed
ICMg.combined.sampler 32.302 0.087 32.85
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
Running ‘ICMg.test.R’
Running ‘bicmixture.R’
Running ‘mixture.model.test.R’
Running ‘mixture.model.test.multimodal.R’
Running ‘mixture.model.test.singlemode.R’
Running ‘timing.R’
Running ‘toydata2.R’
Running ‘validate.netresponse.R’
Running ‘validate.pca.basis.R’
Running ‘vdpmixture.R’
OK
* checking PDF version of manual ... OK
* DONE
Status: 1 WARNING, 1 NOTE
See
‘/Users/biocbuild/bbs-3.6-bioc/meat/netresponse.Rcheck/00check.log’
for details.
netresponse.Rcheck/00install.out
* installing *source* package ‘netresponse’ ...
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c netresponse.c -o netresponse.o
netresponse.c:264:15: warning: unused variable 'prior_fields' [-Wunused-variable]
const char *prior_fields[]={"Mumu","S2mu",
^
netresponse.c:686:6: warning: variable 'Mumu' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if(dim1) {
^˜˜˜
netresponse.c:713:21: note: uninitialized use occurs here
vdp_mk_log_lambda(Mumu, S2mu, Mubar, Mutilde,
^˜˜˜
netresponse.c:686:3: note: remove the 'if' if its condition is always true
if(dim1) {
^˜˜˜˜˜˜˜˜
netresponse.c:655:15: note: initialize the variable 'Mumu' to silence this warning
double *Mumu, *S2mu, *Mubar, *Mutilde,
^
= NULL
netresponse.c:686:6: warning: variable 'S2mu' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if(dim1) {
^˜˜˜
netresponse.c:713:27: note: uninitialized use occurs here
vdp_mk_log_lambda(Mumu, S2mu, Mubar, Mutilde,
^˜˜˜
netresponse.c:686:3: note: remove the 'if' if its condition is always true
if(dim1) {
^˜˜˜˜˜˜˜˜
netresponse.c:655:22: note: initialize the variable 'S2mu' to silence this warning
double *Mumu, *S2mu, *Mubar, *Mutilde,
^
= NULL
netresponse.c:686:6: warning: variable 'Mubar' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if(dim1) {
^˜˜˜
netresponse.c:713:33: note: uninitialized use occurs here
vdp_mk_log_lambda(Mumu, S2mu, Mubar, Mutilde,
^˜˜˜˜
netresponse.c:686:3: note: remove the 'if' if its condition is always true
if(dim1) {
^˜˜˜˜˜˜˜˜
netresponse.c:655:30: note: initialize the variable 'Mubar' to silence this warning
double *Mumu, *S2mu, *Mubar, *Mutilde,
^
= NULL
netresponse.c:686:6: warning: variable 'Mutilde' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if(dim1) {
^˜˜˜
netresponse.c:713:40: note: uninitialized use occurs here
vdp_mk_log_lambda(Mumu, S2mu, Mubar, Mutilde,
^˜˜˜˜˜˜
netresponse.c:686:3: note: remove the 'if' if its condition is always true
if(dim1) {
^˜˜˜˜˜˜˜˜
netresponse.c:655:40: note: initialize the variable 'Mutilde' to silence this warning
double *Mumu, *S2mu, *Mubar, *Mutilde,
^
= NULL
netresponse.c:686:6: warning: variable 'AlphaKsi' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if(dim1) {
^˜˜˜
netresponse.c:714:7: note: uninitialized use occurs here
AlphaKsi, BetaKsi, KsiAlpha, KsiBeta,
^˜˜˜˜˜˜˜
netresponse.c:686:3: note: remove the 'if' if its condition is always true
if(dim1) {
^˜˜˜˜˜˜˜˜
netresponse.c:656:14: note: initialize the variable 'AlphaKsi' to silence this warning
*AlphaKsi, *BetaKsi, *KsiAlpha, *KsiBeta, *U_p, *prior_alpha,
^
= NULL
netresponse.c:686:6: warning: variable 'BetaKsi' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if(dim1) {
^˜˜˜
netresponse.c:714:17: note: uninitialized use occurs here
AlphaKsi, BetaKsi, KsiAlpha, KsiBeta,
^˜˜˜˜˜˜
netresponse.c:686:3: note: remove the 'if' if its condition is always true
if(dim1) {
^˜˜˜˜˜˜˜˜
netresponse.c:656:24: note: initialize the variable 'BetaKsi' to silence this warning
*AlphaKsi, *BetaKsi, *KsiAlpha, *KsiBeta, *U_p, *prior_alpha,
^
= NULL
netresponse.c:686:6: warning: variable 'KsiAlpha' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if(dim1) {
^˜˜˜
netresponse.c:714:26: note: uninitialized use occurs here
AlphaKsi, BetaKsi, KsiAlpha, KsiBeta,
^˜˜˜˜˜˜˜
netresponse.c:686:3: note: remove the 'if' if its condition is always true
if(dim1) {
^˜˜˜˜˜˜˜˜
netresponse.c:656:35: note: initialize the variable 'KsiAlpha' to silence this warning
*AlphaKsi, *BetaKsi, *KsiAlpha, *KsiBeta, *U_p, *prior_alpha,
^
= NULL
netresponse.c:686:6: warning: variable 'KsiBeta' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if(dim1) {
^˜˜˜
netresponse.c:714:36: note: uninitialized use occurs here
AlphaKsi, BetaKsi, KsiAlpha, KsiBeta,
^˜˜˜˜˜˜
netresponse.c:686:3: note: remove the 'if' if its condition is always true
if(dim1) {
^˜˜˜˜˜˜˜˜
netresponse.c:656:45: note: initialize the variable 'KsiBeta' to silence this warning
*AlphaKsi, *BetaKsi, *KsiAlpha, *KsiBeta, *U_p, *prior_alpha,
^
= NULL
netresponse.c:696:6: warning: variable 'U_p' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if(dim2) {
^˜˜˜
netresponse.c:716:7: note: uninitialized use occurs here
U_p, U_hat,
^˜˜
netresponse.c:696:3: note: remove the 'if' if its condition is always true
if(dim2) {
^˜˜˜˜˜˜˜˜
netresponse.c:656:51: note: initialize the variable 'U_p' to silence this warning
*AlphaKsi, *BetaKsi, *KsiAlpha, *KsiBeta, *U_p, *prior_alpha,
^
= NULL
netresponse.c:696:6: warning: variable 'U_hat' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if(dim2) {
^˜˜˜
netresponse.c:716:12: note: uninitialized use occurs here
U_p, U_hat,
^˜˜˜˜
netresponse.c:696:3: note: remove the 'if' if its condition is always true
if(dim2) {
^˜˜˜˜˜˜˜˜
netresponse.c:661:14: note: initialize the variable 'U_hat' to silence this warning
SEXP* U_hat;
^
= NULL
11 warnings generated.
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o netresponse.so netresponse.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Users/biocbuild/bbs-3.6-bioc/meat/netresponse.Rcheck/netresponse/libs
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (netresponse)
netresponse.Rcheck/tests/bicmixture.Rout
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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.
> # 1. vdp.mixt: moodien loytyminen eri dimensiolla, naytemaarilla ja komponenteilla
> # -> ainakin nopea check
>
> #######################################################################
>
> # Generate random data from five Gaussians.
> # Detect modes with vdp-gm.
> # Plot data points and detected clusters with variance ellipses
>
> #######################################################################
>
> library(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
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, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colMeans, colSums, 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, rowMeans, rowSums, rownames, sapply,
setdiff, sort, table, tapply, union, unique, unsplit, which,
which.max, which.min
Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2
netresponse (C) 2008-2016 Leo Lahti et al.
https://github.com/antagomir/netresponse
> #source("˜/Rpackages/netresponse/netresponse/R/detect.responses.R")
> #source("˜/Rpackages/netresponse/netresponse/R/internals.R")
> #source("˜/Rpackages/netresponse/netresponse/R/vdp.mixt.R")
> #dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so")
>
> ######### Generate DATA #############################################
>
> # Generate Nc components from normal-inverseGamma prior
>
> set.seed(12346)
>
> dd <- 3 # Dimensionality of data
> Nc <- 5 # Number of components
> Ns <- 200 # Number of data points
> sd0 <- 3 # component spread
> rgam.shape = 2 # parameters for Gamma distribution
> rgam.scale = 2 # parameters for Gamma distribution to define precisions
>
>
> # Generate means and variances (covariance diagonals) for the components
> component.means <- matrix(rnorm(Nc*dd, mean = 0, sd = sd0), nrow = Nc, ncol = dd)
> component.vars <- matrix(1/rgamma(Nc*dd, shape = rgam.shape, scale = rgam.scale),
+ nrow = Nc, ncol = dd)
> component.sds <- sqrt(component.vars)
>
>
> # Size for each component -> sample randomly for each data point from uniform distr.
> # i.e. cluster assignments
> sample2comp <- sample.int(Nc, Ns, replace = TRUE)
>
> D <- array(NA, dim = c(Ns, dd))
> for (i in 1:Ns) {
+ # component identity of this sample
+ ci <- sample2comp[[i]]
+ cm <- component.means[ci,]
+ csd <- component.sds[ci,]
+ D[i,] <- rnorm(dd, mean = cm, sd = csd)
+ }
>
>
> ######################################################################
>
> # Fit mixture model
> out <- mixture.model(D, mixture.method = "bic")
>
> # FIXME rowmeans(qofz) is constant but not 1
> #qofz <- P.r.s(t(D), list(mu = out$mu, sd = out$sd, w = out$w), log = FALSE)
>
> ############################################################
>
> # Compare input data and results
>
> ord.out <- order(out$mu[,1])
> ord.in <- order(component.means[,1])
>
> means.out <- out$mu[ord.out,]
> means.in <- component.means[ord.in,]
>
> # Cluster stds and variances
> sds.out <- out$sd[ord.out,]
> sds.in <- sqrt(component.vars[ord.in,])
>
> # -----------------------------------------------------------
>
> vars.out <- sds.out^2
> vars.in <- sds.in^2
>
> # Check correspondence between input and output
> if (length(means.in) == length(means.out)) {
+ cm <- cor(as.vector(means.in), as.vector(means.out))
+ csd <- cor(as.vector(sds.in), as.vector(sds.out))
+ }
>
> # Plot results (assuming 2D)
>
> ran <- range(c(as.vector(means.in - 2*vars.in),
+ as.vector(means.in + 2*vars.in),
+ as.vector(means.out + 2*vars.out),
+ as.vector(means.out - 2*vars.out)))
>
> plot(D, pch = 20, main = paste("Cor.means:", round(cm,3), "/ Cor.sds:", round(csd,3)), xlim = ran, ylim = ran)
> for (ci in 1:nrow(means.out)) { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") }
> for (ci in 1:nrow(means.in)) { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") }
>
> ######################################################
>
> #for (ci in 1:nrow(means.out)) {
> # points(means.out[ci,1], means.out[ci,2], col = "red", pch = 19)
> # el <- ellipse(matrix(c(vars.out[ci,1],0,0,vars.out[ci,2]),2), centre = means.out[ci,])
> # lines(el, col = "red")
> #}
>
> #for (ci in 1:nrow(means.in)) {
> # points(means.in[ci,1], means.in[ci,2], col = "blue", pch = 19)
> # el <- ellipse(matrix(c(vars.in[ci,1],0,0,vars.in[ci,2]),2), centre = means.in[ci,])
> # lines(el, col = "blue")
> #}
>
>
>
>
>
>
> proc.time()
user system elapsed
3.090 0.141 3.287
netresponse.Rcheck/tests/ICMg.test.Rout
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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.
> # Test script for the ICMg method
>
> # Load the package
> library(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
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, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colMeans, colSums, 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, rowMeans, rowSums, rownames, sapply,
setdiff, sort, table, tapply, union, unique, unsplit, which,
which.max, which.min
Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2
netresponse (C) 2008-2016 Leo Lahti et al.
https://github.com/antagomir/netresponse
>
> data(osmo) # Load data
>
> # Set parameters
> C.boost = 1
> alpha = 10
> beta = 0.01
> B.num = 10
> B.size = 10
> S.num = 10
> S.size = 10
> C = 24
> pm0 = 0
> V0 = 1
> V = 0.1
>
> # Run combined ICMg sampler
> res = ICMg.combined.sampler(osmo$ppi, osmo$exp, C, alpha, beta, pm0, V0, V, B.num, B.size, S.num, S.size, C.boost)
Sampling ICMg2...
nodes:10250links:1711observations:133components:24alpha:10beta:0.01
Sampling200iterationcs
Burnin iterations:100
I: 0
n(z):429421408450441440443417381479412422384435442414420430395434435421451446
m(z):846281737578665167759775748655775564598066617971
I:10
convL:-0.493037427232219n(z):2423632743605963312071800334536370283354257326337658563395270328470263333
convN:-0.00729220478214441m(z):7653595955624916675863255625053951201207247491126737
I:20
convL:-0.402246708269118n(z):2703053053965812471341897406611314253325240286331927591378254266410253270
convN:-0.00392819869596756m(z):7748595656645317072873156614855941231217247471126834
I:30
convL:-0.38785261181801n(z):27328124042358824514918534676383602422971763083301194511331230268408218220
convN:-0.00480017618366343m(z):8643607655645417071873054604653103131114724747876734
I:40
convL:-0.353299131567058n(z):22120532650355923015918914586863132443201203252631298489321225248448197201
convN:-0.00385771448290561m(z):8643647855645417172853054604755101127113714747856834
I:50
convL:-0.350184373579483n(z):25916732047153322116618714647182802353201423282701391437310273218444205207
convN:-0.00203491125197495m(z):8642677858655416971843154614855101128113704747856631
I:60
convL:-0.34125177108841n(z):24216833846051622516018814957703062332981773022761408423286243199434188222
convN:-0.00418992749816609m(z):8643667758655417070853154614754102127114714746856731
I:70
convL:-0.338679007332931n(z):27816134542053820417217694537593502223082043042261515416278278219438171222
convN:-0.0016206005996124m(z):8643667758655417071853154614754101128114704747856631
I:80
convL:-0.352329042531199n(z):25516332244955219919217054957613302123081823072441594400290250212425190213
convN:-0.001349755997395m(z):8442667758655417071853154614854103128114704747856631
I:90
convL:-0.329287662349805n(z):29218633643057320014916454817703591963071803262401598424288229187428197229
convN:-0.00454767448311714m(z):8143697758655417070853154614755103128114714647856631
I:100
convL:-0.329122041970463n(z):27518828943952619319716225147913421813371763552651644387259205214451173227
convN:-0.00434491461401917m(z):7743697658655417671853154614754106127111694747866631
Sample iterations:100
I:110
convL:-0.338116538062044n(z):26718630840854420116816724618453712163321704022241571394292178199423190228
convN:-0.0026772048389774m(z):7743687658655417471863154604754107128111704747866631
I:120
convL:-0.329386676504776n(z):25918431243654121216416654848853281903151733712101607386323186170428189232
convN:-0.00227844134985196m(z):7643717759655617372843154614454106128111674748856534
I:130
convL:-0.315386512349719n(z):23817632741156622214216944948933661863301663572161648382281167164410192222
convN:-0.00347488577716883m(z):7444717958665617472843154614355106128112674648836534
I:140
convL:-0.33426789858522n(z):24317832942052819917516924509123891903341743692411619359281169154432195218
convN:-0.00257385607893699m(z):7444717857665617472853154614354106127112674748846634
I:150
convL:-0.332971927646174n(z):23518630143151722618916454519423772023191443642161653337293161175438220228
convN:-0.00305721824136302m(z):7444707957665617373853154614354107128112664748836634
I:160
convL:-0.332379457961622n(z):25519026444153219618115944239793762083271783412381662343265173183425225251
convN:-0.00202479717094975m(z):7443707958655817373843154614254107129112664748836634
I:170
convL:-0.329208271254105n(z):25918031542755422519216423969403482233111543692311654343250177162419228251
convN:-0.00428461481758663m(z):7543717958655817375843154614254106129111644748836634
I:180
convL:-0.316410946061578n(z):256186278436522208199161037610153812173361383642201677387259168164408226219
convN:-0.000530572599606921m(z):7443717958655817372853154614254106128112674748836634
I:190
convL:-0.316759430416872n(z):243186276457537189180164138910533752293101483752121690341237178138418220228
convN:-0.00757635025963601m(z):7443717958655717374853154614254106128112654748836635
I:200
convL:-0.319611487124901n(z):262203304427532203192164136310303631993211303932071684377247177130420205240
convN:-0.00438845958319151m(z):7443697759655817472853154614254107128113674748846534
DONE
>
> # Compute component membership probabilities for the data points
> res$comp.memb <- ICMg.get.comp.memberships(osmo$ppi, res)
>
> # Compute (hard) clustering for nodes
> res$clustering <- apply(res$comp.memb, 2, which.max)
>
> proc.time()
user system elapsed
9.646 0.185 9.936
netresponse.Rcheck/tests/mixture.model.test.multimodal.Rout
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
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, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colMeans, colSums, 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, rowMeans, rowSums, rownames, sapply,
setdiff, sort, table, tapply, union, unique, unsplit, which,
which.max, which.min
Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2
netresponse (C) 2008-2016 Leo Lahti et al.
https://github.com/antagomir/netresponse
>
> # Three MODES
>
> # set.seed(34884)
> set.seed(3488400)
>
> Ns <- 200
> Nd <- 2
>
> D3 <- rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd),
+ matrix(rnorm(Ns*Nd, mean = 3), ncol = Nd),
+ cbind(rnorm(Ns, mean = -3), rnorm(Ns, mean = 3))
+ )
>
> #X11()
> par(mfrow = c(2,2))
> for (mm in c("vdp", "bic")) {
+ for (pp in c(FALSE, TRUE)) {
+
+ # Fit nonparametric Gaussian mixture model
+ out <- mixture.model(D3, mixture.method = mm, pca.basis = pp)
+ plot(D3, col = apply(out$qofz, 1, which.max), main = paste(mm, "/ pca:", pp))
+
+ }
+ }
>
> # VDP is less sensitive than BIC in detecting Gaussian modes (more
> # separation between the clusters needed)
>
> # pca.basis option is less important for sensitive detection but
> # it will help to avoid overfitting to unimodal features that
> # are not parallel to the axes (unimodal distribution often becomes
> # splitted in two or more clusters in these cases)
>
>
> proc.time()
user system elapsed
4.625 0.152 4.812
netresponse.Rcheck/tests/mixture.model.test.Rout
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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.
> # Validate mixture models
>
> # Generate random data from five Gaussians.
> # Detect modes
> # Plot data points and detected clusters
>
> library(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
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, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colMeans, colSums, 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, rowMeans, rowSums, rownames, sapply,
setdiff, sort, table, tapply, union, unique, unsplit, which,
which.max, which.min
Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2
netresponse (C) 2008-2016 Leo Lahti et al.
https://github.com/antagomir/netresponse
>
> #fs <- list.files("˜/Rpackages/netresponse/netresponse/R/", full.names = TRUE); for (f in fs) {source(f)}; dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so")
>
> ######### Generate DATA #######################
>
> res <- generate.toydata()
> D <- res$data
> component.means <- res$means
> component.sds <- res$sds
> sample2comp <- res$sample2comp
>
> ######################################################################
>
> par(mfrow = c(2,1))
>
> for (mm in c("vdp", "bic")) {
+
+ # Fit nonparametric Gaussian mixture model
+ #source("˜/Rpackages/netresponse/netresponse/R/vdp.mixt.R")
+ out <- mixture.model(D, mixture.method = mm, max.responses = 10, pca.basis = FALSE)
+
+ ############################################################
+
+ # Compare input data and results
+
+ ord.out <- order(out$mu[,1])
+ ord.in <- order(component.means[,1])
+
+ means.out <- out$mu[ord.out,]
+ means.in <- component.means[ord.in,]
+
+ # Cluster stds and variances
+ sds.out <- out$sd[ord.out,]
+ vars.out <- sds.out^2
+
+ sds.in <- component.sds[ord.in,]
+ vars.in <- sds.in^2
+
+ # Check correspondence between input and output
+ if (length(means.in) == length(means.out)) {
+ cm <- cor(as.vector(means.in), as.vector(means.out))
+ csd <- cor(as.vector(sds.in), as.vector(sds.out))
+ }
+
+ # Plot results (assuming 2D)
+ ran <- range(c(as.vector(means.in - 2*vars.in),
+ as.vector(means.in + 2*vars.in),
+ as.vector(means.out + 2*vars.out),
+ as.vector(means.out - 2*vars.out)))
+
+ real.modes <- sample2comp
+ obs.modes <- apply(out$qofz, 1, which.max)
+
+ # plot(D, pch = 20, main = paste(mm, "/ cor.means:", round(cm,6), "/ Cor.sds:", round(csd,6)), xlim = ran, ylim = ran)
+ plot(D, pch = real.modes, col = obs.modes, main = paste(mm, "/ cor.means:", round(cm,6), "/ Cor.sds:", round(csd,6)), xlim = ran, ylim = ran)
+ for (ci in 1:nrow(means.out)) { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") }
+ for (ci in 1:nrow(means.in)) { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") }
+
+ }
>
>
> proc.time()
user system elapsed
3.189 0.141 3.369
netresponse.Rcheck/tests/mixture.model.test.singlemode.Rout
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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.
>
> skip <- FALSE
>
> if (!skip) {
+
+ library(netresponse)
+
+ # SINGLE MODE
+
+ # Produce test data that has full covariance
+ # It is expected that
+ # pca.basis = FALSE splits Gaussian with full covariance into two modes
+ # pca.basis = TRUE should detect just a single mode
+
+ Ns <- 200
+ Nd <- 2
+ k <- 1.5
+
+ D2 <- matrix(rnorm(Ns*Nd), ncol = Nd) %*% rbind(c(1,k), c(k,1))
+
+ par(mfrow = c(2,2))
+ for (mm in c("vdp", "bic")) {
+ for (pp in c(FALSE, TRUE)) {
+
+ # Fit nonparametric Gaussian mixture model
+ out <- mixture.model(D2, mixture.method = mm, pca.basis = pp)
+ plot(D2, col = apply(out$qofz, 1, which.max), main = paste("mm:" , mm, "/ pp:", pp))
+
+ }
+ }
+
+ }
Loading required package: Rgraphviz
Loading required package: graph
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, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colMeans, colSums, 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, rowMeans, rowSums, rownames, sapply,
setdiff, sort, table, tapply, union, unique, unsplit, which,
which.max, which.min
Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2
netresponse (C) 2008-2016 Leo Lahti et al.
https://github.com/antagomir/netresponse
>
> proc.time()
user system elapsed
3.487 0.147 3.692
netresponse.Rcheck/tests/timing.Rout
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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.
>
> # Play with different options and check their effect on running times for bic and vdp
>
> skip <- TRUE
>
> if (!skip) {
+
+ Ns <- 100
+ Nd <- 2
+
+ set.seed(3488400)
+
+ D <- cbind(
+
+ rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd),
+ matrix(rnorm(Ns*Nd, mean = 2), ncol = Nd),
+ cbind(rnorm(Ns, mean = -1), rnorm(Ns, mean = 3))
+ ),
+
+ rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd),
+ matrix(rnorm(Ns*Nd, mean = 2), ncol = Nd),
+ cbind(rnorm(Ns, mean = -1), rnorm(Ns, mean = 3))
+ )
+ )
+
+ rownames(D) <- paste("R", 1:nrow(D), sep = "-")
+ colnames(D) <- paste("C", 1:ncol(D), sep = "-")
+
+ ts <- c()
+ for (mm in c("bic", "vdp")) {
+
+
+ # NOTE: no PCA basis needed with mixture.method = "bic"
+ tt <- system.time(detect.responses(D, verbose = TRUE, max.responses = 5,
+ mixture.method = mm, information.criterion = "BIC",
+ merging.threshold = 0, bic.threshold = 0, pca.basis = TRUE))
+
+ print(paste(mm, ":", round(tt[["elapsed"]], 3)))
+ ts[[mm]] <- tt[["elapsed"]]
+ }
+
+ print(paste(names(ts)[[1]], "/", names(ts)[[2]], ": ", round(ts[[1]]/ts[[2]], 3)))
+
+ }
>
> # -> VDP is much faster when sample sizes increase
> # 1000 samples -> 25-fold speedup with VDP
>
>
>
> proc.time()
user system elapsed
0.216 0.037 0.240
netresponse.Rcheck/tests/toydata2.Rout
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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.
> # Generate Nc components from normal-inverseGamma prior
>
> set.seed(12346)
>
> Ns <- 300
> Nd <- 2
>
> # Isotropic cloud
> D1 <- matrix(rnorm(Ns*Nd), ncol = Nd)
>
> # Single diagonal mode
> D2 <- matrix(rnorm(Ns*Nd), ncol = Nd) %*% rbind(c(1,2), c(2,1))
>
> # Two isotropic modes
> D3 <- rbind(matrix(rnorm(Ns/2*Nd), ncol = Nd), matrix(rnorm(Ns/2*Nd, mean = 3), ncol = Nd))
> D <- cbind(D1, D2, D3)
>
> colnames(D) <- paste("Feature-", 1:ncol(D), sep = "")
> rownames(D) <- paste("Sample-", 1:nrow(D), sep = "")
>
>
> proc.time()
user system elapsed
0.198 0.034 0.219
netresponse.Rcheck/tests/validate.netresponse.Rout
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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.
>
> skip <- FALSE
>
> if (!skip) {
+
+ # 2. netresponse test
+ # test later with varying parameters
+
+ # Load the package
+ library(netresponse)
+ #load("../data/toydata.rda")
+ fs <- list.files("../R/", full.names = TRUE); for (f in fs) {source(f)};
+
+ data(toydata)
+
+ D <- toydata$emat
+ netw <- toydata$netw
+
+ # The toy data is random data with 10 features (genes).
+ # The features
+ rf <- c(4, 5, 6)
+ #form a subnetwork with coherent responses
+ # with means
+ r1 <- c(0, 3, 0)
+ r2 <- c(-5, 0, 2)
+ r3 <- c(5, -3, -3)
+ mu.real <- rbind(r1, r2, r3)
+ # real weights
+ w.real <- c(70, 70, 60)/200
+ # and unit variances
+ rv <- 1
+
+ # Fit the model
+ #res <- detect.responses(D, netw, verbose = TRUE, mc.cores = 2)
+ #res <- detect.responses(D, netw, verbose = TRUE, max.responses = 4)
+
+ res <- detect.responses(D, netw, verbose = TRUE, max.responses = 3, mixture.method = "bic", information.criterion = "BIC", merging.threshold = 1, bic.threshold = 10, pca.basis = FALSE)
+
+ print("OK")
+
+ # Subnets (each is a list of nodes)
+ subnets <- get.subnets(res)
+
+ # the correct subnet is retrieved in subnet number 2:
+ #> subnet[[2]]
+ #[1] "feat4" "feat5" "feat6"
+
+ # how about responses
+ # Retrieve model for the subnetwork with lowest cost function value
+ # means, standard devations and weights for the components
+ if (!is.null(subnets)) {
+ m <- get.model.parameters(res, subnet.id = "Subnet-2")
+
+ # order retrieved and real response means by the first feature
+ # (to ensure responses are listed in the same order)
+ # and compare deviation from correct solution
+ ord.obs <- order(m$mu[,1])
+ ord.real <- order(mu.real[,1])
+
+ print(paste("Correlation between real and observed responses:", cor(as.vector(m$mu[ord.obs,]), as.vector(mu.real[ord.real,]))))
+
+ # all real variances are 1, compare to observed ones
+ print(paste("Maximum deviation from real variances: ", max(abs(rv - range(m$sd))/rv)))
+
+ # weights deviate somewhat, this is likely due to relatively small sample size
+ #print("Maximum deviation from real weights: ")
+ #print( (w.real[ord.real] - m$w[ord.obs])/w.real[ord.real])
+
+ print("estimated and real mean matrices")
+ print(m$mu[ord.obs,])
+ print(mu.real[ord.real,])
+
+ }
+
+ }
Loading required package: Rgraphviz
Loading required package: graph
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, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colMeans, colSums, 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, rowMeans, rowSums, rownames, sapply,
setdiff, sort, table, tapply, union, unique, unsplit, which,
which.max, which.min
Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2
netresponse (C) 2008-2016 Leo Lahti et al.
https://github.com/antagomir/netresponse
convert the network into edge matrix
removing self-links
matching the features between network and datamatrix
Filter the network to only keep the edges with highest mutual information
1 / 8
2 / 8
3 / 8
4 / 8
5 / 8
6 / 8
7 / 8
8 / 8
Compute cost for each variable
Computing model for node 1 / 10
Computing model for node 2 / 10
Computing model for node 3 / 10
Computing model for node 4 / 10
Computing model for node 5 / 10
Computing model for node 6 / 10
Computing model for node 7 / 10
Computing model for node 8 / 10
Computing model for node 9 / 10
Computing model for node 10 / 10
independent models done
Computing delta values for edge 1 / 29
Computing delta values for edge 2 / 29
Computing delta values for edge 3 / 29
Computing delta values for edge 4 / 29
Computing delta values for edge 5 / 29
Computing delta values for edge 6 / 29
Computing delta values for edge 7 / 29
Computing delta values for edge 8 / 29
Computing delta values for edge 9 / 29
Computing delta values for edge 10 / 29
Computing delta values for edge 11 / 29
Computing delta values for edge 12 / 29
Computing delta values for edge 13 / 29
Computing delta values for edge 14 / 29
Computing delta values for edge 15 / 29
Computing delta values for edge 16 / 29
Computing delta values for edge 17 / 29
Computing delta values for edge 18 / 29
Computing delta values for edge 19 / 29
Computing delta values for edge 20 / 29
Computing delta values for edge 21 / 29
Computing delta values for edge 22 / 29
Computing delta values for edge 23 / 29
Computing delta values for edge 24 / 29
Computing delta values for edge 25 / 29
Computing delta values for edge 26 / 29
Computing delta values for edge 27 / 29
Computing delta values for edge 28 / 29
Computing delta values for edge 29 / 29
Combining groups, 10 group(s) left...
Combining groups, 9 group(s) left...
Combining groups, 8 group(s) left...
Combining groups, 7 group(s) left...
Combining groups, 6 group(s) left...
Combining groups, 5 group(s) left...
Combining groups, 4 group(s) left...
[1] "OK"
[1] "Correlation between real and observed responses: 0.999117848017521"
[1] "Maximum deviation from real variances: 0.0391530538149302"
[1] "estimated and real mean matrices"
[,1] [,2] [,3]
[1,] -4.9334982 -0.1575946 2.1613225
[2,] -0.1299285 3.0047767 -0.1841669
[3,] 5.0738471 -2.9334877 -3.2217492
[,1] [,2] [,3]
r2 -5 0 2
r1 0 3 0
r3 5 -3 -3
>
> proc.time()
user system elapsed
34.862 0.233 35.653
netresponse.Rcheck/tests/validate.pca.basis.Rout
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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.
>
> skip <- FALSE
>
> if (!skip) {
+ # Visualization
+
+ library(netresponse)
+
+ #fs <- list.files("˜/Rpackages/netresponse/netresponse/R/", full.names = T); for (f in fs) {source(f)}
+
+ source("toydata2.R")
+
+ # --------------------------------------------------------------------
+
+ set.seed(4243)
+ mixture.method <- "bic"
+
+ # --------------------------------------------------------------------
+
+ res <- detect.responses(D, verbose = TRUE, max.responses = 10,
+ mixture.method = mixture.method, information.criterion = "BIC",
+ merging.threshold = 1, bic.threshold = 10, pca.basis = FALSE)
+
+ res.pca <- detect.responses(D, verbose = TRUE, max.responses = 10, mixture.method = mixture.method, information.criterion = "BIC", merging.threshold = 1, bic.threshold = 10, pca.basis = TRUE)
+
+ # --------------------------------------------------------------------
+
+ k <- 1
+
+ # Incorrect VDP: two modes detected
+ # Correct BIC: single mode detected
+ subnet.id <- names(get.subnets(res))[[k]]
+
+ # Correct: single mode detected (VDP & BIC)
+ subnet.id.pca <- names(get.subnets(res.pca))[[k]]
+
+ # --------------------------------------------------------------------------------------------------
+
+ vis1 <- plot_responses(res, subnet.id, plot_mode = "pca", main = paste("NoPCA; NoDM"))
+ vis2 <- plot_responses(res, subnet.id, plot_mode = "pca", datamatrix = D, main = "NoPCA, DM")
+ vis3 <- plot_responses(res.pca, subnet.id.pca, plot_mode = "pca", main = "PCA, NoDM")
+ vis4 <- plot_responses(res.pca, subnet.id.pca, plot_mode = "pca", datamatrix = D, main = "PCA, DM")
+
+ # With original data: VDP overlearns; BIC works; with full covariance data
+ # With PCA basis: modes detected ok with both VDP and BIC.
+
+ # ------------------------------------------------------------------------
+
+ # TODO
+ # pca.plot(res, subnet.id)
+ # plot_subnet(res, subnet.id)
+ }
Loading required package: Rgraphviz
Loading required package: graph
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, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colMeans, colSums, 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, rowMeans, rowSums, rownames, sapply,
setdiff, sort, table, tapply, union, unique, unsplit, which,
which.max, which.min
Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2
netresponse (C) 2008-2016 Leo Lahti et al.
https://github.com/antagomir/netresponse
convert the network into edge matrix
removing self-links
matching the features between network and datamatrix
Filter the network to only keep the edges with highest mutual information
1 / 5
2 / 5
3 / 5
4 / 5
5 / 5
Compute cost for each variable
Computing model for node 1 / 6
Computing model for node 2 / 6
Computing model for node 3 / 6
Computing model for node 4 / 6
Computing model for node 5 / 6
Computing model for node 6 / 6
independent models done
Computing delta values for edge 1 / 15
Computing delta values for edge 2 / 15
Computing delta values for edge 3 / 15
Computing delta values for edge 4 / 15
Computing delta values for edge 5 / 15
Computing delta values for edge 6 / 15
Computing delta values for edge 7 / 15
Computing delta values for edge 8 / 15
Computing delta values for edge 9 / 15
Computing delta values for edge 10 / 15
Computing delta values for edge 11 / 15
Computing delta values for edge 12 / 15
Computing delta values for edge 13 / 15
Computing delta values for edge 14 / 15
Computing delta values for edge 15 / 15
Combining groups, 6 group(s) left...
Combining groups, 5 group(s) left...
Combining groups, 4 group(s) left...
Combining groups, 3 group(s) left...
convert the network into edge matrix
removing self-links
matching the features between network and datamatrix
Filter the network to only keep the edges with highest mutual information
1 / 5
2 / 5
3 / 5
4 / 5
5 / 5
Compute cost for each variable
Computing model for node 1 / 6
Computing model for node 2 / 6
Computing model for node 3 / 6
Computing model for node 4 / 6
Computing model for node 5 / 6
Computing model for node 6 / 6
independent models done
Computing delta values for edge 1 / 15
Computing delta values for edge 2 / 15
Computing delta values for edge 3 / 15
Computing delta values for edge 4 / 15
Computing delta values for edge 5 / 15
Computing delta values for edge 6 / 15
Computing delta values for edge 7 / 15
Computing delta values for edge 8 / 15
Computing delta values for edge 9 / 15
Computing delta values for edge 10 / 15
Computing delta values for edge 11 / 15
Computing delta values for edge 12 / 15
Computing delta values for edge 13 / 15
Computing delta values for edge 14 / 15
Computing delta values for edge 15 / 15
Combining groups, 6 group(s) left...
Combining groups, 5 group(s) left...
Combining groups, 4 group(s) left...
Combining groups, 3 group(s) left...
Warning messages:
1: In check.network(network, datamatrix, verbose = verbose) :
No network provided in function call: assuming fully connected nodes.
2: In check.network(network, datamatrix, verbose = verbose) :
No network provided in function call: assuming fully connected nodes.
>
> proc.time()
user system elapsed
23.802 0.212 24.360
netresponse.Rcheck/tests/vdpmixture.Rout
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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.
>
> # 1. vdp.mixt: moodien loytyminen eri dimensiolla, naytemaarilla ja komponenteilla
> # -> ainakin nopea check
>
> #######################################################################
>
> # Generate random data from five Gaussians.
> # Detect modes with vdp-gm.
> # Plot data points and detected clusters with variance ellipses
>
> #######################################################################
>
> library(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
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, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colMeans, colSums, 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, rowMeans, rowSums, rownames, sapply,
setdiff, sort, table, tapply, union, unique, unsplit, which,
which.max, which.min
Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2
netresponse (C) 2008-2016 Leo Lahti et al.
https://github.com/antagomir/netresponse
> #source("˜/Rpackages/netresponse/netresponse/R/detect.responses.R")
> #source("˜/Rpackages/netresponse/netresponse/R/internals.R")
> #source("˜/Rpackages/netresponse/netresponse/R/vdp.mixt.R")
> #dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so")
>
>
> ######### Generate DATA #############################################
>
> res <- generate.toydata()
> D <- res$data
> component.means <- res$means
> component.sds <- res$sds
> sample2comp <- res$sample2comp
>
> ######################################################################
>
> # Fit nonparametric Gaussian mixture model
> out <- vdp.mixt(D)
> # out <- vdp.mixt(D, c.max = 3) # try with limited number of components -> OK
>
> ############################################################
>
> # Compare input data and results
>
> ord.out <- order(out$posterior$centroids[,1])
> ord.in <- order(component.means[,1])
>
> means.out <- out$posterior$centroids[ord.out,]
> means.in <- component.means[ord.in,]
>
> # Cluster stds and variances
> sds.out <- out$posterior$sds[ord.out,]
> sds.in <- component.sds[ord.in,]
> vars.out <- sds.out^2
> vars.in <- sds.in^2
>
> # Check correspondence between input and output
> if (length(means.in) == length(means.out)) {
+ cm <- cor(as.vector(means.in), as.vector(means.out))
+ csd <- cor(as.vector(sds.in), as.vector(sds.out))
+ }
>
> # Plot results (assuming 2D)
>
> ran <- range(c(as.vector(means.in - 2*vars.in),
+ as.vector(means.in + 2*vars.in),
+ as.vector(means.out + 2*vars.out),
+ as.vector(means.out - 2*vars.out)))
>
> plot(D, pch = 20, main = paste("Cor.means:", round(cm,3), "/ Cor.sds:", round(csd,3)), xlim = ran, ylim = ran)
> for (ci in 1:nrow(means.out)) { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") }
> for (ci in 1:nrow(means.in)) { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") }
>
>
>
> proc.time()
user system elapsed
2.590 0.128 2.755
netresponse.Rcheck/netresponse-Ex.timings
| name | user | system | elapsed | |
| ICMg.combined.sampler | 32.302 | 0.087 | 32.850 | |
| ICMg.links.sampler | 1.646 | 0.022 | 1.689 | |
| NetResponseModel-class | 0.001 | 0.001 | 0.001 | |
| PlotMixture | 0.001 | 0.000 | 0.000 | |
| PlotMixtureBivariate | 0.001 | 0.000 | 0.001 | |
| PlotMixtureMultivariate | 0.000 | 0.000 | 0.001 | |
| PlotMixtureMultivariate.deprecated | 0.001 | 0.001 | 0.001 | |
| PlotMixtureUnivariate | 0 | 0 | 0 | |
| add.ellipse | 0.000 | 0.000 | 0.001 | |
| centerData | 0.000 | 0.000 | 0.001 | |
| check.matrix | 0.001 | 0.001 | 0.001 | |
| check.network | 0 | 0 | 0 | |
| detect.responses | 0.003 | 0.001 | 0.004 | |
| dna | 0.023 | 0.003 | 0.025 | |
| enrichment.list.factor | 0 | 0 | 0 | |
| enrichment.list.factor.minimal | 0.001 | 0.000 | 0.000 | |
| filter.netw | 0.001 | 0.000 | 0.001 | |
| filter.network | 0 | 0 | 0 | |
| find.similar.features | 0.554 | 0.008 | 0.566 | |
| generate.toydata | 0.001 | 0.000 | 0.001 | |
| get.dat-NetResponseModel-method | 0 | 0 | 0 | |
| get.mis | 0 | 0 | 0 | |
| get.model.parameters | 0.005 | 0.002 | 0.007 | |
| get.subnets-NetResponseModel-method | 0.000 | 0.001 | 0.001 | |
| getqofz-NetResponseModel-method | 0 | 0 | 0 | |
| independent.models | 0 | 0 | 0 | |
| list.significant.responses | 0.001 | 0.000 | 0.000 | |
| listify.groupings | 0.000 | 0.000 | 0.001 | |
| model.stats | 0.003 | 0.001 | 0.004 | |
| netresponse-package | 3.391 | 0.034 | 3.480 | |
| order.responses | 0.001 | 0.000 | 0.001 | |
| osmo | 0.045 | 0.004 | 0.054 | |
| pick.model.pairs | 0 | 0 | 0 | |
| pick.model.parameters | 0 | 0 | 0 | |
| plotPCA | 0.001 | 0.000 | 0.001 | |
| plot_associations | 0.001 | 0.000 | 0.001 | |
| plot_data | 0.001 | 0.000 | 0.000 | |
| plot_expression | 0 | 0 | 0 | |
| plot_matrix | 0.007 | 0.001 | 0.008 | |
| plot_response | 0.001 | 0.000 | 0.001 | |
| plot_responses | 0.001 | 0.001 | 0.001 | |
| plot_scale | 0.001 | 0.000 | 0.000 | |
| plot_subnet | 0 | 0 | 0 | |
| read.sif | 0.000 | 0.000 | 0.001 | |
| remove.negative.edges | 0.001 | 0.000 | 0.001 | |
| response.enrichment | 0 | 0 | 0 | |
| response2sample | 0.007 | 0.002 | 0.009 | |
| sample2response | 0.001 | 0.001 | 0.001 | |
| set.breaks | 0.001 | 0.000 | 0.002 | |
| toydata | 0.003 | 0.002 | 0.005 | |
| update.model.pair | 0.000 | 0.000 | 0.001 | |
| vdp.mixt | 0.064 | 0.002 | 0.068 | |
| vectorize.groupings | 0 | 0 | 0 | |
| write.netresponse.results | 0 | 0 | 0 | |