The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Vicus: Exploiting local structures to improve network-based analysis of biological data

Koki Tsuyuzaki

Laboratory for Bioinformatics Research, RIKEN Center for Biosystems Dynamics Research
k.t.the-answer@hotmail.co.jp

2023-03-23

Introduction

In this vignette, we consider a novel graph embedding method, Vicus (Wang B 2017).

Here, we use the Swiss roll data, which is a well known toy model.

set.seed(1)
N <- 300
p <- sqrt(2 + 2 * seq(-1, 1 - 2 / N, 2 / N))
y <- 2 * runif(N, -1, 1)
X <- cbind(p * cos(2 * pi * p), y, p * sin(2 * pi * p))
X <- scale(X, center=TRUE, scale=TRUE) * 3
labelX <- c(rep(1:11, each = floor(N / 11)), rep(11, length=3))
library("scatterplot3d")

# Color Setting
colors <- labelX
cols <- c("#9E0142", "#D53E4F", "#F46D43", "#FDAE61",
    "#FEE08B", "#FFFFBF", "#E6F598", "#ABDDA4",
    "#66C2A5", "#3288BD", "#5E4FA2")
for(i in seq_along(cols)){
    colors[which(colors == i)] <- cols[i]
}

oldpar <- par("cex")
par(cex = 1.2)
scatterplot3d(X, color=colors, pch=16, main="Original Data", angle=40)

2D Embedding

The Vicus package provides three types of graph embedding algorithms: Vicus, Laplacian Eigenmaps (LEM), and Hessian Locally Linear Embedding (HLLE).

First, the graphMatrix function computes a matrix containing graph information for each algorithm:

library("Vicus")

objVicus <- graphMatrix(X, algorithm="Vicus", ndim=2, K=10)
objLEM <- graphMatrix(X, algorithm="LEM", ndim=2, K=10)
objHLLE <- graphMatrix(X, algorithm="HLLE", ndim=2, K=5)
str(objVicus, 2)
## List of 3
##  $ M        :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
##  $ algorithm: chr "Vicus"
##  $ ndim     : num 2
str(objLEM, 2)
## List of 3
##  $ M        :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
##  $ algorithm: chr "LEM"
##  $ ndim     : num 2
str(objHLLE, 2)
## List of 3
##  $ M        :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
##  $ algorithm: chr "HLLE"
##  $ ndim     : num 2

Next, the embedding function performs eigenvalue decomposition and estimates the low-dimensional coordinates.

outVicus <- embedding(objVicus)
outLEM <- embedding(objLEM)
outHLLE <- embedding(objHLLE)

The low dimensional coordinates show that Vicus is better able to capture the local structure of the Swiss roll data.

layout(t(1:3))
plot(outVicus, col=colors, pch=16, main="Vicus", cex=2)
plot(outLEM, col=colors, pch=16, main="LEM", cex=2)
plot(outHLLE, col=colors, pch=16, main="HLLE", cex=2)

3D Embedding

It can also be embedded to any dimension by simply changing the value of ndim as follows:

objVicus_3D <- graphMatrix(X, algorithm="Vicus", ndim=3)
objLEM_3D <- graphMatrix(X, algorithm="LEM", ndim=3)
objHLLE_3D <- graphMatrix(X, algorithm="HLLE", ndim=3)

The following step is the same as in 2D Embedding case above.

outVicus_3D <- embedding(objVicus_3D)
outLEM_3D <- embedding(objLEM_3D)
outHLLE_3D <- embedding(objHLLE_3D)
layout(cbind(1:2, 3:4))
scatterplot3d(X, color=colors, pch=16, main="Original Data", angle=40)
scatterplot3d(outVicus_3D, color=colors, pch=16, main="Vicus", angle=40)
scatterplot3d(outLEM_3D, color=colors, pch=16, main="LEM", angle=70)
scatterplot3d(outHLLE_3D, color=colors, pch=16, main="HLLE", angle=70)

par(cex = oldpar)

Session Information

## R version 3.6.3 (2020-02-29)
## Platform: x86_64-conda-linux-gnu (64-bit)
## Running under: CentOS Linux 7 (Core)
## 
## Matrix products: default
## BLAS/LAPACK: /home/koki/miniconda3/lib/libopenblasp-r0.3.17.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] Vicus_0.99.0         scatterplot3d_0.3-43
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.8      RANN_2.6.1      lattice_0.20-45 digest_0.6.29  
##  [5] RSpectra_0.16-0 grid_3.6.3      R6_2.5.1        jsonlite_1.8.0 
##  [9] magrittr_2.0.2  evaluate_0.15   highr_0.9       rlang_0.4.11   
## [13] stringi_1.7.6   jquerylib_0.1.4 Matrix_1.4-0    bslib_0.3.1    
## [17] rmarkdown_2.11  tools_3.6.3     stringr_1.4.0   xfun_0.29      
## [21] yaml_2.3.5      fastmap_1.1.0   compiler_3.6.3  htmltools_0.5.2
## [25] knitr_1.37      sass_0.4.0

References

Wang B, et al. 2017. “Vicus: Exploiting Local Structures to Improve Network-Based Analysis of Biological Data.” PLOS Computational Biolog 13(10): e1005621.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.