Re: [brainGraph-help] plot_brainGraph_gui documentation

50 views
Skip to first unread message

Chris Watson

unread,
Sep 22, 2016, 5:52:22 PM9/22/16
to brainGr...@googlegroups.com
I am unsure why you would be seeing that behavior. Do you mean when you only fill in the "Graph 1 name" entry, and leave the second blank? I just tried it and it still works for me.
I don't really have any documentation for that function, aside from the code itself. It was all written with functionality from the 'RGtk2' package. I honestly threw it together a long time ago, and refined it as my R coding proficiency improved, and I had a better vision for how the GUI should behave.

To give you some more info that I hope is useful:
* First I create a temporary window to allow for user entry of graph object names (e.g. "g1" and "g2"). In the code, this function is called "set.names". It's a simple function that really just checks if the entered object names exist and are *igraph* graph objects.
** What this does is save the entered graph object names as a variable for later use. I use the "double arrow" assignment in R, the '<<-' operator, which assigns a variable globally (so it extends outside of the function itself.
** This function is called again if the user clicks the "Pick new graphs" button.
* Write "callback" functions for the "File" dropdown menu of the main GUI window (called 'plot_entire_cb', 'plot_neighb_cb', 'plot_comm_cb'). This is to give the user a choice of plotting either the entire network, neighborhoods of vertices, or specific communities.
* Build the whole GUI (the function is "build.gui"). The behavior here will depend on which "callback" function is called. I.e. if you choose "neighborhood plot", then a different dropdown menu appears in the main GUI window.
* Any time the "OK" button is pressed, the "workhorse" function is called. This function is "update_brainGraph_gui", and handles all of the parameters that the user has chosen in the GUI window (e.g., how to color the vertices).
** This function then makes a call to "plot_brainGraph", which can be considered the "base" plotting function for my package. Even still, "plot_brainGraph" is essentially just a wrapper for "plot.igraph".
** If you would like to look into the arguments/parameters for "plot.igraph", at the R prompt you may type "?igraph.plotting"

So:
1. plot_brainGraph_gui: build the GUI itself, pass along parameters
2. update_brainGraph_gui: take the parameters the user chooses, and make it so that the plotting windows can be updated dynamically and without a new window created
3. plot_brainGraph: called for each individual plotting window, just a wrapper to "plot.igraph"

You can check the code for "plot_brainGraph_gui" and "update_brainGraph_gui" on the Github page. If you have other questions I am happy to answer them.
Chris

On Thu, Sep 22, 2016 at 4:13 PM, özgün özalay <ozgun....@gmail.com> wrote:
Hi Chris!

I am still trying to make the most out of your toolbox also trying to write our own using C.
Do you have any kind of documentation on plot_brainGraph_gui ? Unfortunately, I am having a bad time on plotting using R commands. 
For example, even if I have 1 graph in my project if I just enter it in the gui, nothing really happens.

Best,

Ozgun

--
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-help+unsubscribe@googlegroups.com.
To post to this group, send email to brainGraph-help@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/61df83c6-38d4-44a0-a1fa-483ec770181c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

özgün özalay

unread,
Sep 22, 2016, 7:30:03 PM9/22/16
to brainGraph-help
Thank you so much. I will keep this information for future reference. But let me ask you a simple question, i am sure i am doing a very fundamental mistake. After creating graph with;

g <- Map(function(x, y) llply(x, set.brainGraph.attributes, atlas=atlas,
modality
=modality, group=y, .progress= ' text ' ),
g
, as.list(groups))

i guess i have graph called "g", right?

I also made 2 hemisphere graphs from "g", using;
g.lh <- lapply(g, lapply, function(x) induced.subgraph(x, V(x)$hemi == ' L ' ))

and

g.rh <- lapply(g, lapply, function(x) induced.subgraph(x, V(x)$hemi == ' R ' ))

So now, i guess i have 3 graphs?

I can plot these graphs using your code in the manual, like sagittal one;

plot_brainGraph_mni( ' axial ' )
plot_brainGraph
(g[[1]][[N]], vertex.label=NA, vertex.size=V(g[[1]][[N]])$degree,
vertex
.color=V(g[[1]][[N]])$color.comm, edge.color=E(g[[1]][[N]])$color.comm,
edge
.width=log1p(E(g[[1]][[N]])$btwn))

Also other plotting types, like community detection works well. But still i can't use GUI :( 
Can you help me what to input for "Graph 1 Name" and "Graph 2 Name" in the GUI?

I am also attaching a screenshot of my RStudio Global environment window. Hope it helps. Thank you so much again!

Best,
Ozgun
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.
scr_R_Env.jpg

Chris Watson

unread,
Sep 22, 2016, 7:34:48 PM9/22/16
to brainGr...@googlegroups.com
The "g" object is actually a "list of lists". It should have two "levels", the first representing "group" and the second representing "density" (or "threshold", however you want to call it). So if I want to access the graph for group 1, and the 15th density, I would type "g[[1]][[15]]". (Note the double square brackets around each number). Perhaps this is why you have an error with the GUI. You should use that notation when filling in the "Graph 1 name" and "Graph 2 name" fields.
Similarly, "g.lh" and "g.rh" will also be lists of lists.

Please try that and let me know if it works
Chris

To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-help+unsubscribe@googlegroups.com.
To post to this group, send email to brainGraph-help@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/e9369923-7d8a-4a0a-8921-65e5e46ed091%40googlegroups.com.

özgün özalay

unread,
Sep 22, 2016, 7:42:49 PM9/22/16
to brainGr...@googlegroups.com
I've already tried that syntax (with double brackets) but still nothing happens :( Also it doesn't give any errors or etc. Please see the attachment.

I hope you have an idea.

Best,
Ozgun

--
You received this message because you are subscribed to a topic in the Google Groups "brainGraph-help" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/brainGraph-help/zgHOcnHenQQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to brainGraph-help+unsubscribe@googlegroups.com.

To post to this group, send email to brainGraph-help@googlegroups.com.
before.jpg

Chris Watson

unread,
Sep 22, 2016, 7:46:29 PM9/22/16
to brainGr...@googlegroups.com
So when you click "OK", no error is returned? After that, if you choose from the "Plot" pulldown to plot the entire graph, and then hit "OK" in the main GUI window, is there any error? Does the MNI brain at least appear in the window?

Could you run "devtools::sessionInfo()" and post the output? Please also make sure to update to the latest version, by "devtools::install_github('cwatson/brainGraph')"

özgün özalay

unread,
Sep 22, 2016, 8:03:02 PM9/22/16
to brainGr...@googlegroups.com
When i click "OK" , literally nothing happens. No MNI image or anything. I am attaching the screenshot after i click.

Here is the output of devtools::session_info()

Session info ------------------------------------------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.2.3 (2015-12-10)
system x86_64, linux-gnu
ui RStudio (0.99.903)
language en_US
collate en_US.UTF-8
tz <NA>
date 2016-09-23 Packages ----------------------------------------------------------------------------------------------------------------------------------------------------------
package * version date source
abind 1.4-5 2016-07-21 CRAN (R 3.2.3)
acepack 1.3-3.3 2014-11-24 CRAN (R 3.2.3)
ade4 1.7-4 2016-03-01 CRAN (R 3.2.3)
bitops 1.0-6 2013-08-17 CRAN (R 3.2.3)
boot 1.3-17 2015-06-29 CRAN (R 3.2.1)
brainGraph * 0.71.0 2016-09-22 Github (cwatson/brainGraph@d2a0a52)
cairoDevice * 2.23 2015-12-13 CRAN (R 3.2.3)
chron 2.3-47 2015-06-24 CRAN (R 3.2.3)
cluster 2.0.3 2015-07-21 CRAN (R 3.2.1)
codetools 0.2-14 2015-07-15 CRAN (R 3.2.1)
colorspace 1.2-6 2015-03-11 CRAN (R 3.2.3)
curl 2.0 2016-09-17 CRAN (R 3.2.3)
data.table 1.9.6 2015-09-19 CRAN (R 3.2.3)
devtools * 1.12.0 2016-06-24 CRAN (R 3.2.3)
digest 0.6.10 2016-08-02 CRAN (R 3.2.3)
foreach 1.4.3 2015-10-13 CRAN (R 3.2.3)
foreign 0.8-66 2015-08-19 CRAN (R 3.2.2)
Formula 1.2-1 2015-04-07 CRAN (R 3.2.3)
ggplot2 * 2.1.0 2016-03-01 CRAN (R 3.2.3)
git2r 0.15.0 2016-05-11 CRAN (R 3.2.3)
gridExtra * 2.2.1 2016-02-29 CRAN (R 3.2.3)
gtable 0.2.0 2016-02-26 CRAN (R 3.2.3)
Hmisc 3.17-4 2016-05-02 CRAN (R 3.2.3)
httr 1.2.1 2016-07-03 CRAN (R 3.2.3)
igraph * 1.0.1 2015-06-26 CRAN (R 3.2.3)
iterators 1.0.8 2015-10-13 CRAN (R 3.2.3)
lattice 0.20-33 2015-07-14 CRAN (R 3.2.1)
latticeExtra 0.6-28 2016-02-09 CRAN (R 3.2.3)
magrittr 1.5 2014-11-22 CRAN (R 3.2.3)
Matrix 1.2-3 2015-11-28 CRAN (R 3.2.2)
memoise 1.0.0 2016-01-29 CRAN (R 3.2.3)
munsell 0.4.3 2016-02-13 CRAN (R 3.2.3)
nnet 7.3-12 2016-02-02 CRAN (R 3.2.3)
oro.nifti 0.5.5.2 2016-07-24 CRAN (R 3.2.3)
pacman * 0.4.1 2016-03-30 CRAN (R 3.2.3)
permute 0.9-4 2016-09-09 CRAN (R 3.2.3)
plyr * 1.8.4 2016-06-08 CRAN (R 3.2.3)
R6 2.1.3 2016-08-19 CRAN (R 3.2.3)
RColorBrewer 1.1-2 2014-12-07 CRAN (R 3.2.3)
Rcpp 0.12.7 2016-09-05 CRAN (R 3.2.3)
RcppEigen 0.3.2.9.0 2016-08-21 CRAN (R 3.2.3)
reshape2 * 1.4.1 2014-12-06 CRAN (R 3.2.3)
RGtk2 * 2.20.31 2014-07-19 CRAN (R 3.2.3)
rpart 4.1-10 2015-06-29 CRAN (R 3.2.1)
scales 0.4.0 2016-02-26 CRAN (R 3.2.3)
stringi 1.1.1 2016-05-27 CRAN (R 3.2.3)
stringr 1.1.0 2016-08-19 CRAN (R 3.2.3)
survival 2.38-3 2015-07-02 CRAN (R 3.2.1)
withr 1.0.2 2016-06-20 CRAN (R 3.2.3)

I think maybe i have some Ubuntu packages missing. I've installed  r-cran-cairodevice (2.23-1) and r-cran-rgtk2 (2.20.31-1) from Ubuntu repositories but nothing changed :/
Btw i am using Ubuntu 16.04 LTS x64

Best,
Ozgun

after.jpg

Chris Watson

unread,
Sep 22, 2016, 10:36:00 PM9/22/16
to brainGr...@googlegroups.com
Hmm, I'm not sure what could be the problem.
First, try: devtools::install_github('rigraph/igraph')

Then I would suggest you try to see what GTK2 related packages are installed on your system. You should install, at least:
* gtk2
* gtk2-devel
* gtk2-engines
* gtk2-engines-devel

On Ubuntu they may be named differently (e.g. I think there is a "libgtk2.0-devel". However I don't think you would be missing those.

If it still doesn't work, you can send me the graph object. Save it as an RDS file by "saveRDS(g, file='g.rds')" and I can take a look.
Chris

Chris Watson

unread,
Sep 22, 2016, 10:36:36 PM9/22/16
to brainGr...@googlegroups.com
Actually, the command is: devtools::install_github('igraph/rigraph')

Chris Watson

unread,
Sep 22, 2016, 10:47:27 PM9/22/16
to brainGr...@googlegroups.com
One final thought, which may be a long shot, is that there is some sort of conflict with RStudio. So if all else fails, try running R from the command line, and see if the GUI works properly.

özgün özalay

unread,
Oct 2, 2016, 11:26:29 AM10/2/16
to brainGraph-help, cwa...@alum.mit.edu
Hi Chris,

Really I've tried everything to my knowledge. Nearly installed all available Gtk packages for Ubuntu, also I double checked R packages. But still couldn't get plot_brainGraph_gui() running. I also tried doing everything from just R console without RStudio. But...

I am attaching the file you asked for. Meantime I set up a virtual machine with ScientificLinux 7.2 as you suggested, I will try it too.

PS: plot_brainGraph_mni() works well.

Best wishes
Ozgun

--
You received this message because you are subscribed to a topic in the Google Groups "brainGraph-help" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/brainGraph-help/zgHOcnHenQQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to brainGraph-he...@googlegroups.com.

To post to this group, send email to brainGr...@googlegroups.com.

--
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.

--
You received this message because you are subscribed to a topic in the Google Groups "brainGraph-help" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/brainGraph-help/zgHOcnHenQQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to brainGraph-he...@googlegroups.com.

To post to this group, send email to brainGr...@googlegroups.com.

--
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.
g.rds

özgün özalay

unread,
Oct 4, 2016, 2:53:26 PM10/4/16
to brainGraph-help, cwa...@alum.mit.edu
Chris, finally i could get it running. After installing Fedora everything was ok but funny part is when i tried it again on Ubuntu it also worked :)

Anyway thank you so much for your help. We are starting to dig deeper in your toolbox, definitely will ask for your help again!

Thank you so much again!

Best
Ozgun

Chris Watson

unread,
Oct 4, 2016, 3:01:52 PM10/4/16
to brainGr...@googlegroups.com
I'm glad to hear it is working, and am just as confused as your are!

To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-help+unsubscribe@googlegroups.com.
To post to this group, send email to brainGraph-help@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/75053b03-3618-44b0-8fd8-5474b8c182f2%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages