cytoscape / cyREST

Core App: REST API module for Cytoscape
https://github.com/cytoscape/cyREST/wiki
MIT License
30 stars 13 forks source link

Get and set display coordinates #20

Closed bdemchak closed 7 years ago

bdemchak commented 7 years ago

Yingyao Zhou @ novartis asked that CyREST return and set node coordinates for a network in a view

dotasek commented 7 years ago

To get node coordinates, you can use the GET /v1/networks/{networkId}/views/{viewId}/{objectType}/{objectId} operation. This will return JSON that contains the X and Y coordinates of a node.

Example output:

[
 ...
 {
    "visualProperty": "NODE_X_LOCATION",
    "value": 2241.6135513198574
  },
  {
    "visualProperty": "NODE_Y_LOCATION",
    "value": 1633.343997926447
  },
  {
    "visualProperty": "NODE_Z_LOCATION",
    "value": 0
  }
]

Similarly, the PUT /v1/networks/{networkId}/views/{viewId}/{objectType}/{objectId} operation will set those visual properties.

Example input:

[
  {
    "visualProperty": "NODE_X_LOCATION",
    "value": 2000
  }
]
dotasek commented 7 years ago

Functionality already exists.