cytoscape / RCy3

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

How to apply layout with mapping to edge attribute? #59

Closed twesleyb closed 5 years ago

twesleyb commented 5 years ago

The RCy3 package is excellent, thank you!

I'd like to apply the perfuse force-directed layout with mapping to edge weight using RCy3. Is this possible?

I can apply the force-directed layout to my network with:

layoutNetwork(layout.name = "force-directed")

However, I can't figure out how to use my edge attribute weight in this layout. The cytoscape option 'Edge column that contains the weights:' is not listed with getLayoutPropertyNames(), so maybe this isn't possible?

getLayoutPropertyNames(layout.name = "force-directed")

[1] "numIterations" "defaultSpringCoefficient" "defaultSpringLength"
[4] "defaultNodeMass" "isDeterministic" "singlePartition"

Hopefully, I have not missed an obvious answer in the documentation, my apologies if I have.

AlexanderPico commented 5 years ago

Sorry for the delayed response! You found a bug in the valued returned by getLayoutPropertyNames. I'll get to fixing that soon. But, fortunately, in the meantime, you can do what and just ignore the truncated list of property names!

In general, you can always go to the source for the documentation on Commands based functions like this one. There are two ways to do this:

  1. In Cytoscape, View > Show Automation Panel. Then type `help layout force-directed' and you'll see all the properties (including the ones incorrectly truncated from the list you're getting.
  2. In RCy3, run commandsAPI() and you'll get the interactive Swagger version of the same docs.

You'll see that edgeAttribute is indeed available as a parameter that takes the name of an edge column with numeric values.

AlexanderPico commented 5 years ago

Dev Note: implementation depended on CyREST, which is source of bug: https://github.com/cytoscape/cyREST/issues/100

In the meantime, we can reimplement to use commandsHelp instead.

AlexanderPico commented 5 years ago

Fixed in version 2.4.1

twesleyb commented 5 years ago

Thank you Alexander!