Re: [Cytoscape-discuss] Visualize graph from inside Java

37 views
Skip to first unread message

Jason Montojo

unread,
May 23, 2013, 3:29:52 PM5/23/13
to cytoscap...@googlegroups.com
Hi Casper,

In Cytoscape 2.X, you can't just show the graph without loading the rest of Cytoscape.  That means you'd need to pop up the Cytoscape UI.

In Cytoscape 3, it's possible to configure a JPanel to show your network visualization without having to display any of the Cytoscape UI.  However, your code will need to be running in an OSGi environment (e.g. Eclipse's RCP, Apache Karaf/Felix).

Thanks,
Jason


On Thu, May 16, 2013 at 3:21 AM, Casper Petersen <casper...@gmail.com> wrote:
Consider the following code which is just a random collection of cytoscape example code:

        CyNetwork cyNetwork = Cytoscape.createNetwork("My Network");
        CyNode node0 = Cytoscape.getCyNode("rain", true);
        CyNode node1 = Cytoscape.getCyNode("rainbow", true);
        CyNode node2 = Cytoscape.getCyNode("rabbit", true);
        CyNode node3 = Cytoscape.getCyNode("yellow", true);

        cyNetwork.addNode(node0);
        cyNetwork.addNode(node1);
        cyNetwork.addNode(node2);
        cyNetwork.addNode(node3);

        CyEdge edge0 = Cytoscape.getCyEdge(node0, node1, Semantics.INTERACTION, "pp", true);
        CyEdge edge1 = Cytoscape.getCyEdge(node0, node2, Semantics.INTERACTION, "pp", true);
        CyEdge edge2 = Cytoscape.getCyEdge(node0, node3, Semantics.INTERACTION, "pp", true);
        cyNetwork.addEdge(edge0);
        cyNetwork.addEdge(edge1);
        cyNetwork.addEdge(edge2);
        CyNetworkView view = Cytoscape.createNetworkView( cyNetwork );

So far so good. My question then is: how do I actually show the network inside java? view does not seem to have any actions that makes much sense to me like:

view.setVisible() or view.showGraph();

My questions are:
1) Can it be true that there is /no/ way to show the graph inside java? That I have to somehow "load" cytoscape to do that?
2) If (1) is true, is there a way to just display the canvas that the graph is shown on and not all the menus and stuff?

Thanks in advance

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages