The recent release of SBW 2.8.2 adds support for SBGN-ML to the Systems Biology Workbench. This has been implemented using the SBML Layout Library, a .NET library that reads layout and rendering information from SBML models. This library is available separately and is used in many projects for example:
- Auto Layout
- Layout Web Application
- Layout Web Service
- BenZaiTen (no public release)
- Simulate 3D
Of course it can also be used directly in any .NET application. The easiest way to get started is this:
- install SBW (this will install the latest version of the layout lib)
- start Visual Studio
- add a reference to the SBMLExtension.dll as can be found in C:\Program Files (x86)\KGI\SBW\Layout to a new project (any .net language can be used).
Before we get started let us make sure we have some SBGN-ML files available, so at this point you would download a couple .sbgn files from the SBGN-ML repository.
The SBML Layout library converts all layout annotation it understands into the SBML Layout and Rendering Annotations. This is done by using:
var layout = Util.readLayoutFromFile(@”path/filename”);
where the filename could be an SBML file with layout annotations (JDesigner / JDesigner 2 annotations, SBML Layout / SBML Rendering information, CellDesigner annotations (experimental)) or an SBGN-ML file.
So if you wanted to convert SBGN-ML to a PNG file all you would need is a bit of code like this:
var layout = Util.readLayoutFromFile(filename);
var name = Path.GetFileNameWithoutExtension(filename);
var outname = Path.Combine(outDir, name + ".png");
layout.ToImage().Save(outname);
Limitations
At this point the library does not allow to write out SBGN-ML, if that is a feature that is important to you, please let me know.
No comments:
Post a Comment