Skip to content

imbforge/benchbaze-map-dna-svg-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BenchBaze - DNA map to SVG converter

This application allows server-side conversion of a DNA map to an SVG file using the CircularView component from Teselagen's Open Vector Editor (OVE). It is integrated in BenchBaze.

An Express server renders the CircularView React component to an HTML string via ReactDOMServer.renderToString, extracts the <svg> element, and serves it as a downloadable file.

Setup

  1. Install dependencies:
yarn install
  1. Build the app
yarn build
  1. Optionally, start the development server for testing:
yarn start

The server listens on port 3000 by default.

Usage

Send a GET request with the following query parameters:

Parameter Required Description
path Yes Path to the DNA map file to render (.gbk, .gb, or .dna)
title No Name used for the plasmid and the downloaded filename (defaults to plasmid)

Supported file formats: GenBank (.gb, .gbk) and SnapGene (.dna).

Example

curl http://localhost:3000/?path=src/pHU6066.gbk&title=pHU6066

The response is an SVG file downloaded as <title>.html.

Error responses

Status Cause
400 path parameter missing or file extension not supported
404 File not found at the given path
500 Parse failure or render error (response body contains the specific error message)

Running as a service

The server can be run as a systemd service directly or via PM2 (which may offer some advantages)

Directly

node ${BENCHBAZE_HOME}/collection/shared/map_dna/svg_converter/build/server.js

systemd unit file

[Unit]
Description=DNA-Map-to-SVG converter for BenchBaze
After=syslog.target network-online.target

[Service]
ExecStart=${NODE_BIN}/node ${BENCHBAZE_HOME}/collection/shared/map_dna/svg_converter/build/server.js
Type=exec
User=www-data
Group=www-data

[Install]
WantedBy=multi-user.target

PM2

npx pm2 start ${BENCHBAZE_HOME}/collection/shared/map_dna/svg_converter/build/server.js --name "map-dna-svg-converter"

To make PM2 restore the process automatically after a server reboot:

npx pm2 save       # snapshot the current process list
npx pm2 startup    # install a systemd unit to restore the snapshot on boot

pm2 startup prints a sudo command — copy and run it to complete the setup. If you later change which processes should autostart, run pm2 save again.

Notes

  • Features whose names match synthetic dna construct, recombinant plasmid, or source and that span the full plasmid length are automatically excluded from the map.
  • The rendered view shows features, parts, and axis numbers; translations, ORFs, cut sites, primers, and the sequence itself are hidden.

About

Server-side-rendering for CircularView from Teselagen's Open Vector Editor

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors