AmiGO 2 Manual: Visualize Freeform

From GO Wiki
Jump to: navigation, search

Overview

This client page allows the users an easy interface for specifying and rendering an arbitrary graph (currently using a GraphViz dot backend) under an intermediate AmiGO layer for logic and ontology-specific settings. All graphs are defined using JSON blobs with a smattering of other arguments. The user may either select the output as a PNG image or SVG markup.

This client is a sibling of Visualize--you may want to check there for any questions not covered in this document.

Web API (experimental)

The AmiGO 2 "Visualize Freeform" client page is a very light wrapper around a RESTful graphing component. The API for it may be changed later on as we look at priorities.

This section aims to describe the current RESTful calls as they exist now (AmiGO 2 beta):

http://amigo2.berkeleybop.org/cgi-bin/amigo2/visualize_freeform

graph_data (required)

This is a simple JSON blob defining the graph topology. It is an object with two list entities: "nodes" and "edges". "nodes" is a list of node objects and "edges" is a list of edge objects.

A node object is required to have a unique string property "id" and an optional label string property "lbl".

An edge object is required to have a string property "sub" (subject), a string property "obj" (object), and an optional string property "pred" (predicate).

Example JSON

{"nodes":[{"id":"GO:0008150","lbl":"GO term"},{"id":"butter"}],"edges":[{"sub":"GO:0008150","obj":"butter"}]}

term_data (optional, no default)

term_data is a JSON blob for defining the styles (e.g. labels, font, color, etc.) of the graph. The contents is ignored when a node is not defined in the graph_data. The format is identical to the "advanced format" in Visualize--see the Visualize documentation under "Advanced format" for more details.

Example JSON

{"GO:0008150":{"title": "TERM",
               "body":  "hello",
               "fill":  "#ccccff",
               "font":  "#0000ff",
               "border":"red"}}

inline (optional, has default)

It specifies whether the returned image is intended for inline use (i.e. embedded in a web page) or standalone use (i.e. download or separate viewing). This is only really intended to be used with a "format" of "png".

true

The image is intended to be view by itself.

false

The image is intended to be embedded into another page.

format (optional, has default)

svg

Results as an interactive SVG (SVG+XML and JavaScript).

svg_raw

Results as raw SVG as returned my GraphViz.

png

Results as a PNG image. This is the default if "format" is not otherwise specified.

dot

Results in the GraphViz dot format.