This function changes the ‘communities’ attribute of a ‘cna’ class object to match a given membership vector.

network.amendment(x, membership, minus.log=TRUE)

Arguments

x

A protein network graph object as obtained from the ‘cna’ function.

membership

A numeric vector containing the new community membership.

minus.log

Logical. Whether to use the minus.log on the cij values.

Value

Returns a ‘cna’ class object with the attributes changed according to the membership vector provided.

Details

This function is useful, in combination with ‘community.tree’, for inspecting different community partitioning options of a input ‘cna’ object. See examples.

Author

Guido Scarabelli

See also

cna, community.tree, summary.cna

Examples

# \donttest{ # PDB server connection required - testing excluded if (!requireNamespace("igraph", quietly = TRUE)) { message('Need igraph installed to run this example') } else { ##-- Build a CNA object pdb <- read.pdb("4Q21") modes <- nma(pdb) cij <- dccm(modes) net <- cna(cij, cutoff.cij=0.2) ##-- Community membership vector for each clustering step tree <- community.tree(net, rescale=TRUE) ## Produce a new k=7 membership vector and CNA network memb.k7 <- tree$tree[ tree$num.of.comms == 7, ] net.7 <- network.amendment(net, memb.k7) plot(net.7, pdb) print(net) print(net.7) }
#> Note: Accessing on-line PDB file
#> Warning: /var/folders/xf/qznxnpf91vb1wm4xwgnbt0xr0000gn/T//Rtmp4WslmZ/4Q21.pdb exists. Skipping download
#> Building Hessian... Done in 0.018 seconds. #> Diagonalizing Hessian... Done in 0.158 seconds. #> | |==================================================== | 74% | |==================================================== | 75% | |===================================================== | 75% | |===================================================== | 76% | |====================================================== | 77% | |====================================================== | 78% | |======================================================= | 78% | |======================================================= | 79% | |======================================================== | 79% | |======================================================== | 80% | |======================================================== | 81% | |========================================================= | 81% | |========================================================= | 82% | |========================================================== | 82% | |========================================================== | 83% | |=========================================================== | 84% | |=========================================================== | 85% | |============================================================ | 85% | |============================================================ | 86% | |============================================================= | 86% | |============================================================= | 87% | |============================================================= | 88% | |============================================================== | 88% | |============================================================== | 89% | |=============================================================== | 89% | |=============================================================== | 90% | |=============================================================== | 91% | |================================================================ | 91% | |================================================================ | 92% | |================================================================= | 92% | |================================================================= | 93% | |================================================================= | 94% | |================================================================== | 94% | |================================================================== | 95% | |=================================================================== | 95% | |=================================================================== | 96% | |==================================================================== | 97% | |==================================================================== | 98% | |===================================================================== | 98% | |===================================================================== | 99% | |======================================================================| 99% | |======================================================================| 100%
#> Warning: At community.c:460 :Membership vector will be selected based on the lowest modularity score.
#> Warning: At community.c:467 :Modularity calculation with weighted edge betweenness community detection might not make sense -- modularity treats edge weights as similarities while edge betwenness treats them as distances
#> Obtaining layout from PDB structure
#> #> Call: #> cna.dccm(cij = cij, cutoff.cij = 0.2) #> #> Structure: #> - NETWORK NODES#: 168 EDGES#: 668 #> - COMMUNITY NODES#: 9 EDGES#: 19 #> #> + attr: network, communities, community.network, #> community.cij, cij, call #> #> Call: #> cna.dccm(cij = cij, cutoff.cij = 0.2) #> #> Structure: #> - NETWORK NODES#: 168 EDGES#: 668 #> - COMMUNITY NODES#: 7 EDGES#: 13 #> #> + attr: network, communities, community.network, #> community.cij, cij, call
# }