One group interaction analysis with SCN

15 views
Skip to first unread message

özgün özalay

unread,
Jul 7, 2019, 10:15:35 AM7/7/19
to brainGraph-help
Hi Chris;

I am trying to investigate the relationship between a task score and graph metrics using SCN in your toolbox. Previously I was able to compare SCN between two groups with covariates using permutation testing (of course with a lot of help from you). This time I am trying to do a parametric analysis within a group. Is this possible with permutation testing? or should i prefer GLM? I couldn't find this in your guide, I will be very happy if you can point me to a good starting point.

PS: I tried to do permutation testing with my previous code for one group but it didn't work. I got "out of script bounds" error.

Best wishes
Ozgun

Chris Watson

unread,
Jul 7, 2019, 6:55:51 PM7/7/19
to brainGraph-help
It depends on the nature of your data. If your SCN are group-wise (which is typically the case), then it would not be possible, as all subjects within a group are "collapsed" and there is only a single graph/vertex metric for the entire group (at a given density).

If you have single-subject graphs, then "brainGraph_GLM" would work. In this case, it is not an interaction, strictly speaking, but a correlation of the graph/vertex metric and task scores. You should be able to use the same code as in User Guide 8.4.3 (two-group difference with continuous covariate interaction), although of course there will only be 1 group in the analysis.

Let me know if you have more questions.
Chris

özgün özalay

unread,
Jul 9, 2019, 2:47:24 AM7/9/19
to brainGraph-help
I was afraid of this :)  I think i need to wait for probtrackx2 results to correlate task scores with graph metrics.

Thanks for the fast response!

Best
Ozgun

özgün özalay

unread,
Oct 14, 2019, 8:32:41 AM10/14/19
to brainGraph-help
Dear Chris;

Finally, I could finish running probtrackx and get connectivity matrices successfully. Everything went smoothly until GLM step. When i use slightly modified code as you suggested on sec 8.4.3 as;

X <- brainGraph_GLM_design(covars.dti[, 1:3], coding='cell.means', mean.center=FALSE, int=c('Group', 'Score'))

When mean.center=TRUE it demeans my Subject.ID column too, so i used mean.center=FALSE


and

con.mat <- matrix(c(0, 0, 1), nrow=1, dimnames=list('Group X Score'))

followed by

summary(brainGraph_GLM(g, measure='E.nodal.wt', covars=covars[, 1:3], X=X, con.mat=con.mat, alt='greater'))

I get error;

Error in vcount(g.list[[1]]) : Not a graph object

I understand that i had a problem when creating graph object "g". Also, this "g" list doesn't look right to me. For example, g[[1]][[1]][[22]] gives me subject 22 for the first threshold but structures listed under this are only 10 and then other structures nested below it, i don't know but it looks wrong to me although "my.mats" list looks fine. Is there any looping problem here?

I don't know if they are relevant but I only got another 2 errors until here, which are;


setcolorder(dt.G, c('modality', 'atlas', 'weighting', 'sub.thresh', 'threshold',
+                     'Group', 'Study.ID', names(dt.G)[c(1:4, 6:23)]))
Error in setcolorder(dt.G, c("modality", "atlas", "weighting", "sub.thresh",  : 
  neworder contains duplicates



dt.G.tidy <- melt(dt.G, c(names(dt.G)[1:7], 'density'))
Duplicate column names found in molten data.table. Setting unique names using 'make.names'
Warning message:
In melt.data.table(dt.G, c(names(dt.G)[1:7], "density")) :
  'measure.vars' [diameter, transitivity, assortativity, strength, ...] are not all of the same type. By order of hierarchy, the molten data value column will be of type 'character'. All measure variables not of type 'character' will be coerced too. Check DETAILS in ?melt.data.table for more on coercion.


This is a link for my entire workspace if you want to check: https://drive.google.com/open?id=13RFdRxkE9JrQoTMEniYtZpRJXdrKFtBx


And finally another question;

I used FreeSurfer surfaces on white matter surface for fiber tracking ROIs. In the sizes.txt file, I used ROI surface area (mm) instead of ROI volume. Do you think this is ok?


Best wishes
Ozgun

Chris Watson

unread,
Oct 14, 2019, 7:25:20 PM10/14/19
to brainGr...@googlegroups.com
Hi Ozgun,

1) What version of "brainGraph" are you using? I thought I had already
fixed "brainGraph_GLM_design", but you can edit the function and add
the following line before the line first creating "X":
covars[, Study.ID := as.character(Study.ID)]

Alternatively, before calling "brainGraph_GLM_design" you can use the
above command in the console.

2) I was surprised the "con.mat" doesn't throw an error, but I see
that "Study.ID" was included in your design matrix, which is
incorrect. If you apply the fix above, then "X" will have 2 columns.
Your contrast of interest would then be [1 0] (because the "Group"
column will be moved and become the 2nd column), testing for the
linear relationship between nodal efficiency and "Score". You also do
not need to specify an interaction; see
https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/GLM#Single-Group_Average_with_Additional_Covariate

3) If the "g" object contains all subjects, and groups, and
thresholds/densities, then you will need to pass only a single
threshold/density. This can be done for example by the following
(assume you want the 10th threshold here):

result <- brainGraph_GLM(do.call(Map, c(c, g))[[10]], measure='E.nodal.wt', ...)

where "..." are the rest of your arguments. This appears to me to be
the source of your error.

4) I think using surface area is fine if the streamlines terminate
when they "hit" a surface.

I am nearing the end (I hope!) of a major, very large update to
v3.0.0. It simplifies a lot of things, in particular there will no
longer be list objects such as "g[[1]][[5]][[22]]" that are 3 "levels"
deep. My goal is to push the update to CRAN in the next ~10 days; at
the latest I hope to have it all done by the end of the month. You
could wait until then, and reprocess the data, but if you don't want
to wait then I think the above fix should work for you.

Chris
> 'threshold',+ 'Group', 'Study.ID', names(dt.G)[c(1:4,
> 6:23)]))Error in setcolorder(dt.G, c("modality", "atlas", "weighting",
> "sub.thresh", :
> neworder contains duplicates
>
>
>
>
> dt.G.tidy <- melt(dt.G, c(names(dt.G)[1:7], 'density'))Duplicate column
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/brainGraph-help/e1d19b08-29ca-4375-a37f-8b7cb8b03e48%40googlegroups.com.
>

özgün özalay

unread,
Oct 15, 2019, 5:22:00 PM10/15/19
to brainGraph-help
Dear Chris;

Thank you so much for your solution. I was using CRAN version (2.2) but now updated to v2.7.1

Everything works very well now, I can get the results for both vertex and graph level metrics. I should pay more attention to the data structure.

Looking forward to major release v3.0.0. I am very grateful that you keep this package updated, thank you so much for your efforts! I hope i can get better at R and brainGraph soon.

Best wishes
Ozgun

Chris Watson

unread,
Oct 17, 2019, 8:39:31 AM10/17/19
to brainGr...@googlegroups.com
I'm glad updating fixed the issue. Let me know if you experience any others.
Chris

To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-he...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/b9acb077-c4ed-4f44-a8f1-d1d972ab70fb%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages