cytoscape / RCy3

New version of RCy3, redesigned and collaboratively maintained by Cytoscape developer community
MIT License
49 stars 20 forks source link

Functions to add #15

Closed AlexanderPico closed 3 years ago

AlexanderPico commented 6 years ago

Tools

Layout

AlexanderPico commented 6 years ago

User request: show expression values on top of the nodes as bar charts

Here are the steps:

style.name = 'default'
barchart =  list(cyrange = c(-2.426,3.126), cy_colors = c("#FF00FF","#8000FF","#00FF00"),cy_dataColumns = c("gal1RGexp","gal4RGexp","gal80Rexp"))
style.string = list(visualProperty = "NODE_CUSTOMGRAPHICS_1", value = paste("org.cytoscape.BarChart",toJSON(barchart),sep = ":"))
setVisualPropertyDefault(style.string, style.name)

You need to specify the min and max values in ‘cyrange’ and then pair the colors and columns you want in “cy_colors” and “cy_dataColumns”. Keep everything else the same and it should set the "Image/Chart 1” in the default style. Ah, and you’ll be to install/library the RJSONIO package for toJSON().

And another example using HeatMap. Note subtle parameter spelling diffs! Also note that the "up" color comes first, then "mid", "down" and "null".

heatstripes =  list(cy_range = c(-3.0,3.0), 
                    cy_orientation = "HORIZONTAL", 
                    cy_autoRange = "false",
                    cy_colorScheme = "CUSTOM",
                    cy_colors = c("#FF4040","#FFFFFF","#4040FF","#FFFFFF"),
                    cy_dataColumns = c( "medianDifference.myo.protein",
                                        "medianDifference.lowendo.protein",
                                        "medianDifference.norm.protein",
                                       "medianDifference.norm.rna"))
style.string = list(visualProperty = "NODE_CUSTOMGRAPHICS_1", value = paste("org.cytoscape.HeatMapChart",toJSON(heatstripes),sep = ":"))
setVisualPropertyDefault(style.string, style.name = "WikiPathways")
risserlin commented 5 years ago

getNetworkNames or getAllNetworkNames- returns all network names in the current session alternatively existsNetworkName. I just need a way to easily test the new network name before assigning it. Thanks, Ruth

AlexanderPico commented 5 years ago

Thanks Ruth! Ah, I think we've got that covered with getNetworkList()? That returns a list of all network names in the session. You should be able to perform a new name check as follows…

new.name %in% getNetworkList()

risserlin commented 5 years ago

Hi Alex, Do you have an example similar to your above examples of how to create a pie chart using RCy3? Thanks, Ruth

AlexanderPico commented 5 years ago

Even better. There are new methods the latest dev version (to be released tomorrow):

lorenzoFabbri commented 5 years ago

Tools

  • merge -- pending command support
  • network analyzer -- pending command support

Layout

  • clearEdgeBends --pending command support

Is there any news regarding the merge functionality? I need to take the union of many networks and doing that by hand would be excruciating.

AlexanderPico commented 5 years ago

I’m holding my breath too. There’s nothing I can do in the R package until the merge tool is supported by CyREST (via either commands or CyREST directly). I will propagate it to RCy3 once it’s possible.

You might look into reading the network into R as iGraphs and then performing the merge in R, then pushing out back to Cytoscape.

AlexanderPico commented 4 years ago

To be supported (finally) in Cytoscape 3.8 and this next release of RCy3: