Midlayer_role {ILSM}R Documentation

Analyzising role of interconnecting node in motifs

Description

Counting the number of 65 roles about interconnecting species in multilayer network motifs.

Usage

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

Arguments

network.or.subnet_mat1

Either a multilayer(tripartite) network of 'igraph' class which contains interlayer links and without intralayer links, 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

Returns a matrix of 65 columns representing the roles of interconnecting species in the motifs. Columns names are Role1, Role2, Role3 ... Role65.

Each row of matrix corresponds to a interconnecting species in the second layer of network. If a interconnecting species is linked to both the second and third level species, the elements in this row are not all zero, otherwise the elements are all zero.

References

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)
Midlayer_role(d)

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

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

md1<-matrix(sample(c(0,1),88,replace=TRUE),8,11)
md2<-matrix(sample(c(0,1),120,replace=TRUE),10,12)
Midlayer_role(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

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



[Package ILSM version 1.0.2 Index]