SBML glyph/graph/layout - javascript

Do you know how to generate a draw or graph that I can convert or export in SVG from my SBML models. Or maybe directly generate SVG from SBML model wrote in XML?
I read documentation baut it doesn't help me for this projet.

There are ways to achieve that, but how useful these graphs depend on the content of the SBML file. Suppose the SBML file contains layout information in the SBML layout package. In that case, it is possible to convert it to such an image using tools such as the following:
EscherConverter
SBML Layout Viewer
If the SBML file does not contain layout information, automated layout tools can generate such graphs, e.g.,
Cytoscape with the Cy3SBML app
The online Systems Biology Format Converter (SBFC)
CellDesigner
Another option could be the MINERVA platform that generates layouts similar to that of CellDesigner and provides many options to work with SBML, e.g., via web services.
Please note:
The Systems Biology Format Converter (SBFC) creates GraphViz files for further processing. You can compile them using GraphViz and obtain SVGs based on automated layout.
CellDesigner directly supports exporting SVG. From File > Export Image… > Select SVG files and then Save. Currently, CellDesigner only supports SBML up to Level 2 Version 4. Its Layouts are often handy and can be easily manually adjusted. However, it may be necessary to downconvert the model first using SBFC. There are also importers and converters for CellDesigner that can deal with the SBML Layout package if needed, such as the CellDesigner Parser.

I would contact the Sauro lab, they have a number of tools in development that should be able to do this (including PDF). They also support the SBML layout/render extension. They are also developing a pydot to SBML converter.

Related

Export web application to pdf using server-side render

Our web application(many d3 charts) is set up by vue, and I could export our
webpage to pdf by the combination of canvg, html2canvas(convert web content to
png) and emit png file to server and use nodejs to download it automatically
and periodically(weekly report).
However, I was asked to use different render method from client-side to
server side rendering and use wkhtmltopdf or phantomjs to download pdf.
My question is that is it difficult to render many complicated d3 chart and edit
css in server side rendering by using vue or another technique?
Thanks!
The wkhtmltopdf is a popular library for converting complex html content to pdf.
You don't have to worry about your complicated d3 chart or css. It will handle it. But you have to install wkhtmltopdf command line tool on your system.
SVG DOM elements can be convert into different images format using server side rendering option. Apache Batik such a library to convert SVG DOM elements into pdf,png,jpg,word.
Batik is a Java-based toolkit for applications or applets that want to use images in the Scalable Vector Graphics (SVG) format for various purposes, such as display, generation or manipulation.
The project’s ambition is to give developers a set of core modules that can be used together or individually to support specific SVG solutions. Examples of modules are the SVG Parser, the SVG Generator and the SVG DOM. Another ambition for the Batik project is to make it highly extensible —for example, Batik allows the developer to handle custom SVG elements. Even though the goal of the project is to provide a set of core modules, one of the deliverables is a full fledged SVG browser implementation which validates the various modules and their inter-operability.

How can i convert my CAD(DWG) file to GeoJSON?

I'm working on openlayers and need to change the format of dwg to GeoJSON with ArcGIS.
how can i do this?
Indeed, GDAL has the necessary tools to get this done. ogr2ogr is a program included with GDAL that can transform a variety of formats, including DWG. If you don't already have GDAL installed, here are good tutorials for windows and mac/linux. The following guide recommends converting to a DXF first, since the library for converting from DXF is included by default with GDAL. You will need to install some additional dependencies to convert directly from DWG. If you convert to DXF first, you can then use command line to convert to GeoJson:
ogr2ogr -f GeoJSON ./mynewfile.geojson ./mycadfile.dxf
If you are using ArcGIS Desktop there is a CAD to Geodatabase tool that you can use.
Even if GDAL is a good and working solution for DXF file (which are CAD files too)
Since the OOP asks about DWG file, I would suggest to use the LibreDWG library that support conversion from DWG to GeoJSON files and has very good performance.
You can use it like so :
dwgread <input_file_path> -O GeoJSON -o <output_file_path>
There are also many other commands provided by this fantastic library.
I am also currently work on an open source project Geofiles-convertor Rest API which is a REST API that aims to make popular geofiles format conversion easier.
It is also based on both GDAL and LibreDWG and there is a Docker image ready to run.
Windows Users
For Windows users, you can download the latest release from GitHub (win32.zip or win64.zip), which has dwgread.exe file.
You can then open a terminal in the downloaded folder location and run the command dwgread.exe "D:\path\to\file.dwg" -O GeoJSON -o "D:\path\to\output.json"
GDAL can be used to do this, and I want to say ogr2ogr too, but not 100%.
Possible that you also need to make match your coordinates from AutoCAD (if meter unit) to geojson (GPS coordinates).
First: lambert 93 to select part of world area you aim.
Second: 3 points to focus on affine transformations to adapt AutoCAD geometries (rotation, translation, scale).
You could have a look at this doc:
https://github.com/open-indoor/openindoor6/blob/main/AUTOCAD.md
Also, a solution for DWG to DXF (ODAFileConverter in unattended Docker):
https://github.com/open-indoor/dwg-to-dxf

Graph library that outputs in html

What Ruby libraries, if any, are there that generate a graph (such as line-graph) and output in html format (possibly using JavaScript/jQuery)?
Ruby is more suited to a backend engine (e.g. on Rails) providing data to a front-end JavaScript library which produces the graphs.
So Ruby would generate data in JSON format for example, which can then be easily read in by a variety of libraries to produce any type of graph (which you can also tailor using CSS if you wish).
See here for a comparison of a lot of them out there:
http://socialcompare.com/en/comparison/javascript-graphs-and-charts-libraries
My personal preference? D3.js which produces very nice SVG graphs.
Edit
You can also find ruby gems that provide tighter integration with a number of these charting libraries.

Output 300 png images with correct filenames from svg or svg via canvas?

For browsers that don't support SVG, I'd like to show a static image of a chart instead of an interactive version.
One idea is to generate all possible chart states (around 300) beforehand. I tried using the Canvas2Image library but it doesn't seem to allow me to specify a filename. Is there any workaround? Perhaps a server-side solution?
There's a couple other ways to solve this.
rsvg is a rendering library that processes SVGs statically single-pass. It's used in ImageMagick's convert tool, and also has python and other bindings. Some people find various SVG-isms aren't supported, but rsvg gets updates now and then so best to just try and see.
inkscape is a GUI program that includes SVG->PNG conversion. But it can also be used exclusively on the command line (no X11 required). See man inkscape for all the command line options that can be used to process your svg's; it's quite flexible. The rendering is relatively fast. The main downside is that being a GUI program it has a lot of dependencies, that might not be present on a web server.

Converting d3.js SVG code to a standalone program -- any suggestions?

I have some scripts written with d3.js that generate SVG charts. I'd like to generate those charts with a standalone program -- what is the easiest way I can convert those scripts to run in batch mode, without a browser?
You could:
Convert this to a node.js program. You'd have access to the filesystem and would be able to save generated SVGs easily. You'd need node-canvas to replace the HTML canvas. See this d3 example to get started using d3 with node.
You could use the filesystem APIs in Chrome with your existing scripts to write files to the hard disk. This may be easier, because you would just need to implement the filesystem code on top of what you have already. See this html5rocks article for information on writing to the local file system.

Categories