Scripting / batch processing and web page use of Cytoscape.

115 views
Skip to first unread message

Douglas Sanders

unread,
Jun 1, 2015, 5:26:12 PM6/1/15
to cytoscape...@googlegroups.com
I am looking for someone to point me in the right direction for scripting and batch processing of Cytoscape.

I currently assemble my networks and set up edge attributes using R, then import the networks and tables for attributes into cytoscape.  If I want to use the same attributes / styles etc on a new network,  It seems I have to set this all up again in Cytoscape using pull down menus etc.    For instance if i want to start with 15 networks, I import them one by one, selecting columns for nodes, edge attributes for each network as I read them in, then at the end I read in a table where I set node attributes.  Ideally I'd do this once, record what I did with a session file of some sort, then repeatedly cut and paste these commands in a txt file (changing file name etc) - I am sure you know where I am trying to go with this.

Another thing I'd like to be able to do is to be able to read multiple networks in a single file, or maybe better put this way: read in one large network file, (first two columns are nodes) then use other columns (read in typically as edge attributes) to be used to filter it into multiple networks.   

The ultimate goal is to turn this all into a interactive web graphic/page where one can change selection criteria (in R but using a shiny app GUI), send the network to Cytoscape and have it automatically plot the network.   I've already figured out the R side of things (using Shiny) and of course I am probably doing things in R that I could do in Cytoscape but I am much more familiar with R.  

General direction at this point is what's needed.  I'd really like to be able to run a script that runs my R then runs Cytoscape such that if I want to make a change "at the top" so to speak in my R script everything else would simply be automated.

Thanks,

Doug Sanders
UCSF, Krogan Lab.

Scooter Morris

unread,
Jun 4, 2015, 10:02:53 AM6/4/15
to cytoscape...@googlegroups.com


On Monday, June 1, 2015 at 2:26:12 PM UTC-7, Douglas Sanders wrote:
I am looking for someone to point me in the right direction for scripting and batch processing of Cytoscape.

I currently assemble my networks and set up edge attributes using R, then import the networks and tables for attributes into cytoscape.  If I want to use the same attributes / styles etc on a new network,  It seems I have to set this all up again in Cytoscape using pull down menus etc.    For instance if i want to start with 15 networks, I import them one by one, selecting columns for nodes, edge attributes for each network as I read them in, then at the end I read in a table where I set node attributes.  Ideally I'd do this once, record what I did with a session file of some sort, then repeatedly cut and paste these commands in a txt file (changing file name etc) - I am sure you know where I am trying to go with this.
Well, the ability to "record" user actions as commands doesn't exist, but you can write script files and have Cytoscape execute them.  Take a look at "Tools-->Command Line Dialog".  That will give you some ideas on what commands are available and the syntax.  When the command works the way you want, you can just add it to your script.  Also note that you can send commands directly to Cytoscape through it's REST interface.  Currently there are two REST implementations (don't ask), one which will allow you to send and receive networks and tables as JSON -- this is called cyREST and you can get it from the App store.  The other is built-in and provides the ability to execute commands (essentially the same commands as the Command Line Dialog). 

Another thing I'd like to be able to do is to be able to read multiple networks in a single file, or maybe better put this way: read in one large network file, (first two columns are nodes) then use other columns (read in typically as edge attributes) to be used to filter it into multiple networks.   
You could certainly do that with a script.  Read in the large network, select the edges via attribute selection and select the adjacent nodes and then create a new network with those nodes and edges.

The ultimate goal is to turn this all into a interactive web graphic/page where one can change selection criteria (in R but using a shiny app GUI), send the network to Cytoscape and have it automatically plot the network.   I've already figured out the R side of things (using Shiny) and of course I am probably doing things in R that I could do in Cytoscape but I am much more familiar with R.  

General direction at this point is what's needed.  I'd really like to be able to run a script that runs my R then runs Cytoscape such that if I want to make a change "at the top" so to speak in my R script everything else would simply be automated.
Hope this helps!

-- scooter
Reply all
Reply to author
Forward
0 new messages