libsbgn.js

0.1.3

Standard SBGN

libsbgn

The API contains two other submodules: libsbgn.render and libsbgn.annot

libsbgn

Arc

Represents the <arc> element.

new Arc(params: Object)
Parameters
params (Object)
Name Description
params.id string?
params.class_ string?
params.source string?
params.target string?
params.start Start?
params.end End?
params.nexts Next?
params.glyphs Array<Glyph>? The arc's cardinality. Possibility to have more than one glyph is left open.
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
setStart(start)
setEnd(end)
addNext(next)
addGlyph(glyph)
buildJsObj()
toXML()

Arcgroup

Represents the <arcgroup> element.

new Arcgroup(params: Object)

Extends SBGNBase

Parameters
params (Object)
Name Description
params.class_ string?
params.glyphs Array<Glyph>?
params.arcs Array<Arc>?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
addGlyph(glyph)
addArc(arc)
buildJsObj()
toXML()

Bbox

Represents the <bbox> element.

new Bbox(params: Object)

Extends SBGNBase

Parameters
params (Object)
Name Description
params.x (string | number)?
params.y (string | number)?
params.w (string | number)?
params.h (string | number)?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
buildJsObj()
toXML()

Callout

Represents the <callout> element.

new Callout(params: Object)
Parameters
params (Object)
Name Description
params.target string?
params.point Point?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
setPoint(point)
buildJsObj()
toXML()

Clone

Represents the <clone> element.

new Clone(params: Object)
Parameters
params (Object)
Name Description
params.label string?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
setLabel(label)
buildJsObj()
toXML()

End

Represents the <end> element.

new End(params: Object)
Parameters
params (Object)
Name Description
params.x (string | number)?
params.y (string | number)?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
buildJsObj()
toXML()

Entity

Represents the <entity> element.

new Entity(params: Object)
Parameters
params (Object)
Name Description
params.name string?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
buildJsObj()
toXML()

Extension

Represents the <extension> element.

new Extension()
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
add(extension)
has(extensionName)
get(extensionName)
buildJsObj()
toXML()

Glyph

Represents the <glyph> element.

new Glyph(params: Object)

Extends SBGNBase

Parameters
params (Object)
Name Description
params.id string?
params.class_ string?
params.compartmentRef string?
params.compartmentOrder (string | number)?
params.mapRef string?
params.tagRef string?
params.orientation string?
params.label Label?
params.bbox Bbox?
params.state State?
params.clone Clone?
params.callout Callout?
params.entity Entity?
params.glyphMembers Array<Glyph>?
params.ports Array<Port>?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
setLabel(label)
setState(state)
setBbox(bbox)
setClone(clone)
setCallout(callout)
setEntity(entity)
addGlyphMember(glyphMember)
addPort(port)
buildJsObj()
toXML()

Label

Represents the <label> element.

new Label(params: Object)

Extends SBGNBase

Parameters
params (Object)
Name Description
params.text string?
params.bbox Bbox?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
setBbox(bbox)
buildJsObj()
toXML()

Map

Represents the <map> element.

new Map(params: Object)

Extends SBGNBase

Parameters
params (Object)
Name Description
params.id string?
params.language string?
params.version string?
params.glyphs Array<Glyph>?
params.arcs Array<Arc>?
params.bbox Bbox?
params.arcgroups Array<Arcgroup>?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
addGlyph(glyph)
addArc(arc)
setBbox(bbox)
addArcgroup(arcgroup, arc)
getGlyphsByClass(class_)
buildJsObj()
toXML()

Next

Represents the <next> element.

new Next(params: Object)
Parameters
params (Object)
Name Description
params.x (string | number)?
params.y (string | number)?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
buildJsObj()
toXML()

Notes

Represents the <notes> element. Its single content attribute stores xhtml elements as string.

new Notes()
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
setContent(string)
appendContent(string)
buildJsObj()
toXML()

Point

Represents the <point> element.

new Point(params: Object)
Parameters
params (Object)
Name Description
params.x (string | number)?
params.y (string | number)?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
buildJsObj()
toXML()

Port

Represents the <port> element.

new Port(params: Object)
Parameters
params (Object)
Name Description
params.id string?
params.x (string | number)?
params.y (string | number)?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
buildJsObj()
toXML()

Sbgn

Represents the <sbgn> element.

new Sbgn(params: Object)

Extends SBGNBase

Parameters
params (Object)
Name Description
params.xmlns string?
params.maps Array<Map>?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
addMap(map)
buildJsObj()
toXML()

SBGNBase

Parent class for several sbgn elements. Used to provide extension and notes element. End users don't need to interact with it. It can be safely ignored.

new SBGNBase(params: Object)
Parameters
params (Object)
Name Description
params.extension Extension?
params.notes Notes?
Instance Members
setExtension(extension)
setNotes(notes)
baseToJsObj(jsObj)
baseFromObj(jsObj)

Start

Represents the <start> element.

