problems with g, GC.wt and PC.wt.

103 views
Skip to first unread message

Virva Saunavaara

unread,
Dec 30, 2020, 7:23:33 AM12/30/20
to brainGr...@googlegroups.com

Hi Chris,


Thank you for the wonderful analysis package! 


System info:

platform       x86_64-apple-darwin17.0  

version.string R version 4.0.3 (2020-10-10)

RStudio Version 1.2.5033

I have tried this with brainGraph version 3.0.0 and 3.0.1. 


I’m working with vertex measures GC.wt and PC.wt. My problem is that the values of the parameters are the same. Values GC and PC are not the same. They (GC.wt and PC.wt) were not the same in version 2.7.3. 


I also had problems when I created the g and the g.group. Maybe this is the cause of my additional problems?


As a start I used the example code on manual page 46: 

g[[j]] <- make_brainGraphList(A.norm.sub[[j]], atlas, modality=modality, weighting='sld', threshold=thresholds[j], 

weighted=TRUE, gnames=covars.dti$Study.ID, groups=covars.dti$Group) 

I get an error: Error in { : task 1 failed - "unused argument (groups = c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1))"

and the rds-files are not saved.

I made some changes to the code. I attached the code to this mail. Shortly:

For g[[j]]: “groups=covars.dti$Group” was changed to “grpNames=covars.dti$Group”

and 

For g.group[[j]]: I added “grpNames=grps” to the end. 


After this I write the values to data tables. I used the following code (manual page 47):

dt.V <- rbindlist(lapply(g, vertex_attr_dt))

dt.G <- rbindlist(lapply(g, graph_attr_dt))

dt.V.group <- rbindlist(lapply(g.group, vertex_attr_dt)) 

dt.G.group <- rbindlist(lapply(g.group, graph_attr_dt))

If I open the dt.V data table, the GC.wt and PC.wt have the same values. 


At the later stage of the analysis, I try to do the vertex-wise group analysis using g. I get the same result nodes and values for GC.wt and PC.wt. 

I can’t figure out what I did wrong. I hope you can help me. 

With Best Regards,

Virva


02_create_graphs.nb.html
02_create_graphs.Rmd

Chris Watson

unread,
Dec 30, 2020, 8:12:52 AM12/30/20
to brainGr...@googlegroups.com
I don't know without seeing the data, but neither of those functions have changed in a long time. You can try calculating each for a single graph and seeing if the numbers differ. E.g.

GC1 <- gateway_coeff(g[[1]][1], V(g[[1]][1])$comm.wt)
PC1 <- part_coeff(g[[1]][1], V(g[[1]][1])$comm.wt)

If they are different from what you see in your data tables, then there could be a bug when calculating from within another function.

--
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/CAGs%2BzKt1xB5qpD9yJqaiA2yPC5fVHxgLnoemyV9iKfi%3D2ExNgQ%40mail.gmail.com.

virva.sa...@gmail.com

unread,
Dec 30, 2020, 1:26:12 PM12/30/20
to brainGraph-help
Hi,

Thank you for your kind reply! 

The separate calculations give different values for GC.wt and PC.wt. Alto the values are quite different what I get from dt.V. I attached the notebook html to this message. 

Best Regards,
Virva
GC and PC.nb.html

Chris Watson

unread,
Dec 30, 2020, 2:39:22 PM12/30/20
to brainGr...@googlegroups.com
How about instead, you print the vertex attributes directly; i.e.,

V(g[[1]][1])$GC.wt
V(g[[1]][1])$PC.wt

I suspect these will be the same but would like to confirm.

Virva Saunavaara

unread,
Dec 31, 2020, 1:22:45 AM12/31/20
to brainGr...@googlegroups.com
Hi,

They look the same. See the attached note book. New lines at the end.

Thanks again!

With Best Regards,
Virva

GC and PC.nb.html

Chris Watson

unread,
Dec 31, 2020, 6:46:58 AM12/31/20
to brainGr...@googlegroups.com
Then if you'd like me to find out where the bug is occurring, I will need to see your data. Please send all data I would need to reproduce the issue; this will likely be the 3D array of connectivity matrices (if these are single-subject graphs) in addition to the covariates table. Please also send me the code you used to generate your data and results; I would prefer just a simple R script, but if you only have Rmd that is ok.

Chris

P.S. It would be much simpler to use the "data.table" syntax without creating a function like "foo" which just complicates things. So you would write:

DT[Study.ID == '153' & threshold == 0.01, .(Study.ID, threshold, GC.wt, PC.wt)]

virva.sa...@gmail.com

unread,
Dec 31, 2020, 9:12:10 AM12/31/20
to brainGraph-help
Hi,

You can find the data attached to this mail. It is only small part of the full data set. These are the original matrix and additional data. I hope this format is ok, as anything else RStudio saves is huge and difficult to transfer. It shows the same behaviour. 

I also transferred the analysis code to R-script.   

Thank you for all your advice!

Best Regards,
Virva
R-proj-301-partial.zip

Chris Watson

unread,
Jan 6, 2021, 8:46:38 AM1/6/21
to brainGr...@googlegroups.com
Sorry for the delay. I have discovered the source of the bug and hope to get a new release out by the weekend.
Chris

virva.sa...@gmail.com

unread,
Jan 11, 2021, 5:05:24 AM1/11/21
to brainGraph-help
Thank you! Looking forward to the new version!

virva.sa...@gmail.com

unread,
Jan 21, 2021, 8:48:05 AM1/21/21
to brainGraph-help

Hi Chris,

It looks to me that the brainGraph package is not upgraded. I tryed to install a new version using the devtools.  

devtools::install_github('cwatson/brainGraph')


I get an output:

Skipping install of 'brainGraph' from a github remote, the SHA1 (b78bae97) has not changed since last install


I’m I trying to install it from the wrong place? 

Sorry for the extra trouble!

Best,
Virva

Chris Watson

unread,
Jan 21, 2021, 12:41:38 PM1/21/21
to brainGr...@googlegroups.com
I have not had a chance to update yet. I should have some time over the next few days to get around to it.
Chris

Chris Watson

unread,
Feb 3, 2021, 10:15:37 AM2/3/21
to brainGr...@googlegroups.com
Sorry for the delay. I have just pushed the fix to GitHub so you can update the package and it should work properly now.
Chris
Reply all
Reply to author
Forward
0 new messages