set_brainGraph_attr

17 views
Skip to first unread message

yd li

unread,
Jun 10, 2019, 11:53:28 AM6/10/19
to brainGraph-help
Hi, Chris,
I have 2 questions about the function of  set_brainGraph_attr:
1.  What are the possible values for the weighting argument? "sld"(for probabilistic DTT),"FA"(for deterministic DTT) and "pearson"(for fmri)?
2. I have fused all graphs (116*116 matrices derived from probabilistic DTT) at different thresholds into a final graph(W: a 116*116 matrix )for every subject using similarity network fusion algorithm .  Then I need to calculate all topological features for the final graph (W) with no thresholds.
    if I use following code, I will recieve an error message:
    g.tmp <- graph_from_adjacency_matrix(W,mode='undirected', diag=F, weighted=T)
    g.tmp <- set_brainGraph_attr(g.tmp, 
                                                    atlas, 
                                                    modality=modality,
                                                    weighting='sld', 
                                                    threshold=0,
                                                    subject=table_covars[groups[i], Study.ID[k]], 
                                                    group=groups[i],
                                                    use.parallel=F,
                                                    A=W)
  Error in if (nrow(adjmatrix) != ncol(adjmatrix)) { : 
  argument is of length zero

  if I change the code into following , no error appears:
  g.tmp <- graph_from_adjacency_matrix(W,mode='undirected', diag=F, weighted=T)
  g.tmp <- set_brainGraph_attr(g.tmp, 
                                                    atlas, 
                                                    modality=modality,
                                                    weighting='sld', 
                                                    threshold=0,
                                                    subject=table_covars[groups[i], Study.ID[k]], 
                                                    group=groups[i],
                                                    use.parallel=F,
                                                    A=A.norm.sub[[j]][, ,inds[[i]][k]])
  I don't know the appropriate value for the A argument. Could you help me correct my code? 

Chris Watson

unread,
Jun 10, 2019, 4:04:40 PM6/10/19
to brainGr...@googlegroups.com
1. Technically, whatever you want. This is just for your own record-keeping purposes. The "summary" method for the graphs recognize a handful and will print a phrase for them:
fa --> FA (fractional anisotropy)
sld --> Streamline density
pearson --> Pearson correlation
spearman --> Spearman's rank correlation
kendall --> Kendall's rank correlation
partial --> Partial correlation

2. I am not sure where this error occurs; could you run "traceback()" after you see the error?
In the meantime, can you tell me more about the "W" matrix? You can use the following commands:
class(W)
typeof(W)
dim(W)
str(W)
It is possible that your network fusion algorithm does not return a proper R matrix.

Regarding your final question, the appropriate value for the "A" argument should be the adjacency matrix used to create the graph; in this case it should equal "W" as in your first example.
Chris

--
You received this message because you are subscribed to the Google Groups "brainGraph-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-he...@googlegroups.com.
To post to this group, send email to brainGr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/519a1876-96ad-442c-8814-7abc2c17b4cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

yd li

unread,
Jun 10, 2019, 10:28:41 PM6/10/19
to brainGraph-help
Hi, Chris,
> traceback()
4: graph.adjacency.dense(adjmatrix, mode = mode, weighted = weighted, 
       diag = diag)
3: graph_from_adjacency_matrix(A[X[[i]], X[[i]]], mode = "undirected", 
       weighted = weighted)
2: efficiency(g, type = "local", use.parallel = use.parallel, A = A)
1: set_brainGraph_attr(g.tmp, atlas, modality = modality, weighting = "sld", 
       threshold = 0, subject = table_covars[groups[i], Study.ID[k]], 
       group = groups[i], use.parallel = F, A = W)

> class(W)
[1] "matrix"

> typeof(W)
[1] "double"

> dim(W)
[1] 116 116

> str(W)
 num [1:116, 1:116] 0.5 0.00398 0.00398 0.00398 0.00445 ...

Thanks!

Chris Watson

unread,
Jun 10, 2019, 11:52:28 PM6/10/19
to brainGr...@googlegroups.com
Can you send me a file containing:
* the matrix "W"
* the graph "g.tmp"
* the atlas data.table; unless it is the "aal116" atlas, then just let me know if that is the case.
* "table_covars"
* "groups"

You can do so w/ the following command, or choose a filename yourself. You can email me the file off-list, if you prefer.
save(W, g.tmp, table_covars, groups, atlas, file='debug.rda')

Chris

--
You received this message because you are subscribed to the Google Groups "brainGraph-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-he...@googlegroups.com.
To post to this group, send email to brainGr...@googlegroups.com.

Chris Watson

unread,
Jun 12, 2019, 6:56:14 PM6/12/19
to brainGr...@googlegroups.com
I discovered the issue. Your graph "g.tmp" is a fully connected graph; i.e., it's density is equal to 1. So, every vertex has every other vertex as a neighbor. This means that the local efficiency will be identical for all vertices and in this case will be equal to the graph's global efficiency. So to get any meaningful local efficiency, the graph cannot be fully connected.

Chris
Reply all
Reply to author
Forward
0 new messages