Closed NedaRR closed 5 years ago
Do all of your graphs have a graph-level attribute named atlas
?
If they do have that attribute, then please make sure the data.table
for the atlas is in the search path. That is, you should be able to type in the atlas name and it will print the table in the console.
I do have atlas as an attribute. Also when I type dk in the console, prints the table.
[1] "data.table" "data.frame"```
the graph looks like:
```$`rMDD+naMCI`[[16]]
IGRAPH fc52d26 UN-- 68 1823 --
+ attr: Cp (g/n), Lp (g/n), rich (g/x), E.global (g/n), clust.method (g/c), mod (g/n), density (g/n), conn.comp (g/x),
| max.comp (g/n), num.tri (g/n), diameter (g/n), transitivity (g/n), assortativity (g/n), num.hubs (g/n), E.local (g/n),
| vulnerability (g/n), name (v/c), degree (v/n), knn (v/n), Lp (v/n), btwn.cent (v/n), hubs (v/n), ev.cent (v/n), lev.cent
| (v/n), k.core (v/n), transitivity (v/n), E.local (v/n), E.nodal (v/n), vulnerability (v/n), eccentricity (v/n), comm
| (v/n), color.comm (v/c), comp (v/n), color.comp (v/c), circle.layout.comm (v/n), GC (v/n), PC (v/n), z.score (v/n), atlas
| (v/x), betweenness (v/n), eigen_centrality (v/x), btwn (e/n), color.comm (e/c), color.comp (e/c)
+ edges from fc52d26 (vertex names):
[1] lBSTS--lcMFG lBSTS--lFUS lBSTS--lIPL lBSTS--lITG lBSTS--liCC lBSTS--lLOF lBSTS--lLING lBSTS--lMOF lBSTS--lMTG
[10] lBSTS--lPARH lBSTS--lpOPER lBSTS--lpORB lBSTS--lpTRI lBSTS--lpostC lBSTS--lPCC lBSTS--lpreC lBSTS--lPCUN lBSTS--lrACC
[19] lBSTS--lrMFG lBSTS--lSFG lBSTS--lSPL lBSTS--lSTG lBSTS--lSMAR lBSTS--lFP lBSTS--lTP lBSTS--lTT lBSTS--rBSTS
+ ... omitted several edges```
and
```> dk
name x.mni y.mni z.mni lobe hemi index name.full
1: lBSTS -56.00 -44.00 5.00 Temporal L 1 L bank of the superior temporal sulcus
2: lcACC -2.00 21.00 27.00 Cingulate L 2 L caudal anterior cingulate
3: lcMFG -45.00 18.00 46.00 Frontal L 3 L caudal middle frontal gyrus
4: lCUN -1.00 -82.00 20.00 Occipital L 4 L cuneus
5: lENT -16.00 -10.00 -29.00 Temporal L 5 L entorhinal
6: lFUS -24.00 -54.00 -16.00 Temporal L 6 L fusiform
7: lIPL -47.00 -70.00 31.00 Parietal L 7 L inferior parietal lobule
8: lITG -56.00 -32.00 -24.00 Temporal L 8 L inferior temporal gyrus
9: liCC -1.00 -48.00 25.00 Cingulate L 9 L isthmus cingulate cortex
...```.
If you email me the object g
as a .rds
file (using the R function saveRDS
) I will take a look.
I could finally run dt.V, after I specified atlas="dk" in this function: "g <- Map(function(x, y) lapply(x, set_brainGraph_attr, atlas="dk", modality=modality, group=y), g, as.list(groups)) "
However, groups
is changed to "Group" only. Instead of specifying my 7 groups.
So now the output for dt.G and dt.V is fine, except that is not specifying the groups.
looks like this ``` E.nodal vulnerability eccentricity GC PC z.score modality atlas Group
1: 0.7686567 0.0008480104 2 0.6779777 0.6466049 0.33921242 thickness dk Group
2: 0.5298507 -0.0088299828 3 0.2843628 0.2777778 -2.54583111 thickness dk Group
3: 0.7985075 0.0021585720 2 0.6616119 0.6350000 -0.01725592 thickness dk Group
4: 0.7288557 -0.0007649884 3 0.4810010 0.4412071 0.84554004 thickness dk Group
5: 0.6542289 -0.0037893613 3 0.5890061 0.5714286 -0.58591236 thickness dk Group
your help is highly appreciated!
Hi, I should have inspected the output above more closely. atlas
is not listed as a graph-level attribute above, but rather is vertex-level. This is not correct. I am not sure what commands you ran to create the graphs, but you should assign all of your graphs to have the atlas
attribute. You will probably also need to assign the following vertex-level attributes, if they are not present: name
, lobe
, hemi
.
Regarding your latest issue, please provide more information when posting. I do not know the contents of the groups
variable so I am not sure why it is "changed".
Atlas is now correctly attributed to group
| (g/n), diameter (g/n), transitivity (g/n), assortativity (g/n), _atlas (g/c_), version (g/x), modality (g/c), Group (g/c), assortativity.lobe
| (g/n), assortativity.lobe.hemi (g/n), asymm (g/n), spatial.dist (g/n), num.hubs (g/n), E.local (g/n), vulnerability (g/n), name (v/c), degree
| (v/n), lobe (v/c), lobe.hemi (v/n), hemi (v/c), x.mni (v/n), x (v/n), y.mni (v/n), y (v/n), z.mni (v/n), z (v/n), color.lobe (v/c),
| circle.layout (v/n), asymm (v/n), dist (v/n), dist.strength (v/n), knn (v/n), Lp (v/n), btwn.cent (v/n), hubs (v/n), ev.cent (v/n), lev.cent
| (v/n), k.core (v/n), transitivity (v/n), E.local (v/n), E.nodal (v/n), vulnerability (v/n), eccentricity (v/n), comm (v/n), color.comm (v/c),
| comp (v/n), color.comp (v/c), circle.layout.comm (v/n), GC (v/n), PC (v/n), z.score (v/n), color.lobe (e/c), dist (e/n), btwn (e/n),
| color.comm (e/c), color.comp (e/c)
I created g like this :
myResids<- get.resid(lhrh, covars=covars, exclude=c("Study.ID", "Group"), method = "sep.groups")
corrs <- corr.matrix(myResids, densities=densities)
g<-lapply(corrs, function(x)
apply(x$r.thresh, 3,
graph_from_adjacency_matrix, mode='undirected', diag=F))
covars is
Study.ID Group Age Sex EduCateg
1: PACTMD_CMH_0100002_01 aMCI 68 0 6
2: PACTMD_CMH_0100010_01 aMCI 71 0 6
3: PACTMD_CMH_0100012_01 aMCI 60 1 5
4: PACTMD_CMH_0100027_01 aMCI 70 1 4
5: PACTMD_CMH_0100031_01 aMCI 85 0 6
---
329: PACTMD_CMH_H3060188_01 HC 60 1 6
330: PACTMD_CMH_H3070065_01 HC 67 0 7
331: PACTMD_CMH_H3070076_01 HC 72 1 7
332: PACTMD_CMH_H3070083_01 HC 75 0 5
333: PACTMD_CMH_H3070115_01 HC 69 1 5
and Group is "aMCI, HC, AD, and 4 other groups".
g output is a large list of 7 elements, and looks like this for one group:
$AD[[1]]
IGRAPH 2edeab2 UN-- 68 1139 --
+ attr: Cp (g/n), Lp (g/n), rich (g/x), E.global (g/n), clust.method (g/c), mod (g/n), density (g/n), conn.comp (g/x), max.comp
| (g/n), num.tri (g/n), diameter (g/n), transitivity (g/n), assortativity (g/n), atlas (g/c), version (g/x), modality (g/c),
| Group (g/c), assortativity.lobe (g/n), assortativity.lobe.hemi (g/n), asymm (g/n), spatial.dist (g/n), num.hubs (g/n),
| E.local (g/n), vulnerability (g/n), name (v/c), degree (v/n), lobe (v/c), lobe.hemi (v/n), hemi (v/c), x.mni (v/n), x (v/n),
| y.mni (v/n), y (v/n), z.mni (v/n), z (v/n), color.lobe (v/c), circle.layout (v/n), asymm (v/n), dist (v/n), dist.strength
| (v/n), knn (v/n), Lp (v/n), btwn.cent (v/n), hubs (v/n), ev.cent (v/n), lev.cent (v/n), k.core (v/n), transitivity (v/n),
| E.local (v/n), E.nodal (v/n), vulnerability (v/n), eccentricity (v/n), comm (v/n), color.comm (v/c), comp (v/n), color.comp
| (v/c), circle.layout.comm (v/n), GC (v/n), PC (v/n), z.score (v/n), color.lobe (e/c), dist (e/n), btwn (e/n), color.comm
| (e/c), color.comp (e/c)
+ edges from 2edeab2 (vertex names):
$AD[[2]]
IGRAPH 425f85a UN-- 68 1185 --
+ attr: Cp (g/n), Lp (g/n), rich (g/x), E.global (g/n), clust.method (g/c), mod (g/n), density (g/n), conn.comp (g/x), max.comp
| (g/n), num.tri (g/n), diameter (g/n), transitivity (g/n), assortativity (g/n), atlas (g/c), version (g/x), modality (g/c),
| Group (g/c), assortativity.lobe (g/n), assortativity.lobe.hemi (g/n), asymm (g/n), spatial.dist (g/n), num.hubs (g/n),
| E.local (g/n), vulnerability (g/n), name (v/c), degree (v/n), lobe (v/c), lobe.hemi (v/n), hemi (v/c), x.mni (v/n), x (v/n),
| y.mni (v/n), y (v/n), z.mni (v/n), z (v/n), color.lobe (v/c), circle.layout (v/n), asymm (v/n), dist (v/n), dist.strength
| (v/n), knn (v/n), Lp (v/n), btwn.cent (v/n), hubs (v/n), ev.cent (v/n), lev.cent (v/n), k.core (v/n), transitivity (v/n),
| E.local (v/n), E.nodal (v/n), vulnerability (v/n), eccentricity (v/n), comm (v/n), color.comm (v/c), comp (v/n), color.comp
| (v/c), circle.layout.comm (v/n), GC (v/n), PC (v/n), z.score (v/n), color.lobe (e/c), dist (e/n), btwn (e/n), color.comm
| (e/c), color.comp (e/c)
+ edges from 425f85a (vertex names):
I meant the value of the vector groups
. Please paste the actual value of that variable.
groups [1] "Group"
One other question I got, how is "hub" been defined/calculated in the Braingraph? what does hub=0, hub=1, and hub=2 and more represent? Is hub referring to hub betweenness? I am following this:
# Count vertices with betweenness > mean + sd (i.e. 'hub' regions)
dt.Vhc[density == round(densities[1], 2) & hubs > 0, .N, by=Group]
I am interested in the hub betweenness > 2 sd
Regarding the groups
variable, this must be a vector, with length equal to the number of your groups (i.e., 7), in which each element is the group name/label.
Regarding hubs, please see the reference in the help for the hubness
function. As it states, the value for hubs
is from 0 to 4, depending on how many times the vertex was in the top 20% for one of the 4 metrics. The authors of the referenced paper choose a cutoff value of 2 or higher to be considered a hub.
So, it is not hub betweenness and thus does not have a meaningful standard deviation.
Thank you so much! Its working perfectly now!
I'm glad to hear it. I will close the issue.
Hi. Thank you for this great package. I've successfully run "set_brainGraph_attr" and "dt.G <- rbindlist(lapply(g, graph_attr_dt))". But I have trouble getting the output from "dt.V <- rbindlist(lapply(g, function(x) rbindlist(lapply(x, vertex_attr_dt))))"
Error in get(g$atlas) : invalid first argument g is a large list (7 elements), that is 7 groups I have. I'd appreciate your help in this regard. Thank you.