[TODO] Selectable multiple attributes/colour per node

Visual manipulations and refinements
shambo
Posts: 4
Joined: 08 Jun 2011 18:45

[TODO] Selectable multiple attributes/colour per node

Post by shambo » 08 Jun 2011 19:01

Hi all,

I just started using Gephi yesterday, and I'm mightily impressed with what it can do. I need a bit of advice, and after reading a couple of posts on the forum I think what I'm about to ask cannot be done yet, so please treat it as a suggestion if this is true. I'm a biologist, and my situation is as follows.


I have a gene A connected to gene B, gene C, and gene D :
A->B
A->C
A->D

Genes B C and D have further attributes, in that B is physically bound by protein X and gene C is physically bound by X AND Y and D by Y only, so:

A->B(X)
A->C(XY)
A->D(Y)

Is there any way in Gephi to colour these X and Y types differently? I understand that node C will be a problem for now, and maybe one could select a "major" attribute which overrides all others?

Many thanks

User avatar
seinecle
Gephi Community Support
Posts: 546
Joined: 08 Feb 2010 16:55
Location: Lyon, France
Contact:

Re: Selectable multiple attributes/colour per node

Post by seinecle » 10 Jun 2011 08:30

Hi Shambo,

Cool use case! I suggest this road:

- assign the binding protein as an attribute to the edge between the two genes.
(Indeed, edges can have attributes. Look at the data laboratory, within it switch to the view of the list of edges. There, you will see that each edge can be enriched by attributes - simply add columns: one column per new attribute!)

- to do that, unluckily in Gephi's data laboratory there is no fast way to copy a node's attribute as an attribute for all edges in which this node participates. But this is very easy to do with a spreadsheet.
(for example, I use Excel. The "vlookup" function does the trick in 30 seconds. To export your nodes and edges in a spreadsheet, work on it and re-import it in Gephi's data lab, you can follow these detailed steps: http://tinyurl.com/5sqpa4s).

- go to the partition tab:
click on "edge", because you want to partititon on an edge's attribute
in the drop down menu, select your edge's attribute corresponding to the binding protein
apply the partition in ("apply" button at the bottom of the tab).

=> your edges will be colored according to the binding type. Note that these colors can be changed in the partitioning tab by clicking on each color patch next to each type of binding.

=> as a follow up, note also that you could also go in the filter tab, select "attribute", "partition", then select your edge's attribute. Drag and drop this filter in the bottom of the window: this will then allow you to keep in the window the network corresponding only to the type of binding you are interested in.

I hope it helps,

Best,

Clement

shambo
Posts: 4
Joined: 08 Jun 2011 18:45

Re: Selectable multiple attributes/colour per node

Post by shambo » 10 Jun 2011 12:21

Hi Clement,

Thanks very much for the suggestion, assigning attributes to edges isn't something I thought of. Can I just clarify something with you as I'm a little confused? Maybe I didn't explain the initial problem clearly.

The relationship between gene A and B denotes a mathematical measure of similarity between these 2 genes using "dataset 1". The fact B is bound by "some other protein X" comes from another source of data which isn't used as information to define the edge between A and B in the first place. This is why I was trying to assign the attributes to target nodes and not the edges because X and Y do not figure as nodes in the graph.

If it was the case that a target node could only be bound by one protein the solution would be simple and I could partition the data exactly as you described on a attribute per node basis. The issue comes when a target gene is bound by more than one protein which is the case for A->C.

Would I be right in saying that I should assign 2 attributes to the edge for A->C? I tried something similar by assigning 2 attributes to node C, but Gephi would not allow me to partition the data. It simply read as "null" where any node had more than one binding protein.

Sorry if you already understood this from my first post, I'm just a bit stumped as to how this should be implemented.

Many thanks,

Sham

User avatar
seinecle
Gephi Community Support
Posts: 546
Joined: 08 Feb 2010 16:55
Location: Lyon, France
Contact:

Re: Selectable multiple attributes/colour per node

Post by seinecle » 10 Jun 2011 14:12

Hi,

Indeed, I am not sure now what visualization you are after.

I mean precisely: how do you want to represent the bindings with several proteins (eg, X and Y): with a distinct color?
If yes, then your edge attribute should be:
binded by X only => attribute value is X
binded by Y only => attribute value is Y
binded by X and Y => attribute value is "XY"

The point is, you do not create two edges attribute for the XY case, but a single attribute called XY. Concretely, back to your spreadsheet, or with the datalaboratory acutally, you can represent each edge with the list of proteins binding them:
A -> B --- "X"
B-> C --- "Y"
A-> C --- "X" --- "Y"

And then you merge columns (easy on Excel or any spreadsheet where you can do operations on columns and strings):


A -> B --- "X"
B-> C --- "Y"
A-> C --- "XY"

This tabe is ready to be imported in the datalab of Gephi.

As I am not 100% sure that it answers your question, don't hesitate to post a reply if necessary!

Best,

Clement
PS: and btw: the relevance of the solution above depends a lot on how many proteins combinations are possible, and the frequency of these combinations. Worst case is: dozens of combinations, all equally infrequent. Then, assigning a color to each will (probably) result in a mess of edges of all colors: not informative. It would then be possible to investigate other approaches (still with Gephi!) more adequate to the problem.

shambo
Posts: 4
Joined: 08 Jun 2011 18:45

Re: Selectable multiple attributes/colour per node

Post by shambo » 16 Jun 2011 11:04

Hi Clement,

I understand now. Your solution is to make XY a single attribute, where what I was trying to achieve was setting X and Y as separate attributes to the same node, and then switch between the two regarding colour.

You're right in that the number of combination will dictate how complicated this gets, but in all I have about 5 different bound conditions, so this may get a little messy but I can give it a go and see what happens.

Thanks for your input!

Shamit

seppl12
Posts: 13
Joined: 18 Jun 2011 14:02
Location: Berlin, Germany
Contact:

Re: Selectable multiple attributes/colour per node

Post by seppl12 » 18 Jun 2011 14:14

Hi,

just to make sure that I understand correctly: there is no way in Gephi to color one node in two/three different colors? To make clear what I mean I attached an example.

Sorry for asking this here, but if gephi can't do this, which software can? I am only aware of the MultiColoredNodes Plugin for Cytoscape but I'm not a huge fan of Cytoscape and the export from this plugin is problematic.

Thanks in advance.
S
Attachments
Screen shot 2011-06-18 at 15.10.13.png
Cytoscape Example

User avatar
mbastian
Gephi Architect
Posts: 728
Joined: 10 Dec 2009 10:11
Location: San Francisco, CA

Re: Selectable multiple attributes/colour per node

Post by mbastian » 20 Jun 2011 03:26

just to make sure that I understand correctly: there is no way in Gephi to color one node in two/three different colors? To make clear what I mean I attached an example.
No, this is not possible. However a new Preview module is currently in development, with a modular architecture that will allow to create such features through plugins.

shambo
Posts: 4
Joined: 08 Jun 2011 18:45

Re: Selectable multiple attributes/colour per node

Post by shambo » 24 Jun 2011 16:56

Mathieu,

This would be an excellent addition to Gephi, thanks for telling us there is something in the pipeline. The case I described is very common in biology, and will only become more common place from what I can see. If this multiple-attribute per node issue could be addressed in Gephi I can only see it getting more popular amongst bioinformaticians.

seppl12: thanks for illustrating the point I was making, you're spot on.

Cheers,

Sham

User avatar
mbastian
Gephi Architect
Posts: 728
Joined: 10 Dec 2009 10:11
Location: San Francisco, CA

Re: [TODO] Selectable multiple attributes/colour per node

Post by mbastian » 28 Jan 2012 19:35

The new Preview is ready. This project is now feasable. Would love to guide anybody willing to implement that.

Ferretti
Posts: 14
Joined: 03 Feb 2012 19:49

Re: [TODO] Selectable multiple attributes/colour per node

Post by Ferretti » 03 Feb 2012 19:54

Hi, I am am computer science student currently working on a projet where I need to colour nodes as illustrated above. Currently I have implemented these multi-coloured nodes in JUNG, but JUNG is slow even on my 700 node graph and I am looking to increase to 15000+. I am very impressed with gephi's speed and interface, but I also need the multi-colouring feature!

I am certainly up for attempting this implementation but I need pointing where the addition to the code should go to allow me to colour nodes in this way. As I sid I have already implemented the code for JUNG so only minor changes should be needed to use it in gephi.

Post Reply