new Start(params: Object)
Parameters
params (Object)
Name Description
params.x (string | number)?
params.y (string | number)?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
buildJsObj()
toXML()

State

Represents the <state> element.

new State(params: Object)
Parameters
params (Object)
Name Description
params.value string?
params.variable string?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
buildJsObj()
toXML()

Render extension

libsbgn.render

This submodule contains the classes to manage the render extension's xml and some utility functions. It adds the ability to save the styles and colors used in an SBGN map, as features like background-color, border thickness or font properties are not part of the SBGN standard.

It is loosely based on the render extension of the SBML format. A subset of this specification has been adapted for SBGN-ML integration.

See Extension for more general information on extensions in the SBGN-ML format.

You can access the following classes like this: libsbgn.render.ColorDefinition

libsbgn.render

ColorDefinition

Represents the <colorDefinition> element.

new ColorDefinition(params: Object)
Parameters
params (Object)
Name Description
params.id string?
params.value string?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
buildJsObj()
toXML()

ListOfColorDefinitions

Represents the <listOfColorDefinitions> element.

new ListOfColorDefinitions()
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
addColorDefinition(colorDefinition)
getColorById(id)
getAllColors()
buildJsObj()
toXML()

ListOfStyles

Represents the <listOfStyles> element.

new ListOfStyles()
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
addStyle(style)
getStyleMap()
buildJsObj()
toXML()

RenderGroup

Represents the <g> element.

new RenderGroup(params: Object)
Parameters
params (Object)
Name Description
params.id string?
params.fontSize string?
params.fontFamily string?
params.fontWeight string?
params.fontStyle string?
params.textAnchor string?
params.vtextAnchor string?
params.fill string? The element's background color
params.stroke string? Border color for glyphs, line color for arcs.
params.strokeWidth string?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
buildJsObj()
toXML()

RenderInformation

Represents the <renderInformation> element.

new RenderInformation(params: Object)
Parameters
params (Object)
Name Description
params.id string?
params.name string?
params.programName string?
params.programVersion string?
params.backgroundColor string?
params.listOfColorDefinitions ListOfColorDefinitions?
params.listOfStyles ListOfStyles?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
setListOfColorDefinitions(listOfColorDefinitions)
setListOfStyles(listOfStyles)
buildJsObj()
toXML()

Style

Represents the <style> element.

new Style(params: Object)
Parameters
params (Object)
Name Description
params.id string?
params.name string?
params.idList string?
params.renderGroup RenderGroup?
Static Members
fromXML(string)
fromObj(jsObj)
Instance Members
setRenderGroup(renderGroup)
getIdListAsArray()
setIdListFromArray(idArray)
getStyleMap()
buildJsObj()
toXML()

Annotation extension

libsbgn.annot

This submodule manages the annotations extension. It adds the ability to save semantic data into SBGN-ML in the form of RDF elements. Any SBGN element that can host an extension tag can also get RDF annotations. This means that almost every element can get annotated.

The annotations here are intended to be used in two ways:

  • with controlled vocabulary and resources, as suggested by COMBINE, with the help of MIRIAM identifiers.
  • as a mean to attach arbitrary data in the form of key-value properties.

Controlled vocabulary

The formal way of using annotations is to use specific vocabulary with specific identifiers to provide additional information that can not be conveyed otherwise through the SBGN format. See --link to combine qualifiers-- and --link to identifiers.org and MIRIAM--- This was also based on the annotation extension of SBML --link to annotation proposal for SBML--

See Extension for more general information on extensions in the SBGN-ML format.

You can access the following classes like this: libsbgn.annot.Annotation

libsbgn.annot

Annotation

Represents the <annotation> element.

new Annotation(params: Object)
Parameters
params (Object)
Name Description
params.rdfElement RdfElement?
Instance Members
setRdfElement(rdfElement)
toXML()

RdfElement

Represents the <rd:RDFf> element.

new RdfElement(params: any)
Parameters
params (any)
Static Members
fromString(stringXml, xml)
Instance Members
toXML()

StateType

new StateType()
Deprecated: Replaced by State

CloneType

new CloneType()
Deprecated: Replaced by Clone

EntityType

new EntityType()
Deprecated: Replaced by Entity

StartType

new StartType()
Deprecated: Replaced by Start

EndType

new EndType()
Deprecated: Replaced by End

NextType

new NextType()
Deprecated: Replaced by Next

addCustomProperty

will add triples to represent key/value properties attached to the id kvObject can have one or multiple properties

addCustomProperty(graph: any, id: any, kvObject: any)
Parameters
graph (any)
id (any)
kvObject (any)

getRelationship

returns the id of a newly created blank node representing the HasProperty predicate if one already exists, returns its id returns array, potentially several SIO223 present

getRelationship(graph: any, id: any, relationship: any)
Parameters
graph (any)
id (any)
relationship (any)

addResource

kvobject contains biology qualifier as key and miriam resource as value

addResource(graph: any, id: any, kvObject: any)
Parameters
graph (any)
id (any)
kvObject (any)