icmotif_count {ILSM}R Documentation

Calculating the number of 48 motifs

Description

Calculating the number of 48 motifs from a tripartite interaction network.

Usage

icmotif_count(network.or.subnet_mat1, subnet_mat2 = NULL)

Arguments

network.or.subnet_mat1

Either a multilayer(tripartite) network of 'igraph' class which contains three groups of species and interactions within layers without interactions between each group of species, or a numeric matrix(or data.frame) representing interactions between two groups of species. Each row and column of matrix represents single species in the second and first groups of the tripartite network respectively. Elements of matrix are non-zero numbers if the two groups of species are connected, and 0 otherwise.

subnet_mat2

A numeric matrix(or data.frame) representing interactions between two groups of species. Each row and column of matrix represents single species in the second and third groups of the tripartite network respectively. Elements of matrix are non-zero numbers if the two groups of species are connected, and 0 otherwise. If network.or.subnet_mat1 is "igraph", subnet_mat2 defaults to NULL.

Details

network.or.subnet_mat1 and subnet_mat2

There are two types of network.or.subnet_mat1 that can be processed:

If the type of inputting is data frame or matrix, please make sure the row of network.or.subnet_mat1 and subnet_mat2 correspond with the second group of species that both belong to two subnetworks and interact with other groups of species.

About a network of type "igraph", It can be obtained from the connection matrices of subnetworks by the function igraph_from_matrices.

Value

Return a numeric vector with the number of 48 motifs: M111, M112, M113, M114, M211, M212, M213, M311, M312, M411, M121_1, M122_1, M122_2, M122_3, M123_1, M123_2, M123_3, M123_4, M123_5, M221_1, M221_2, M221_3, M222_1, M222_2, M222_3, M222_4, M222_5, M222_6, M222_7, M222_8, M222_8, M321_1, M321_2, M321_3, M321_4, M321_5, M131, M132-1, M132-2, M132-3, M132-4, M132-5, M231-1, M231-2, M231-3, M231-4, M231-5, M141.

References

Pilosof, S., Porter, M. A., Pascual, M., & Kéfi, S. (2017). The multilayer nature of ecological networks. Nature Ecology & Evolution, 1(4), 0101.

Simmons, B. I., Sweering, M. J., Schillinger, M., Dicks, L. V., Sutherland, W. J., & Di Clemente, R. (2019). bmotif: A package for motif analyses of bipartite networks. Methods in Ecology and Evolution, 10(5), 695-701.

Examples


set.seed(12)
d <- build_net(11,22,21,0.2)
m <- icmotif_count(d)
m

set.seed(12)
d <- build_net(11,22,21,0.2,asmatrices=TRUE)

MAT<-d
icmotif_count(MAT[[3]],MAT[[4]])

md1<-matrix(sample(c(0,1),120,replace=TRUE),8,15)
md2<-matrix(sample(c(0,1),120,replace=TRUE),10,12)
icmotif_count(md1,md2)

R<-rownames(MAT[[4]])[12]
MR<-MAT[[4]][12,]
MAT[[4]]<-MAT[[4]][-12,]
MAT[[4]]<-rbind(MAT[[4]],MR)
rownames(MAT[[4]])[22]<-R

icmotif_count(MAT[[3]],MAT[[4]])



[Package ILSM version 1.0.3.1 Index]