libSBNW
All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Modules Pages
Classes | Typedefs | Enumerations | Functions
External C API

Classes

struct  gf_network
 A reaction network. More...
 
struct  gf_node
 A species in a model. More...
 
struct  gf_reaction
 A reaction in a model. More...
 
struct  gf_curve
 A 2D cubic Bezier curve. More...
 
struct  gf_compartment
 A compartment in a model. More...
 
struct  gf_canvas
 Drawing canvas. More...
 
struct  gf_layoutInfo
 Type which holds layout info. More...
 
struct  gf_point
 A point in 2D space. More...
 
struct  gf_transform
 A 2D affine transform. More...
 
struct  gf_curveCP
 A curve control points. More...
 
struct  __fr_options
 Options passed to the Fruchterman-Reingold algorithm. More...
 

Typedefs

typedef struct __fr_options fr_options
 Options passed to the Fruchterman-Reingold algorithm. More...
 

Enumerations

enum  gf_specRole {
  GF_ROLE_SUBSTRATE, GF_ROLE_PRODUCT, GF_ROLE_SIDESUBSTRATE, GF_ROLE_SIDEPRODUCT,
  GF_ROLE_MODIFIER, GF_ROLE_ACTIVATOR, GF_ROLE_INHIBITOR
}
 Species role in a reaction. More...
 

Functions

_GraphfabExport char * gf_getLastError ()
 Gets the last error. More...
 
_GraphfabExport int gf_haveError ()
 Gets whether an error occurred. More...
 
_GraphfabExport void gf_clearError ()
 Clears the last error.
 
_GraphfabExport const char * gf_renderTikZ (gf_layoutInfo *l)
 Render the model as a TikZ image. More...
 
_GraphfabExport int gf_renderTikZFile (gf_layoutInfo *l, const char *filename)
 Render the model as a TikZ image. More...
 
_GraphfabExport void gf_freeLayoutInfo (gf_layoutInfo *l)
 Call to clean up an instance of gf_layoutInfo when it is no longer needed. More...
 
_GraphfabExport void gf_freeLayoutInfoHierarch (gf_layoutInfo *l)
 Call to clean up an instance of gf_layoutInfo and all contained data structures. More...
 
_GraphfabExport void gf_freeModelAndLayout (gf_SBMLModel *mod, gf_layoutInfo *l)
 Call to clean up an instance of gf_layoutInfo and gf_SBMLModel when they are no longer needed. More...
 
_GraphfabExport gf_SBMLModelgf_SBMLModel_newp ()
 Create a new SBML model. More...
 
_GraphfabExport gf_layoutInfogf_layoutInfo_newp (uint64_t level, uint64_t version, uint64_t width, uint64_t height)
 Create a new layout info object. More...
 
_GraphfabExport gf_layoutInfogf_processLayout (gf_SBMLModel *lo)
 Process the layout info from a document. More...
 
_GraphfabExport void gf_setModelNamespace (gf_layoutInfo *l, unsigned long level, unsigned long version)
 Set the level and version of the SBML. More...
 
_GraphfabExport const char * gf_getDefaultCompartmentId ()
 Get the id of the default SBML compartment. More...
 
_GraphfabExport void gf_setDefaultCompartmentId (const char *id)
 Set the id of the default SBML compartment. More...
 
_GraphfabExport gf_networkgf_getNetworkp (gf_layoutInfo *l)
 Get the network associated with the model. More...
 
_GraphfabExport void gf_clearNetwork (gf_network *n)
 Clear the network - does not deallocate. More...
 
_GraphfabExport void gf_releaseNetwork (gf_network *n)
 Release the network. More...
 
_GraphfabExport char * gf_nw_getId (gf_network *n)
 Get the id of the network (i.e. the SBML model) More...
 
_GraphfabExport void gf_nw_setId (gf_network *n, const char *id)
 Set the id of the network (via the SBML model) More...
 
_GraphfabExport uint64_t gf_nw_getNumNodes (const gf_network *n)
 Get the number of nodes. More...
 
_GraphfabExport uint64_t gf_nw_getNumUniqueNodes (const gf_network *n)
 Get the number of unique nodes. More...
 
_GraphfabExport uint64_t gf_nw_getNumRxns (const gf_network *n)
 Get the number of reactions. More...
 
_GraphfabExport uint64_t gf_nw_getNumComps (const gf_network *n)
 Get the number of compartments. More...
 
_GraphfabExport gf_nodegf_nw_getNodep (gf_network *n, uint64_t i)
 Get the node at index i. More...
 
_GraphfabExport gf_nodegf_nw_getUniqueNodep (gf_network *n, uint64_t i)
 Get the node at index i. More...
 
_GraphfabExport gf_nodegf_nw_getNodepFromId (gf_network *nw, const char *id)
 Get the node with the given id. More...
 
_GraphfabExport gf_reactiongf_nw_getRxnp (gf_network *n, uint64_t i)
 Get the node at index i. More...
 
_GraphfabExport void gf_nw_removeRxn (gf_network *n, gf_reaction *r)
 Remove the given reaction. More...
 
_GraphfabExport gf_compartmentgf_nw_getCompartmentp (gf_network *n, uint64_t i)
 Get the compartment at index i. More...
 
_GraphfabExport gf_compartmentgf_nw_findCompartmentById (gf_network *n, const char *id)
 Find a compartment by id. More...
 
_GraphfabExport void gf_nw_rebuildCurves (gf_network *n)
 Rebuild all curves in the network. More...
 
_GraphfabExport void gf_nw_recenterJunctions (gf_network *n)
 Recenter reaction junctions. More...
 
_GraphfabExport gf_compartmentgf_nw_newCompartmentp (gf_network *nw, const char *id, const char *name)
 Add a new compartment to the network. More...
 
_GraphfabExport gf_nodegf_nw_newNodep (gf_network *nw, const char *id, const char *name, gf_compartment *compartment)
 Add a new node to the network. More...
 
_GraphfabExport gf_nodegf_nw_newAliasNodep (gf_network *nw, gf_node *source)
 Create and add an alias node from a given source node. More...
 
_GraphfabExport int gf_nw_removeNode (gf_network *nw, gf_node *node)
 Remove a node from the network. More...
 
_GraphfabExport int gf_nw_connectNode (gf_network *nw, gf_node *node, gf_reaction *reaction, gf_specRole role)
 Connect a node to a reaction. More...
 
