knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

feasoverlap

The goal of feasoverlap is to compute the overlap between two feasibility domains.

Installation

You can install the development version of feasoverlap from GitHub with:

# install.packages("devtools")
devtools::install_github("clsong/feasoverlap")

Example of the overlap of two random interaction matrix

library(feasoverlap)

# generate two random interaction matrices
set.seed(1)
A <- interaction_matrix_random(num = 4, stren = 0.4, conne = 1)
set.seed(2)
B <- interaction_matrix_random(num = 4, stren = 0.4, conne = 1)

calculate_omega(A) # relative size of interaction matrix
calculate_omega_overlap(A, A) # overlap between the same matrix

calculate_omega(B) # relative size of interaction matrix
calculate_omega_overlap(B, B) # overlap between the same matrix

calculate_omega_overlap(A, B) # overlap of two interaction matrices
calculate_omega_overlap(B, A) # overlap of two interaction matrices

Example of the normalized size of the feasibility domain of a random interaction matrix under linear biological inequalities

library(feasoverlap)

set.seed(4)
A <- interaction_matrix_random(3, 0.4, 1) #generate a random interaction matrix
C1 <- diag(c(-1,-1,-1), 3) #imposing a biological constraint. Here it refers to that the growth rates of all species have to be positive
C2 <- diag(c(1,-1,1), 3)  #imposing a biological constraint. Here it refers to that the growth rates of species 1 and 3 have to be negative, and the growth rates of species 2 has to be positive

calculate_omega(A) #relative size of the original interaction matrix
calculate_omega_overlap(A, C1) #the normalized size of the feasibility domain of a random interaction matrix under linear biological constriants C1
calculate_omega_overlap(A, C2) #the normalized size of the feasibility domain of a random interaction matrix under linear biological constriants C2


clsong/feasoverlap documentation built on Jan. 1, 2023, 7:10 a.m.