CGI/Web Service
The CGI normally puts the generated image into NetCache and returns a JSON data structure that describes the image. This consists of data describing the image as a whole (like image key in the NetCache and dimensions of the generated image), information about all nodes that were drawn (node features and coordinates) and optionally the original BioTreeContainer that was used to draw the image.
If irrecoverable errors occur during generating the image, the CGI will report them in JSON fields err_code and err_msg.
JSON result fields
Formal definition
NCBI TreeView Objects Definitions
Overall image information
field | value description |
---|---|
img_key | NetCache ID (NCID) of the created image in memory; the image can be rerieved using ncfetch.cgi |
renderingparameters.width | image width as requested in the parameters |
renderingparameters.height | image height as requested in the parameters |
renderingparameters.maxwidth | maximal width that may be requested |
renderingparameters.maxheight | maximal height that may be requested |
renderingparameters.computedwidth | New size if dynamicviewport was true and the renderer chose a better size than requested |
renderingparameters.computedheight | New size if dynamicviewport was true and the renderer chose a better size than requested |
Error reporting
field | value description |
---|---|
err_code | 1: invalid parameters, 2: datasource read error, 3: OpenGL rendering error, 4: general error |
err_msg | Error message |
Node description
field | always present | value description |
---|---|---|
nodeid | yes | unique ID of the node |
is_leaf | yes | true if the node is a tree leaf |
bounds.x bounds.y |
yes | coordinate of the corner closest to the start of coordinate axes (top left if looking at the screen) |
bounds.width bounds.height |
yes | width and height are in the direction further along the axes from the start |
color | color of the node if different from other nodes | |
label | node label generated from node features using labelformat parameter (see also Tree shape and attributes) | |
seq_id | contents of “seq-id” feature (see Features with special meaning) | |
seq_title | contents of “seq-title” feature (see Features with special meaning) | |
accession_nbr | contents of “accession-nbr” feature (see Features with special meaning) |
Returned JSON example
{
“TV_TreeImgDesc”: {
“nodes”:[ {“nodeid”:”1”,”color”:”#00FF00”,”label”:”Green root”, "is_leaf": false,”bounds”: {"x":38,"y":48,"width":2,"height":2}},
{“nodeid”:”2”,”color”:”#0000FF”,”label”:”Blue leaf”, "is_leaf": true,”bounds”: {"x":10,"y":20,"width":2,"height":2}},
{“nodeid”:”3”,”color”:”#FF0000”,”label”:”Red leaf”, "is_leaf": true,”bounds”: {“x":58,"y":68, ,"width":2,"height":2}},
],
“img_key”: “NCID_1_14708_130.14.24.17_9103_1382728655_219332431”,
"renderingparameters": {
"width": 1000,
"height": 800,
"maxwidth": 250000,
"maxheight": 250000,
"computedwidth": 0,
" computedheight": 0
}
}
Table of Contents
- Tree Viewer documentation home
- Tree Viewer application home
- For Users
- User Tutorials
- For Developers
- Related Resources