BipartiteModularityMaximization

The goal of this R package is to partition a bipartite network into non-overlapping biclusters by maximizing bipartite modularity defined in Barber (2007) using the bipartite version of the algorithm described in Treviño (2015).

Installation

Environment

The package contains C/C++ code that needs compilation.

write('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', file = "~/.Renviron", append = TRUE)

More details can be found in documents of RStudio or R.

Installation from CRAN

Use the following command to install the released version of the package from CRAN, where pre-compiled “binary packages” might be available.

install.packages("BipartiteModularityMaximization")

Installation from GitHub

Once you set up the compiler, you can install the latest version of the package from GitHub with:

install.packages("remotes")
remotes::install_github("DIVA-Lab-UTMB/BipartiteModularityMaximization")

Example

This is a basic example which shows you how to use the main function bipmod (short for bipartite modularity) to partition the example bipartite network (represented as an incidence matrix of 798 rows and 8 columns):

## basic example code
library(BipartiteModularityMaximization)
data(example_data)
str(example_data)
#> 'data.frame':    798 obs. of  8 variables:
#>  $ Symptom_1: int  1 1 0 1 1 1 0 1 0 0 ...
#>  $ Symptom_2: int  1 1 0 1 1 1 0 1 1 0 ...
#>  $ Symptom_3: int  1 1 0 1 0 0 0 0 1 0 ...
#>  $ Symptom_4: int  1 1 0 1 1 1 1 1 1 0 ...
#>  $ Symptom_5: int  1 1 1 1 0 1 0 1 1 1 ...
#>  $ Symptom_6: int  0 1 0 1 1 1 0 1 1 0 ...
#>  $ Symptom_7: int  1 1 0 0 1 1 1 1 1 0 ...
#>  $ Symptom_8: int  1 0 1 1 1 1 0 1 1 0 ...
Q_part=bipmod(example_data)
str(Q_part)
#> List of 2
#>  $ MODULARITY: num 0.262
#>  $ ASSIGN    : int [1:806] 2 2 2 4 4 2 3 2 4 2 ...

Documentation

Please read the documentation using ?bipmod or ?example_data for more details.

The biclusters can be visualized using ExplodeLayout epl described in Bhavnani (2017).