cytoscape / cytoscape-explore

Network visualization webapp.
MIT License
12 stars 4 forks source link

Miscellaneous fixes re. label mappings & CX routes #93

Closed d2fong closed 2 years ago

d2fong commented 2 years ago

General information

Add a name attribute to every created

NODE_STYLE_DEFAULTS have a passthrough mapping for node labels, using the name attribute, accessed by node.data('name'). See here The network editor does not instantiate any nodes with a name field. When the network is exported to CX, there will be a default label mapping to the name attribute but no node will have a name field.

This edit changes the controller logic to instantiate every node created in the network editor with a name attribute and a default value of empty string.

Re-add deleted cx import/export API endpoints

I also re-added the endpoints that I deleted before that allow import/export via the node API.

Checklist

Author:

Reviewers:

maxkfranz commented 2 years ago

NODE_STYLE_DEFAULTS have a passthrough mapping for node labels, using the name attribute, accessed by node.data('name').

I think Mike set that in anticipation for smart label presets (e.g. if you have a 'name' or 'protein name' attribute, then that should probably be used by default for the label). I don't think the expectation should be that the 'name' field is always used.

One alternative that would be simple and less error-prone for now would be for the label to fall back on the empty string if 'name' doesn't exist. Implicitly editing the user's data may cause unexpected consequences down the road.

@mikekucera, @d2fong, what do you think?

mikekucera commented 2 years ago

A default of an empty string sounds like the most reasonable thing. I'm not sure if cytoscape desktop users even use the name attribute for labels regularly. I've seen many networks that use other attributes for the label.

On Fri, Nov 5, 2021 at 4:04 PM Max Franz @.***> wrote:

NODE_STYLE_DEFAULTS have a passthrough mapping for node labels, using the name attribute, accessed by node.data('name').

I think Mike set that in anticipation for smart label presets (e.g. if you have a 'name' or 'protein name' attribute, then that should probably be used by default for the label). I don't think the expectation should be that the 'name' field is always used.

One alternative that would be simple and less error-prone for now would be for the label to fall back on the empty string if 'name' doesn't exist. Implicitly editing the user's data may cause unexpected consequences down the road.

@mikekucera https://github.com/mikekucera, @d2fong https://github.com/d2fong, what do you think?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cytoscape/cytoscape-explore/pull/93#issuecomment-962183542, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI2JAA72E6HX2UPFHKG4V3UKRBHJANCNFSM5HMJ2YOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

d2fong commented 2 years ago

Ok if that style default will eventually build into smart defaults, then we should not include that name attribute change. There are other ways that I can handle the default node label mapping when I export the network to CX.