_GraphfabExport int gf_nw_connectNodeRoleStr (gf_network *nw, gf_node *n, gf_reaction *r, const char *role_str)
 Connect a node to a reaction. More...
 
_GraphfabExport int gf_nw_isNodeConnected (gf_network *nw, gf_node *node, gf_reaction *reaction)
 Return whether the given node is connected to the given reaction. More...
 
_GraphfabExport int gf_nw_isLayoutSpecified (gf_network *nw)
 Did the SBML model include layout? More...
 
_GraphfabExport int gf_nw_getNumAliasInstances (gf_network *nw, gf_node *n)
 Get the number of instances of the node. More...
 
_GraphfabExport gf_nodegf_nw_getAliasInstancep (gf_network *nw, gf_node *n, uint64_t i)
 Get the ith instance of an aliased node. More...
 
_GraphfabExport void gf_node_setCompartment (gf_node *n, gf_compartment *c)
 Add a node to a compartment. More...
 
_GraphfabExport void gf_releaseNode (const gf_node *n)
 Release the node. More...
 
_GraphfabExport int gf_node_isLocked (gf_node *n)
 Is the node locked? More...
 
_GraphfabExport void gf_node_lock (gf_node *n)
 Lock the node. More...
 
_GraphfabExport void gf_node_unlock (gf_node *n)
 Unlock the node. More...
 
_GraphfabExport int gf_node_make_alias (gf_node *n, gf_network *m)
 Create aliases of a given node. More...
 
_GraphfabExport int gf_node_isAliased (gf_node *n)
 Is the node aliased? More...
 
_GraphfabExport gf_point gf_node_getCentroid (gf_node *n)
 Get the centroid of the node. More...
 
_GraphfabExport void gf_node_getCentroidXY (gf_node *n, double *x, double *y)
 Get the centroid of the node. More...
 
_GraphfabExport void gf_node_setCentroid (gf_node *n, gf_point p)
 Set the centroid of the node. More...
 
_GraphfabExport double gf_node_getWidth (gf_node *n)
 Get the width of the node. More...
 
_GraphfabExport void gf_node_setWidth (gf_node *n, double width)
 Set the width of the node. More...
 
_GraphfabExport double gf_node_getHeight (gf_node *n)
 Get the height of the node. More...
 
_GraphfabExport void gf_node_setHeight (gf_node *n, double height)
 Set the height of the node. More...
 
_GraphfabExport char * gf_node_getID (gf_node *n)
 Get the id, user frees memory. More...
 
_GraphfabExport void gf_node_setID (gf_node *n, const char *id)
 Get the id, user frees memory. More...
 
_GraphfabExport const char * gf_node_getName (gf_node *n)
 Get the name, client must free memory. More...
 
_GraphfabExport void gf_node_setName (gf_node *n, const char *name)
 Set the name of a node. More...
 
_GraphfabExport int gf_node_getConnectedReactions (gf_node *n, gf_network *m, unsigned int *num, gf_reaction **rxns)
 Get a list of all reactions connected to the node. More...
 
_GraphfabExport int gf_node_getAttachedCurves (gf_node *n, gf_network *m, unsigned int *num, gf_curve **curves)
 Get a list of all curves connected to the node. More...
 
_GraphfabExport int gf_nw_nodeHasCompartment (gf_network *nw, gf_node *x)
 Return true if the node has a compartment assigned. More...
 
_GraphfabExport gf_compartmentgf_nw_nodeGetCompartment (gf_network *nw, gf_node *x)
 Get the compartment which contains node x. More...
 
_GraphfabExport void gf_releaseRxn (const gf_reaction *r)
 Release the reaction. More...
 
_GraphfabExport gf_reactiongf_nw_newReactionp (gf_network *nw, const char *id, const char *name)
 Add a new reaction to the network. More...
 
_GraphfabExport char * gf_reaction_getID (gf_reaction *r)
 Get the id, user frees memory. More...
 
_GraphfabExport gf_point gf_reaction_getCentroid (gf_reaction *r)
 Get the centroid of the reaction. More...
 
_GraphfabExport void gf_reaction_setCentroid (gf_reaction *r, gf_point p)
 Set the centroid of the reaction. More...
 
_GraphfabExport uint64_t gf_reaction_getNumSpec (const gf_reaction *r)
 Get the number of species in the reaction. More...
 
_GraphfabExport int gf_reaction_hasSpec (const gf_reaction *r, const gf_node *n)
 Return true if the reaction has the given species. More...
 
_GraphfabExport gf_specRole gf_reaction_getSpecRole (const gf_reaction *r, uint64_t i)
 Get the role for spec i. More...
 
_GraphfabExport const char * gf_roleToStr (gf_specRole role)
 Convert role to string. More...
 
_GraphfabExport gf_specRole gf_strToRole (const char *str)
 Convert string to role. More...
 
_GraphfabExport uint64_t gf_reaction_specGeti (const gf_reaction *r, uint64_t i)
 Get the global index of a reactant/product/participant given its local index in a reaction. More...
 
_GraphfabExport uint64_t gf_reaction_getNumCurves (const gf_reaction *r)
 Get the number of curves in the reaction. More...
 
_GraphfabExport gf_curvegf_reaction_getCurvep (const gf_reaction *r, uint64_t i)
 Get the curve i. More...
 
_GraphfabExport void gf_reaction_recenter (gf_reaction *r)
 Recenter reaction centroid. More...
 
_GraphfabExport void gf_reaction_recalcCurveCPs (gf_reaction *r)
 Recalculate the curve CPs, don't recenter. More...
 
_GraphfabExport void gf_releaseCurve (const gf_curve *c)
 Release the curve. More...
 
_GraphfabExport gf_specRole gf_curve_getRole (gf_curve *c)
 Get the id, user frees memory. More...
 
_GraphfabExport gf_curveCP gf_getCurveCPs (const gf_curve *c)
 Get the CPs for the curve. More...
 
_GraphfabExport int gf_curve_hasArrowhead (const gf_curve *c)
 Returns true if the given curve should be drawn with an arrowhead. More...
 
_GraphfabExport int gf_curve_getArrowheadVerts (const gf_curve *c, unsigned int *n, gf_point **v)
 Get the vertices for the curve's arrowhead. More...
 
_GraphfabExport void gf_releaseCompartment (const gf_compartment *c)
 Release a compartment object. More...
 
_GraphfabExport char * gf_compartment_getID (gf_compartment *c)
 Get the id, user frees memory. More...
 
_GraphfabExport gf_point gf_compartment_getMinCorner (gf_compartment *c)
 Get the "upper left" corner. More...
 
_GraphfabExport void gf_compartment_setMinCorner (gf_compartment *c, gf_point p)
 Set the "upper left" corner. More...
 
_GraphfabExport gf_point gf_compartment_getMaxCorner (gf_compartment *c)
 Get the "lower right" corner. More...
 
_GraphfabExport void gf_compartment_setMaxCorner (gf_compartment *c, gf_point p)
 Set the "lower right" corner. More...
 
_GraphfabExport double gf_compartment_getWidth (gf_compartment *c)
 Get the width of the compartment. More...
 
_GraphfabExport double gf_compartment_getHeight (gf_compartment *c)
 Get the height of the compartment. More...
 
_GraphfabExport uint64_t gf_compartment_getNumElt (gf_compartment *c)
 Get the number of species in the compartment. More...
 
_GraphfabExport int gf_compartment_addNode (gf_compartment *c, gf_node *n)
 Add a node to the compartment. More...
 
_GraphfabExport int gf_compartment_removeNode (gf_compartment *c, gf_node *n)
 Remove a node from the compartment. More...
 
_GraphfabExport int gf_compartment_containsNode (gf_compartment *c, gf_node *n)
 Return whether the compartment contains this node. More...
 
_GraphfabExport int gf_compartment_containsReaction (gf_compartment *c, gf_reaction *r)
 Return whether the compartment contains this node. More...
 
_GraphfabExport void gf_fit_to_window (gf_layoutInfo *l, double left, double top, double right, double bottom)
 Fit to the specified window. More...
 
_GraphfabExport gf_transformgf_tf_fitToWindow (gf_layoutInfo *l, double left, double top, double right, double bottom)
 Fit to the specified window (do not apply transform) More...
 
_GraphfabExport void gf_moveNetworkToFirstQuad (gf_layoutInfo *l, double x_disp, double y_disp)
 Move the entire network to the first quadrant. More...
 
_GraphfabExport CPoint gf_tf_apply_to_point (gf_transform *tf, CPoint p)
 Apply transform to point. More...
 
_GraphfabExport gf_point gf_tf_getScale (gf_transform *tf)
 Get the scale of the transform. More...
 
_GraphfabExport gf_point gf_tf_getDisplacement (gf_transform *tf)
 Get the displacement of the transform. More...
 
_GraphfabExport gf_point gf_tf_getPostDisplacement (gf_transform *tf)
 Get the displacement component of the transform. More...
 
_GraphfabExport void gf_release_transform (gf_transform *tf)
 Release transform. More...
 
_GraphfabExport gf_canvasgf_getCanvasp (gf_layoutInfo *l)
 Get the canvas associated with the model. More...
 
_GraphfabExport void gf_clearCanvas (gf_canvas *c)
 Get the canvas associated with the model. More...
 
_GraphfabExport void gf_releaseCanvas (gf_canvas *c)
 Release the canvas. More...
 
_GraphfabExport unsigned int gf_canvGetWidth (gf_canvas *c)
 Get the width of the canvas. More...
 
_GraphfabExport unsigned int gf_canvGetHeight (gf_canvas *c)
 Get the height of the canvas. More...
 
_GraphfabExport void gf_canvSetWidth (gf_canvas *c, unsigned long width)
 Set the width of the canvas. More...
 
_GraphfabExport void gf_canvSetHeight (gf_canvas *c, unsigned long height)
 Set the height of the canvas. More...
 
_GraphfabExport void gf_aliasNodebyDegree (gf_layoutInfo *l, const int minDegree)
 Create node aliases by node degree. More...
 
_GraphfabExport void gf_randomizeLayout (gf_layoutInfo *m)
 Randomize node positions. More...
 
_GraphfabExport void gf_randomizeLayout2 (gf_network *n, gf_canvas *c)
 Randomize node positions for a given network & canvas. More...
 
_GraphfabExport void gf_randomizeLayout_fromExtents (gf_network *n, double left, double top, double right, double bottom)
 Randomize node positions for a given network & extents. More...
 
_GraphfabExport int gf_writeSBMLwithLayout (const char *filename, gf_SBMLModel *m, gf_layoutInfo *l)
 Write an SBML file, including layout. More...
 
_GraphfabExport int gf_writeSBML (const char *filename, gf_SBMLModel *m)
 Write an SBML file (does not include layout. More...
 
_GraphfabExport const char * gf_getSBMLwithLayoutStr (gf_SBMLModel *m, gf_layoutInfo *l)
 String version of writeSBMLwithLayout. More...
 
_GraphfabExport const char * gf_getCurrentLibraryVersion (void)
 Returns the current version of the library. More...
 
_GraphfabExport void gf_free (void *x)
 Frees the memory block at x. More...
 
_GraphfabExport gf_point gf_computeCubicBezierPoint (gf_curveCP *c, Real t)
 Compute a point on the parametric curve. More...
 
_GraphfabExport gf_pointgf_computeCubicBezierLineIntersec (gf_curveCP *c, gf_point *line_start, gf_point *line_end)
 Compute the intersection between a cubic Bezier and a line. More...
 
_GraphfabExport int gf_arrowheadStyleGetNumVerts (int style)
 Get the number of vertices in the arrowhead polygon. More...
 
_GraphfabExport gf_point gf_arrowheadStyleGetVert (int style, int n)
 Get the nth vertex of the arrow polygon. More...
 
_GraphfabExport int gf_arrowheadStyleIsFilled (int style)
 Is the given style filled? More...
 
_GraphfabExport unsigned long gf_arrowheadNumStyles ()
 Get the number of arrowhead styles. More...
 
_GraphfabExport void gf_arrowheadSetStyle (gf_specRole role, int style)
 Set the arrowhead style for a specific role type. More...
 
_GraphfabExport int gf_arrowheadGetStyle (gf_specRole role)
 Get the style for the role type. More...
 
_GraphfabExport void gf_doLayoutAlgorithm (fr_options opt, gf_layoutInfo *l)
 Run the autolayout (Fruchterman-Reingold) algorithm on a given layout structure. More...
 
_GraphfabExport void gf_doLayoutAlgorithm2 (fr_options opt, gf_network *n, gf_canvas *c)
 Run the autolayout (Fruchterman-Reingold) algorithm on a a network and optional canvas. More...
 
_GraphfabExport void gf_getLayoutOptDefaults (fr_options *opt)
 Generate default values for the layout options. More...
 
_GraphfabExport void gf_layout_setStiffness (fr_options *opt, double k)
 Set the stiffness for the FR algorithm. More...
 
_GraphfabExport void gf_freeSBMLModel (gf_SBMLModel *lo)
 Destructor for gf_SBMLModel. More...
 
_GraphfabExport gf_SBMLModelgf_loadSBMLbuf (const char *buf)
 Load SBML from memory buffer. Struct contains a pointer to the document. More...
 
_GraphfabExport gf_SBMLModelgf_loadSBMLfile (const char *file)
 Load SBML from memory buffer. Struct contains a pointer to the document. More...
 
_GraphfabExport void gf_strfree (char *str)
 Free a C string (char*) More...
 

Detailed Description

Typedef Documentation

typedef struct __fr_options fr_options

Options passed to the Fruchterman-Reingold algorithm.

Author
JKM

This structure holds the settings used by the Fruchterman-Reingold algorithm.

Enumeration Type Documentation

Species role in a reaction.

Author
JKM

Represents the SBML species role in a reaction. Species can be reactants, products, modifiers, etc.

Function Documentation

_GraphfabExport void gf_aliasNodebyDegree ( gf_layoutInfo l,
const int  minDegree 
)

Create node aliases by node degree.

Parameters
[in]lThe layout info; contains the network that holds the list of nodes and reactions necessary for aliasing
[in]minDegreeThe minimum node degree; Nodes that are of the minimum degree or higher will be aliased
_GraphfabExport int gf_arrowheadGetStyle ( gf_specRole  role)

Get the style for the role type.

Parameters
[in]roleRole type
_GraphfabExport unsigned long gf_arrowheadNumStyles ( )

Get the number of arrowhead styles.

Returns
The number of arrowhead styles
_GraphfabExport void gf_arrowheadSetStyle ( gf_specRole  role,
int  style 
)

Set the arrowhead style for a specific role type.

Parameters
[in]roleRole type
[in]styleArrowhead style number
_GraphfabExport int gf_arrowheadStyleGetNumVerts ( int  style)

Get the number of vertices in the arrowhead polygon.

Parameters
[in]styleArrowhead style number
Returns
The arrowhead polygon vertex count
_GraphfabExport gf_point gf_arrowheadStyleGetVert ( int  style,
int  n 
)

Get the nth vertex of the arrow polygon.

Parameters
[in]styleArrowhead style number
[in]nThe vertex index
Returns
The nth vertex of the polygon
_GraphfabExport int gf_arrowheadStyleIsFilled ( int  style)

Is the given style filled?

Parameters
[in]styleArrowhead style number
Returns
Nonzero if the arrow polygon should be filled
_GraphfabExport unsigned int gf_canvGetHeight ( gf_canvas c)

Get the height of the canvas.

Parameters
[in]cThe canvas
_GraphfabExport unsigned int gf_canvGetWidth ( gf_canvas c)

Get the width of the canvas.

Parameters
[in]cThe canvas
_GraphfabExport void gf_canvSetHeight ( gf_canvas c,
unsigned long  height 
)

Set the height of the canvas.

Parameters
[in]cThe canvas
[in]heightThe height
_GraphfabExport void gf_canvSetWidth ( gf_canvas c,
unsigned long  width 
)

Set the width of the canvas.

Parameters
[in]cThe canvas
[out]widthThe width
_GraphfabExport void gf_clearCanvas ( gf_canvas c)

Get the canvas associated with the model.

Parameters
[in]lThe layout info
_GraphfabExport void gf_clearNetwork ( gf_network n)

Clear the network - does not deallocate.

Parameters
[in]nThe network object
_GraphfabExport int gf_compartment_addNode ( gf_compartment c,
gf_node n 
)

Add a node to the compartment.

The node must already exist in the network

Parameters
[in]cThe compartment object
[in]nThe node to add
Returns
Zero for success
_GraphfabExport int gf_compartment_containsNode ( gf_compartment c,
gf_node n 
)

Return whether the compartment contains this node.

Parameters
[in]cThe compartment object
[in]nThe node
Returns
Nonzero if true
_GraphfabExport int gf_compartment_containsReaction ( gf_compartment c,
gf_reaction r 
)

Return whether the compartment contains this node.

Parameters
[in]cThe compartment object
[in]rThe reaction
Returns
Nonzero if true
_GraphfabExport double gf_compartment_getHeight ( gf_compartment c)

Get the height of the compartment.

Parameters
[in]cThe compartment object
_GraphfabExport char* gf_compartment_getID ( gf_compartment c)

Get the id, user frees memory.

Parameters
[in]cThe compartment object
_GraphfabExport gf_point gf_compartment_getMaxCorner ( gf_compartment c)

Get the "lower right" corner.

Parameters
[in]cThe compartment object
_GraphfabExport gf_point gf_compartment_getMinCorner ( gf_compartment c)

Get the "upper left" corner.

Parameters
[in]cCompartment
_GraphfabExport uint64_t gf_compartment_getNumElt ( gf_compartment c)

Get the number of species in the compartment.

Parameters
[in]cThe compartment object
_GraphfabExport double gf_compartment_getWidth ( gf_compartment c)

Get the width of the compartment.

Parameters
[in]cThe compartment object
_GraphfabExport int gf_compartment_removeNode ( gf_compartment c,
gf_node n 
)

Remove a node from the compartment.

Parameters
[in]cThe compartment object
[in]nThe node to remove
Returns
Zero for success
_GraphfabExport void gf_compartment_setMaxCorner ( gf_compartment c,
gf_point  p 
)

Set the "lower right" corner.

Parameters
[in]cThe compartment object
[in]pCorner
_GraphfabExport void gf_compartment_setMinCorner ( gf_compartment c,
gf_point  p 
)

Set the "upper left" corner.

Parameters
[in]cThe compartment object
[in]pCorner
_GraphfabExport gf_point* gf_computeCubicBezierLineIntersec ( gf_curveCP c,
gf_point line_start,
gf_point line_end 
)

Compute the intersection between a cubic Bezier and a line.

Parameters
[in]cCubic Bezier control points
[in]line_startThe start of the line
[in]line_endThe end of the line
Returns
An array of intersection points with a 0, 0 sentinel
_GraphfabExport gf_point gf_computeCubicBezierPoint ( gf_curveCP c,
Real  t 
)

Compute a point on the parametric curve.

Parameters
[in]cCubic Bezier control points
[in]tCubic Bezier parameter
_GraphfabExport int gf_curve_getArrowheadVerts ( const gf_curve c,
unsigned int *  n,
gf_point **  v 
)

Get the vertices for the curve's arrowhead.

Parameters
[in]cThe curve
[out]nNumber of arrowhead verts
[out]vThe vertices (new arrow, callee owns)
_GraphfabExport gf_specRole gf_curve_getRole ( gf_curve c)

Get the id, user frees memory.

Parameters
[in]cThe curve Get the role of the species with the given curve
[in]cThe curve
Returns
The index of the matching species in the reaction
_GraphfabExport int gf_curve_hasArrowhead ( const gf_curve c)

Returns true if the given curve should be drawn with an arrowhead.

Parameters
[in]cThe curve
_GraphfabExport void gf_doLayoutAlgorithm ( fr_options  opt,
gf_layoutInfo l 
)

Run the autolayout (Fruchterman-Reingold) algorithm on a given layout structure.

Author
JKM
Note
l should be a layout info object obtained from a call to gf_processLayout.
Parameters
[in]optThe options controlling the layout algorithm
in/out]l The layout info
_GraphfabExport void gf_doLayoutAlgorithm2 ( fr_options  opt,
gf_network n,
gf_canvas c 
)

