cytoscape.js - set depth in breathfirst layout

829 views
Skip to first unread message

Jia Ren

unread,
Apr 23, 2014, 11:48:01 PM4/23/14
to cytoscap...@googlegroups.com
I want to ask if there is a method to set depth to root in breathfirst layout in cytoscape.js. Just like the function in concentric layout:

 name: 'concentric',
 concentric: function(){ // returns numeric value for each node, placing higher nodes in levels towards the center
      return this.degree();
    },

The concentric function returns a distance of the nodes to the center. For breathfirst layout, I want to set depth for each node and put nodes with the same depth in one line(layer). 

I think this function will be very useful in displaying protein localization or any other tree structure. For example, in a cytoscape plugin Cerebral (http://www.pathogenomics.ca/cerebral/), we could arrange proteins based on their sub-cellular location, and layer different locations. It would be great if we could have similar layout in the web version.

Thanks!

Jia

Max Franz

unread,
Apr 24, 2014, 6:25:34 PM4/24/14
to cytoscap...@googlegroups.com
No, there’s nothing like that currently.  Concentric is a different case, because you set thresholds and all node values manually.  In BFS layout, you can set the roots, but the remaining nodes are placed based on hierarchy below them.  

By overriding the hierarchy for arbitrary levels, you bypass it such that you could contradict the hierarchy.  It also raises questions like “Should nodes down the hierarchy be placed in levels relative to the natural hierarchy or relative to the overridden hierarchy?"

I suppose the simplest solution for now would be to just override the hierarchy only for the specified nodes — that definitely works in the case where you set everything manually — but that probably won’t be enough for all the usecases that would use this feature (i.e. leaving some placement on the layout end).

Thoughts?

-Max
--
You received this message because you are subscribed to the Google Groups "cytoscape-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-disc...@googlegroups.com.
To post to this group, send email to cytoscap...@googlegroups.com.
Visit this group at http://groups.google.com/group/cytoscape-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages