concentric circle layout

69 views
Skip to first unread message

Ruth Isserlin

unread,
Jan 16, 2025, 9:40:02 AMJan 16
to cytoscape...@googlegroups.com
HI,
I know that there is a concentric circle layout in cytoscape.js but I would really like to use in cytoscape desktop.
Is there any combination of layouts that I can use to get the same general view? Ideally something I can do through cyrest.
Is there a way to set the radius potentially of the circle layout? or place nodes on angle based on a circle trajectory?

Or better yet, is there a way to layout the network in a hierarchical circle layout?

Thanks,
Ruth

Alex Pico

unread,
Jan 16, 2025, 2:37:31 PMJan 16
to cytoscape-helpdesk
Hi Ruth,

One idea would be to do the layout in Cytoscape Web and then save to NDEx and then open it in Cytoscape Desktop. Otherwise, I don’t know of any way to perform JS layouts in Desktop or vis CyREST. The cy.js layout has these options: https://js.cytoscape.org/#layouts/circle

- Alex

Christopher Churas

unread,
Jan 16, 2025, 2:53:15 PMJan 16
to cytoscape...@googlegroups.com
Hi Ruth & Alex,

Since it is possible to run cytoscape.js under node, I did build a docker container (prototype implementation) a while back that 
would take a CX file and run some of the basic cytoscape.js layouts and output an updated CX to standard out. 
The plan at the time was to get this up as a service so one could call cytoscape.js layouts via the Desktop, 
but I just didn't get a chance to finish that part. 

If you have docker (and intel architecture computer) you can run the container locally:
https://hub.docker.com/r/coleslawndex/cdcytojslayout


docker run -v <directory where cx file is>:<directory where cx file is> coleslawndex/cdcytojslayout:0.0.2 <full path to cx file> --layout circle > layoutupdated.cx

chris


--
You received this message because you are subscribed to the Google Groups "cytoscape-helpdesk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-helpd...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cytoscape-helpdesk/DAB1A7C9-AFAA-4B5E-B7B4-CF945CCA6E52%40gladstone.ucsf.edu.

Ruth Isserlin

unread,
Jan 16, 2025, 2:56:17 PMJan 16
to cytoscape...@googlegroups.com
HI Chris, 
Thanks.  I will check it out.  
What is a CX file?  Is that a file that I can export from the desktop?
Thanks, 
Ruth 

Ruth Isserlin

unread,
Jan 16, 2025, 3:01:46 PMJan 16
to cytoscape...@googlegroups.com
on a completely different subject, I am having difficulty wrapping my head around how best to use cytoscape.js.  I have exported my cytoscape desktop network as a website and have been experimenting with the files that are generated.  
Is there a tutorial or step by step on “How can I visualize my cytoscape network as cytoscape.js and use all the cool features of js” protocol that I can use?

thanks, 
Ruth 


Christopher Churas

unread,
Jan 16, 2025, 3:17:00 PMJan 16
to cytoscape...@googlegroups.com
Hi,
A CX file is a json file used by NDEx to represent networks, it keeps layout and style. 

Yes you can get the CX file from Cytoscape Desktop a couple ways:

1) Via Menu File > Export > Network to File...
and in the Export File Format dropdown choose CX JSON (.cx)

2) Via CyREST and/or py4cytoscape
Use export_network and set type to 'CX'
https://py4cytoscape.readthedocs.io/en/latest/reference/generated/py4cytoscape.networks.export_network.html#py4cytoscape.networks.export_network
or directly (need to get suid of network in case below it is 5028)
curl -X GET --header 'Accept: application/json' 'http://localhost:1234/v1/networks/5028.cx?version=1'

You can then load the new CX file via py4cytoscape or File > Import > Network from File ...

hope this helps,

chris

Balasubramaniam Namasivayam

unread,
Jan 17, 2025, 4:53:13 AMJan 17
to cytoscape-helpdesk
Hi Ruth,

For the concentric layout in cytoscape part, I usually do it for nodes in a big cluster in the following way. First I select a few nodes (n=5) and arrange them in Attribute circle layout for selected nodes only. Then I select more number of nodes (incremented by c=5) than the number of nodes in first selection (n=n+c=10) and repeat the layout. I do it incrementally (n=15,20..) and arrange them in circular layout iteratively until all the nodes in the cluster/ network is laid out. I select the nodes manually and arrange them using RCy3 thanks to your earlier tip.

I will send you a sample image separately.

Probably you already know this but just in case.

Kind regards,
Bala

Hasan Balcı

unread,
Jan 17, 2025, 8:37:18 AMJan 17
to cytoscape-helpdesk
Hi all,

Last summer, we developed a Cytoscape app CytoJSLayout as part of the Google Summer of Code that allows applying Cytoscape.js layouts on the desktop app. It is not fully completed and tested, so we haven't published it in the app store yet, but we're still working on it. Normally it supports many Cytoscape.js layouts but currently there is only interface for fcose, cola, cise, dagre and avsdf layouts, so only these layouts are active (unfortunately interface for concentric layout is not available yet but it should be easy to add).

The idea is to get graph data and layout options from Cytoscape, sent it to SyBLaRS for the layout and then update the graph with the returned node positions. SyBLaRS is a web service to lay out graphs in SBGNML, SBML, GraphML and Cytoscape.js JSON formats and/or produce corresponding images (in JPG, PNG or SVG formats) of the layouts in the backend. It can be installed locally or there is a running instance which CytoJSLayout also currently uses to send queries here: https://syblars.cs.bilkent.edu.tr/

To summarize, CytoJSLayout does not currently support concentric layout, but will in the future. Alternatively, SyBLaRS as a web service could be an alternative, though not directly through Cytoscape at the moment. I hope it helps.

Best,
Hasan Balci

Hasan Balcı

unread,
Jan 17, 2025, 11:19:04 AMJan 17
to cytoscape-helpdesk
Hi all,

Last summer, we developed a Cytoscape app CytoJSLayout as part of the Google Summer of Code that allows applying Cytoscape.js layouts in Cytoscape desktop app. Since it is not fully completed and tested, we have not published it yet on the app store, but we are still working on it. It normally supports many Cytoscape.js layouts, but currently it only has interfaces for fcose, cola, cise, dagre and avsdf layouts, so only these layouts are active (unfortunately there is no interface for concentric layout yet, but it should be easy to add). 

The idea is to get the graph data and layout options from Cytoscape, send a query to SyBLaRS for the layout and then updating the graph based on returned node positions. SyBLaRS is a web service to lay out graphs in SBGNML, SBML, GraphML and Cytoscape JSON formats and/or produce corresponding images (in JPG, PNG or SVG formats) of the layouts in the backend. It can be deployed locally or there is also a running instance available at: https://syblars.cs.bilkent.edu.tr/ which CytoJSLayout is currently using to make queries.

To summarize, CytoJSLayout does not currently support concentric layout, but will in the future. Alternatively, SyBLaRS as a web service could be an alternative, though not directly through Cytoscape at the moment. I hope it helps.

Best,
Hasan Balci



On Friday, January 17, 2025 at 4:53:13 AM UTC-5 Balasubramaniam Namasivayam wrote:

Ruth Isserlin

unread,
Jan 20, 2025, 9:58:23 AMJan 20
to cytoscape...@googlegroups.com
Hi Chris,
Thanks. The cdcytojslayout docker worked. When I ran it it created a new file with just the node positions from the new layout specified that I then had to replace in the original .cx file I exported from Cytoscape and reload into Cytoscape. Is that by design or is there a way to run it so that it generates the complete updated .cx file?
Thanks,
Ruth
> To view this discussion visit https://groups.google.com/d/msgid/cytoscape-helpdesk/CAOHW_pfFtuZFTfO302ocdBFH8szM8ch57qK-a96NgaJoLcVr6A%40mail.gmail.com.

Ruth Isserlin

unread,
Jan 20, 2025, 10:02:41 AMJan 20
to cytoscape...@googlegroups.com
Thanks everyone for all the different solutions.  Looks like something a lot of people are using.  It would be great if this layout could be incorporated into the desktop app. 
Thanks,
Ruth 

On Jan 17, 2025, at 8:12 AM, Hasan Balcı <balcih...@gmail.com> wrote:

You don't often get email from balcih...@gmail.com. Learn why this is important
--
You received this message because you are subscribed to the Google Groups "cytoscape-helpdesk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-helpd...@googlegroups.com.

Christopher Churas

unread,
Jan 22, 2025, 1:14:54 PMJan 22
to cytoscape...@googlegroups.com
Hi,
Oops, yes that tool just outputs the layout coordinates by design. Figured it was more efficient. Currently that container does not have an option to return the full CX with layout coordinates, but a little chatgpt magic should be able to add that support with a flag. Let me try to do that.

chris

Christopher Churas

unread,
Jan 22, 2025, 4:40:51 PMJan 22
to cytoscape...@googlegroups.com
Hi Ruth,

Okay that took a lot of correcting of chatgpt output, but got a prototype working. 

If you add --outputcx to command line the 0.0.3 container will output the full CX (this is brittle):

docker pull coleslawndex/cdcytojslayout:0.0.3

Example invocation:

docker run --rm -v `pwd`:`pwd` coleslawndex/cdcytojslayout:0.0.3 `pwd`/original.cx --outputcx > res.cx

chris
Reply all
Reply to author
Forward
0 new messages