Confusion/doubts regarding community generation step in cna()

Issue #734 new
paras created an issue

Hello Bio3d team,

I am using bio3d to compare the community structure of mutant and wildtype protein (from MD simulation)

and i am using following two commands to generate two networks.

netmax <- cna (cij, cm = cmapread, cuttof.cij=0.4,vnames=c(135:716),collapse.method="max") 
netmean <- cna (cij, cm = cmapread, cuttof.cij=0.5,vnames=c(135:716),collapse.method="mean")

Thereafter, i refine them using network amendment() to select community structure with slightly lower modularity score using following function (from tutorial section).

mod.select <- function(x, thres=0.1) {    
   remodel <- community.tree(x, rescale = TRUE)    
   n.max = length(unique(x$communities$membership))    
   ind.max = which(remodel$num.of.comms == n.max)    
   v = remodel$modularity[length(remodel$modularity):ind.max]    
   v = rev(diff(v))    
   fa = which(v>=thres)[1] - 1    
   ncomm = ifelse(is.na(fa), min(remodel$num.of.comms), n.max - fa)     
   ind <- which(remodel$num.of.comms == ncomm)    
   network.amendment(x, remodel$tree[ind, ])  
}

but output network for netmean and netmax are coming identical (irrespective of different cij cut-offs and different collapse methods).

Here are my queries regarding that,

1. The collapse.method variables (max, mean and median), uses maximum correlation value, or mean/median of correlation value of all pairs (which have edge between them) and their -log transformation as default edge between communities ?

2. Is network amendment script can be used in this very case ?

3. Identical output of different networks are generated because of call to cna() from network.amendment() uses only 'max' as default argument (which cant be changed by user, i think)? and hence different networks generated from different collapse methods are buffered by network amendment step ?

4. If i have to select community structure with lower modularity score overall, how should i make sure that correlation edges between those desired communities are result of max or mean collapse methods?

Thanks a lot!,

Comments (2)

  1. Xinqiu Yao
    1. Yes.
    2. Maybe not directly. As you noticed, in network.amendment() the ‘max’ method is hard coded. You need to modify the code a little bit for netmean.
    3. I am not sure this is the reason causing the identical output. But it definitely worth trying a “fixed” version of network.amendment().
    4. As I said, just make another version of network.amendment() which takes collapse.method as input. Then, source the local code within R.

    Let me know if you still have questions.

  2. Log in to comment