Run the autolayout (Fruchterman-Reingold) algorithm on a a network and optional canvas.

Can be used when full layout struct is not available

Parameters
[in]optThe options controlling the layout algorithm
in/out]n The network
[in]cThe canvas (may be NULL)
_GraphfabExport void gf_fit_to_window ( gf_layoutInfo l,
double  left,
double  top,
double  right,
double  bottom 
)

Fit to the specified window.

Given a network layout and a window, constructs a 2D affine transform to fit the network within the window. The 2D affine transform is applied directly to the network.

Parameters
[in]lThe layout info object
[in]leftLeft edge of screen (other args similar)
_GraphfabExport void gf_free ( void *  x)

Frees the memory block at x.

Note
For strings (char*), use gf_strfree
_GraphfabExport void gf_freeLayoutInfo ( gf_layoutInfo l)

Call to clean up an instance of gf_layoutInfo when it is no longer needed.

Parameters
[in]lThe layout info; Entire layout is freed
_GraphfabExport void gf_freeLayoutInfoHierarch ( gf_layoutInfo l)

Call to clean up an instance of gf_layoutInfo and all contained data structures.

Parameters
[in]lThe layout info; Entire layout is freed
_GraphfabExport void gf_freeModelAndLayout ( gf_SBMLModel mod,
gf_layoutInfo l 
)

Call to clean up an instance of gf_layoutInfo and gf_SBMLModel when they are no longer needed.

