Closed rmflight closed 2 years ago
Hi. This has been on the back burner. I wasn't sure custom image mapping was much in demand, to be honest. In fact, the entire custom image library system will likely be scrapped and simplified in Cytoscape 3.10. No one on the dev team could think of actual use cases for it and the code is old and brittle.
So, first off, knowing more about your use case would be of general interest to the dev team. At a minimum, we can make sure we don't break your use case and, at best, we might even improve it.
Next, these custom mappings (charts or images) are indeed tricky and very difficult to figure out in CyREST. That's a major motivation for the helper R and Python libraries, i.e., turning ~30 lines of code into a single line :)
It would take me a while to write a general purpose setNodeCustomImage() function, so it will likely wait until we've overhauled how the custom image library works. And you want something like setNodeCustomImageBypass(). I haven't written bypass helper functions for custom charts or images yet, so that will take some time as well.
But, in the meantime, I at least identified the key parts. Hopefully, this is enough for you to get stuff done:
So, this means that I can set this image using RCy3 by using this line:
setNodePropertyBypass("YNL216W","org.cytoscape.ding.customgraphics.bitmap.URLImageCustomGraphics,4,bundle://55.0:0/images/sampleCustomGraphics/Homo_sapiens_L.png,bitmap image","NODE_CUSTOMGRAPHICS_1")
Yeah, I know it's ugly. That's why I write the helper functions, so folks never have to see all the ugly bits!
This should work for any images to add to the custom library. If you want to use URLs for online images, then you'll have to try one manually and then check the value (like I did above) to figure out the pattern.
Hope this helps!
That helps a lot, thank you!
The motivation is that I have little pie charts I use for my package categoryCompare2 where the chunk of the chart indicates significance / non-significance in an experiment being compared to others.
It looks like a pie chart, but I don't think it's the kind that is easily rendered using the current pie chart functionality in Cytoscape.
Here you can see some examples.
These are from this poster.
I am fine using your example code to implement my own function in my package.
Cool! Thanks for sharing.
This is something you can do in Cytoscape. The trick is using the enhancedGraphics app, which offers a bit more customization than the built-in charts. Then you have to do a few "weird" steps...
The enhancedGraphics app will detect the special syntax in the passthrough on Image/Chart properties and construct the pie charts accordingly. See the app's web page for more options related to pie charts and other types.
Of course, steps 1-4 are all supported by RCy3. See:
That's beautiful @AlexanderPico, thanks.
I will definitely take that approach then.
In previous versions (perhaps even before RCy3), there was the abililty to set images for custom graphics via
setNodeImageDirect
I see that has gone by the wayside in favor of the built in charts. From what I can tell in Cytoscape itself this is possible, and I think the CyRest should still allow it, but I can't see just what attributes I'd need to munge in order to implement this.
Like I'd like to set a custom image in the graphics slot 1 for each node. I think I can do this using
setNodePropertyBypass
and theNODE_CUSTOM_GRAPHICS_*
visual property, but I'm honestly at a loss to see how exactly to code this.Any pointers would be greatly appreciated.