The network object (which can be obtained via gf_getNetworkp is freed as well.

Parameters
[in]modThe SBML model
[in]lThe layout info; Entire layout is freed
_GraphfabExport void gf_freeSBMLModel ( gf_SBMLModel lo)

Destructor for gf_SBMLModel.

Parameters
[in]loThe SBML model; all memory used by the model is freed
_GraphfabExport gf_canvas* gf_getCanvasp ( gf_layoutInfo l)

Get the canvas associated with the model.

Parameters
[in]lThe layout info
_GraphfabExport const char* gf_getCurrentLibraryVersion ( void  )

Returns the current version of the library.

Returns
Static string
_GraphfabExport gf_curveCP gf_getCurveCPs ( const gf_curve c)

Get the CPs for the curve.

Parameters
[in]cThe curve
_GraphfabExport const char* gf_getDefaultCompartmentId ( )

Get the id of the default SBML compartment.

Note
The default compartment is not rendered
Returns
The id (memory owned by the library)
_GraphfabExport char* gf_getLastError ( )

Gets the last error.

Returns
The error message (owned by callee)
_GraphfabExport void gf_getLayoutOptDefaults ( fr_options opt)

Generate default values for the layout options.

Parameters
[out]lThe layout info in which to store the options
_GraphfabExport gf_network* gf_getNetworkp ( gf_layoutInfo l)

Get the network associated with the model.

Parameters
[in]lThe layout info; contains the network
Returns
A pointer to the network
Note
Caller must free returned pointer using gf_free
_GraphfabExport const char* gf_getSBMLwithLayoutStr ( gf_SBMLModel m,
gf_layoutInfo l 
)

String version of writeSBMLwithLayout.

Parameters
[in]mThe SBML model; required since this tool only handles layout
[in]lThe layout info; the SBML in string form is written to the layout
Returns
Raw SBML as UTF-8 string (owned by callee)
_GraphfabExport int gf_haveError ( )

Gets whether an error occurred.

Returns
True if an error has been set
_GraphfabExport void gf_layout_setStiffness ( fr_options opt,
double  k 
)

Set the stiffness for the FR algorithm.

Parameters
[out]optThe layout info in which to store the stiffness
[in]kThe stiffness
_GraphfabExport gf_layoutInfo* gf_layoutInfo_newp ( uint64_t  level,
uint64_t  version,
uint64_t  width,
uint64_t  height 
)

Create a new layout info object.

Returns
The new layout info
Note
Caller must free returned pointer using gf_free
_GraphfabExport gf_SBMLModel* gf_loadSBMLbuf ( const char *  buf)

Load SBML from memory buffer. Struct contains a pointer to the document.

Parameters
[in]bufThe buffer containing the SBML file
[out]rThe SBML model; the model that contains the SBML info from the buffer
_GraphfabExport gf_SBMLModel* gf_loadSBMLfile ( const char *  file)

Load SBML from memory buffer. Struct contains a pointer to the document.

Parameters
[in]bufThe buffer containing the SBML file
[out]rThe SBML model; the model that contains the SBML info from the buffer
_GraphfabExport void gf_moveNetworkToFirstQuad ( gf_layoutInfo l,
double  x_disp,
double  y_disp 
)

Move the entire network to the first quadrant.

Uses the network's bounding box to move all coordinates to the first quadrant. x_disp and y_disp are an additional offset to apply to the bounding box's minimum corner. If they are zero, the corner will be at the origin.

Parameters
[in]lThe layout info object
[in]x_dispX displacement to post-apply to the bounding box
[in]y_dispY displacement to post-apply to the bounding box
_GraphfabExport int gf_node_getAttachedCurves ( gf_node n,
gf_network m,
unsigned int *  num,
gf_curve **  curves 
)

Get a list of all curves connected to the node.

Parameters
[in]nThe node object
[out]numThe number of curves
[out]rxnsThe curve array (callee must free with gf_free)
Returns
Reserved
_GraphfabExport gf_point gf_node_getCentroid ( gf_node n)

Get the centroid of the node.

Parameters
[in]nThe node object
_GraphfabExport void gf_node_getCentroidXY ( gf_node n,
double *  x,
double *  y 
)

Get the centroid of the node.

Parameters
[in]nThe node object
[out]xX coord of centroid
[out]yY coord of centroid
_GraphfabExport int gf_node_getConnectedReactions ( gf_node n,
gf_network m,
unsigned int *  num,
gf_reaction **  rxns 
)

Get a list of all reactions connected to the node.

Parameters
[in]nThe node object
[out]numThe number of reactions
[out]rxnsThe reaction array (callee must free with gf_free)
Returns
Reserved
_GraphfabExport double gf_node_getHeight ( gf_node n)

Get the height of the node.

Parameters
[in]nThe node object
_GraphfabExport char* gf_node_getID ( gf_node n)

Get the id, user frees memory.

Parameters
[in]nThe node object
_GraphfabExport const char* gf_node_getName ( gf_node n)

Get the name, client must free memory.

Parameters
[in]nThe node object
_GraphfabExport double gf_node_getWidth ( gf_node n)

Get the width of the node.

Parameters
[in]nThe node object
_GraphfabExport int gf_node_isAliased ( gf_node n)

Is the node aliased?

Parameters
[in]nThe node object
_GraphfabExport int gf_node_isLocked ( gf_node n)

Is the node locked?

Parameters
[in]nThe node object
_GraphfabExport void gf_node_lock ( gf_node n)

Lock the node.

Parameters
[in]nThe node object
_GraphfabExport int gf_node_make_alias ( gf_node n,
gf_network m 
)

Create aliases of a given node.

Creates alais nodes of a given node. One alias will be created for each reaction the node participates in. The aliases will appear as separate nodes in the network. The function gf_node_isAliased may be called to determine whether a given node is an alias or not.

Parameters
[in,out]nThe node to alias. Do not continue to use this pointer after the call - it will be invalid
[in,out]mThe network containing n. The nodes and reactions in this network may be modified by the call. The pointer m will remain valid.
_GraphfabExport void gf_node_setCentroid ( gf_node n,
gf_point  p 
)

Set the centroid of the node.

Parameters
[in]nThe node object
_GraphfabExport void gf_node_setCompartment ( gf_node n,
gf_compartment c 
)

Add a node to a compartment.

Parameters
[in]cCompartment
[in]nThe node object
_GraphfabExport void gf_node_setHeight ( gf_node n,
double  height 
)

Set the height of the node.

Parameters
[in]nThe node object
_GraphfabExport void gf_node_setID ( gf_node n,
const char *  id 
)

Get the id, user frees memory.

Parameters
[in]nThe node object
_GraphfabExport void gf_node_setName ( gf_node n,
const char *  name 
)

Set the name of a node.

Parameters
[in]nThe node object
_GraphfabExport void gf_node_setWidth ( gf_node n,
double  width 
)

Set the width of the node.

Parameters
[in]nThe node object
_GraphfabExport void gf_node_unlock ( gf_node n)

Unlock the node.

Parameters
[in]nThe node object
_GraphfabExport int gf_nw_connectNode ( gf_network nw,
gf_node node,
gf_reaction reaction,
gf_specRole  role 
)

Connect a node to a reaction.

Parameters
[in]nwThe network object
[in]nodeThe node to connect
[in]reactionThe reaction to connect to
[in]roleThe species role to use
_GraphfabExport int gf_nw_connectNodeRoleStr ( gf_network nw,
gf_node n,
gf_reaction r,
const char *  role_str 
)

Connect a node to a reaction.

Parameters
[in]nwThe network object
[in]nodeThe node to connect
[in]reactionThe reaction to connect to
[in]roleThe species role to use (must be one of SUBSTRATE,PRODUCT,MODIFIER,ACTIVATOR,INHIBITOR)
_GraphfabExport gf_compartment* gf_nw_findCompartmentById ( gf_network n,
const char *  id 
)

Find a compartment by id.

Returns NULL if no such compartment exists

Parameters
[in]nThe network object
[in]idThe compartment ID
Note
Caller must free returned pointer using gf_free
_GraphfabExport gf_node* gf_nw_getAliasInstancep ( gf_network nw,
gf_node n,
uint64_t  i 
)

Get the ith instance of an aliased node.

Parameters
[in]nThe node object
[in]iThe instance index
Note
Caller must free returned pointer using gf_free
_GraphfabExport gf_compartment* gf_nw_getCompartmentp ( gf_network n,
uint64_t  i 
)

Get the compartment at index i.

Parameters
[in]nThe network object
[in]iNode index
Note
Caller must free returned pointer using gf_free
_GraphfabExport char* gf_nw_getId ( gf_network n)

Get the id of the network (i.e. the SBML model)

The id of the network is determined by the SBML model object

Note
Memory must be freed by caller
Parameters
[in]nThe network object
_GraphfabExport gf_node* gf_nw_getNodep ( gf_network n,
uint64_t  i 
)

Get the node at index i.

Parameters
[in]nThe network object
[in]iNode index
Returns
A pointer to the node
Note
Caller must free returned pointer using gf_free
_GraphfabExport gf_node* gf_nw_getNodepFromId ( gf_network nw,
const char *  id 
)

Get the node with the given id.

Parameters
[in]nwThe network object
[in]idThe node id
Returns
A pointer to the node with the given id; returns NULL if no such node exists
_GraphfabExport int gf_nw_getNumAliasInstances ( gf_network nw,
gf_node n 
)

Get the number of instances of the node.

Parameters
[in]nwThe network object
[in]nThe node object
_GraphfabExport uint64_t gf_nw_getNumComps ( const gf_network n)

Get the number of compartments.

Parameters
[in]nThe network object
_GraphfabExport uint64_t gf_nw_getNumNodes ( const gf_network n)

Get the number of nodes.

Parameters
[in]nThe network object
_GraphfabExport uint64_t gf_nw_getNumRxns ( const gf_network n)

Get the number of reactions.

Parameters
[in]nThe network object
_GraphfabExport uint64_t gf_nw_getNumUniqueNodes ( const gf_network n)

Get the number of unique nodes.

This method only counts the unique nodes in a network, i.e. if a node is aliased, all instances count as a single node.

Parameters
[in]nThe network object
_GraphfabExport gf_reaction* gf_nw_getRxnp ( gf_network n,
uint64_t  i 
)

Get the node at index i.

Parameters
[in]nThe network object
[in]iNode index
Note
Caller must free returned pointer using gf_free
_GraphfabExport gf_node* gf_nw_getUniqueNodep ( gf_network n,
uint64_t  i 
)

Get the node at index i.

Parameters
[in]nThe network object
[in]iNode index
Returns
A pointer to the node
Note
Caller must free returned pointer using gf_free
_GraphfabExport int gf_nw_isLayoutSpecified ( gf_network nw)

Did the SBML model include layout?

Returns
1 for yes, 0 for no
Parameters
[in]nThe network object
_GraphfabExport int gf_nw_isNodeConnected ( gf_network nw,
gf_node node,
gf_reaction reaction 
)

Return whether the given node is connected to the given reaction.

Parameters
[in]nwThe network object
[in]nodeThe node to connect
[in]reactionThe reaction to connect to
Returns
True if this not is connected
_GraphfabExport gf_node* gf_nw_newAliasNodep ( gf_network nw,
gf_node source 
)

Create and add an alias node from a given source node.

Parameters
[in]nwThe network object
[in]idThe node's requested ID (or null to determine it automatically)
[in]nameThe node's name
[in]sourceThe original source node
Note
Caller must free returned pointer using gf_free
_GraphfabExport gf_compartment* gf_nw_newCompartmentp ( gf_network nw,
const char *  id,
const char *  name 
)

Add a new compartment to the network.

Parameters
[in]nwThe network object
[in]idThe compartment's requested ID (or null to determine it automatically)
[in]nameThe compartment's name
Note
Caller must free returned pointer using gf_free
_GraphfabExport gf_node* gf_nw_newNodep ( gf_network nw,
const char *  id,
const char *  name,
gf_compartment compartment 
)

Add a new node to the network.

Parameters
[in]nwThe network object
[in]idThe node's requested ID (or null to determine it automatically)
[in]nameThe node's name
[in]compartmentThe compartment to place the node in (may be NULL for no compartment or NULL for the "default" compartment in SBML parlance)
Note
Caller must free returned pointer using gf_free
_GraphfabExport gf_reaction* gf_nw_newReactionp ( gf_network nw,
const char *  id,
const char *  name 
)

Add a new reaction to the network.

Parameters
[in]nwThe network object
[in]idThe reaction's requested ID (or null to determine it automatically)
[in]nameThe reaction's name
Note
Caller must free returned pointer using gf_free
_GraphfabExport gf_compartment* gf_nw_nodeGetCompartment ( gf_network nw,
gf_node x 
)

Get the compartment which contains node x.

Parameters
[in]nwThe network object
[in]xA node object
Note
Caller must free returned pointer using gf_free
_GraphfabExport int gf_nw_nodeHasCompartment ( gf_network nw,
gf_node x 
)

Return true if the node has a compartment assigned.

Parameters
[in]nwThe network object
[in]xA node object
_GraphfabExport void gf_nw_rebuildCurves ( gf_network n)

Rebuild all curves in the network.

Rebuild all curves in each reaction, connecting substrates, products, modifiers, etc. Automatically calculate control points.

Parameters
in/out]n The network object
_GraphfabExport void gf_nw_recenterJunctions ( gf_network n)

Recenter reaction junctions.

Parameters
[in]nThe network object
_GraphfabExport int gf_nw_removeNode ( gf_network nw,
gf_node node 
)

Remove a node from the network.

Parameters
[in]nThe network object
_GraphfabExport void gf_nw_removeRxn ( gf_network n,
gf_reaction r 
)

Remove the given reaction.

Parameters
[in]nThe network object
[in]iNode index
_GraphfabExport void gf_nw_setId ( gf_network n,
const char *  id 
)

Set the id of the network (via the SBML model)

This will be used as the ID of the model object in the serialized SBML

Note
Memory must be freed by caller
Parameters
[in,out]nThe network object
[in]idThe id to use
_GraphfabExport gf_layoutInfo* gf_processLayout ( gf_SBMLModel lo)

Process the layout info from a document.

Author
JKM

The layout info holds the network (nodes, reactions, etc.), canvas, and SBML content. gf_processLayout should be called after loading a network (via e.g. gf_loadSBMLfile). If the SBML model has layout information, the returned gf_layoutInfo will preserve this information. Otherwise, it will generate it automatically using the Fruchterman-Reingold algorithm.

gf_processLayout should be called only once for a loaded model (subsequent calls will have no effect). To manually re-run the Fruchterman-Reingold algorithm, call gf_doLayoutAlgorithm.

Parameters
[in]loThe SBML model; the layout info is generated from the SBML model
[out]lThe layout info; pointer to the layout info generated from SBML model is returned
Warning
Call gf_freeLayoutInfo to free the returned pointer. Do not call gf_free.
_GraphfabExport void gf_randomizeLayout ( gf_layoutInfo m)

Randomize node positions.

Parameters
[in]mThe layout info; contains the network of nodes and reactions, the coordinates of which will be randomized
_GraphfabExport void gf_randomizeLayout2 ( gf_network n,
gf_canvas c 
)

Randomize node positions for a given network & canvas.

Parameters
[in]nNetwork
[in]cCanvas
_GraphfabExport void gf_randomizeLayout_fromExtents ( gf_network n,
double  left,
double  top,
double  right,
double  bottom 
)

Randomize node positions for a given network & extents.

Parameters
[in]nNetwork
[in]leftThe minimum X coord of the bounding box
[in]topThe minimum Y coord of the bounding box
[in]rightThe maximum X coord of the bounding box
[in]bottomThe maximum Y coord of the bounding box
_GraphfabExport gf_point gf_reaction_getCentroid ( gf_reaction r)

Get the centroid of the reaction.

Parameters
[in]rThe reaction object
_GraphfabExport gf_curve* gf_reaction_getCurvep ( const gf_reaction r,
uint64_t  i 
)

Get the curve i.

Parameters
[in]rThe reaction object
Note
Caller must free returned pointer using gf_free
_GraphfabExport char* gf_reaction_getID ( gf_reaction r)

Get the id, user frees memory.

Parameters
[in]rThe reaction object
_GraphfabExport uint64_t gf_reaction_getNumCurves ( const gf_reaction r)

Get the number of curves in the reaction.

Parameters
[in]rThe reaction object
_GraphfabExport uint64_t gf_reaction_getNumSpec ( const gf_reaction r)

Get the number of species in the reaction.

Parameters
[in]rThe reaction object
_GraphfabExport gf_specRole gf_reaction_getSpecRole ( const gf_reaction r,
uint64_t  i 
)

Get the role for spec i.

Parameters
[in]rThe reaction object
_GraphfabExport int gf_reaction_hasSpec ( const gf_reaction r,
const gf_node n 
)

Return true if the reaction has the given species.

Parameters
[in]rThe reaction object
_GraphfabExport void gf_reaction_recalcCurveCPs ( gf_reaction r)

Recalculate the curve CPs, don't recenter.

Parameters
[in]nThe reaction object
_GraphfabExport void gf_reaction_recenter ( gf_reaction r)

Recenter reaction centroid.

Parameters
[in]nThe reaction object
_GraphfabExport void gf_reaction_setCentroid ( gf_reaction r,
gf_point  p 
)

Set the centroid of the reaction.

Parameters
[in]rThe reaction object
_GraphfabExport uint64_t gf_reaction_specGeti ( const gf_reaction r,
uint64_t  i 
)

Get the global index of a reactant/product/participant given its local index in a reaction.

Parameters
[in]rThe reaction object
_GraphfabExport void gf_release_transform ( gf_transform tf)

Release transform.

Parameters
[in]tfTransform
_GraphfabExport void gf_releaseCanvas ( gf_canvas c)

Release the canvas.

Parameters
[in]cThe canvas
_GraphfabExport void gf_releaseCompartment ( const gf_compartment c)

Release a compartment object.

Parameters
[in]cThe compartment object
_GraphfabExport void gf_releaseCurve ( const gf_curve c)

Release the curve.

Parameters
[in]cThe curve
_GraphfabExport void gf_releaseNetwork ( gf_network n)

Release the network.

Parameters
[in]nThe network object
_GraphfabExport void gf_releaseNode ( const gf_node n)

Release the node.

Parameters
[in]nThe node object
_GraphfabExport void gf_releaseRxn ( const gf_reaction r)

Release the reaction.

Parameters
[in]rThe reaction object
_GraphfabExport const char* gf_renderTikZ ( gf_layoutInfo l)

Render the model as a TikZ image.

Parameters
[in]lThe model/layout infor
_GraphfabExport int gf_renderTikZFile ( gf_layoutInfo l,
const char *  filename 
)

Render the model as a TikZ image.

Parameters
[in]lThe model/layout infor
_GraphfabExport const char* gf_roleToStr ( gf_specRole  role)

Convert role to string.

Parameters
[in]roleRole
Returns
Static string indicating the role
_GraphfabExport gf_SBMLModel* gf_SBMLModel_newp ( )

Create a new SBML model.

Returns
The new SBML model
Note
Caller must free returned pointer using gf_free
_GraphfabExport void gf_setDefaultCompartmentId ( const char *  id)

Set the id of the default SBML compartment.

Note
The default compartment is not rendered
Parameters
[in]idThe id of the default compartment
_GraphfabExport void gf_setModelNamespace ( gf_layoutInfo l,
unsigned long  level,
unsigned long  version 
)

Set the level and version of the SBML.

Parameters
[out]lThe SBML model with layout info
[in]levelThe SBML level
[in]versionThe SBML version
_GraphfabExport void gf_strfree ( char *  str)

Free a C string (char*)

Parameters
[in]strThe string to free
_GraphfabExport gf_specRole gf_strToRole ( const char *  str)

Convert string to role.

Parameters
[in]strString returned from gf_roleToStr
Returns
Role
_GraphfabExport CPoint gf_tf_apply_to_point ( gf_transform tf,
CPoint  p 
)

Apply transform to point.

Parameters
[in]tfTransform
[in]pPoint
_GraphfabExport gf_transform* gf_tf_fitToWindow ( gf_layoutInfo l,
double  left,
double  top,
double  right,
double  bottom 
)

Fit to the specified window (do not apply transform)

Given a network layout and a window, constructs a 2D affine transform to fit the network within the window. The 2D affine transform is returned from this function (to be used by e.g. client-side rendering code) and the layout coordinates of the network are unaffected.

Parameters
[in]lThe layout info object
[in]leftLeft edge of screen (other args similar)
Returns
The new transform (not applied)
_GraphfabExport gf_point gf_tf_getDisplacement ( gf_transform tf)

Get the displacement of the transform.

Gets just the displacement component of a 2D affine transform, ignoring the rotation and scaling.

Parameters
[in]tfTransform
_GraphfabExport gf_point gf_tf_getPostDisplacement ( gf_transform tf)

Get the displacement component of the transform.

Like gf_tf_getDisplacement, but applies the inverse of the linear portion of the original transform to the output.

Parameters
[in]tfTransform
Returns
The displacement with the transform applied
_GraphfabExport gf_point gf_tf_getScale ( gf_transform tf)

Get the scale of the transform.

Parameters
[in]tfTransform
_GraphfabExport int gf_writeSBML ( const char *  filename,
gf_SBMLModel m 
)

Write an SBML file (does not include layout.

Returns
0 for success
Parameters
[in]filenameThe output file
[in]mThe SBML model; required since this tool only handles layout
_GraphfabExport int gf_writeSBMLwithLayout ( const char *  filename,
gf_SBMLModel m,
gf_layoutInfo l 
)

Write an SBML file, including layout.

Returns
0 for success
Parameters
[in]filenameThe output file
[in]mThe SBML model; required since this tool only handles layout
[in]lThe layout info; replaces any currently existing SBML layout in the model in the generated file