SeqViz is an open-source, embeddable library for interactive DNA sequence visualization and annotation on the web (Timmons et al. (2020)). It renders circular and linear maps, supports common formats via seqparse (Timmons (2022)), and displays features, primers, and annotations with fast SVG/Canvas rendering.
This package gives you two ways to use it in MyST Markdown and Curvenote:
seqvizdirective — use a file path or NCBI/iGEM accession ID; the directive and seqparse run at build time and pass the parsed data to the widget.Widget only — use the
any:bundledirective with a manually constructed JSON body when you don’t need build-time parsing.
The demos below show each option. The seqviz directive is enabled for this project via the plugin in curvenote.yml.
Demo 1: By accession number¶
Render a sequence by NCBI (or iGEM) accession ID. Data is fetched and parsed at build time using seqparse. Here we use U49845.
Figure 1:Rendering U49845 via the seqviz directive. Data is fetched from NCBI at build time.
Code:
:::{seqviz} U49845
:height: 500px
:viewer: both_flip
:::Demo 2: By local file¶
Render a sequence from a local GenBank (or FASTA, JBEI, SnapGene, SBOL) file. The file is read and parsed at build time. This example uses the AGTR2.gb file included in this package.
Figure 2:Rendering AGTR2.gb (same locus as NM_000686) from a local file.
Code:
:::{seqviz} ./AGTR2.gb
:height: 500px
:viewer: both
:::Demo 3: Widget only (manual JSON)¶
Use the widget without the directive or seqparse by passing sequence and annotations directly in the any:bundle body. No build-time parsing — useful when you already have JSON or don’t use seqparse.
Figure 3:Rendering a short sequence with a single annotation using only the widget.
Code:
:::{any:bundle} https://curvenote.github.io/widgets/widgets/seqviz.js
{
"height": "400px",
"name": "J23100",
"seq": "TTGACGGCTAGCTCAGTCCTAGGTACAGTGCTAGC",
"annotations": [{ "name": "promoter", "start": 0, "end": 34, "direction": 1, "color": "blue" }],
"viewer": "both_flip"
}
:::Replace the URL with your hosted seqviz.js (e.g. ./dist/seqviz.js) when not using the CDN.
Installation¶
| File | Purpose |
|---|---|
seqviz.js | ESM widget module — host and reference in any:bundle (or use the CDN URL). |
directives/seqviz.mjs | MyST plugin — register in your project (e.g. plugins: [dist/directives/seqviz.mjs] in curvenote.yml) so the seqviz directive and seqparse transform run. |
Directive (Demos 1 & 2): Add the plugin to your build and ensure seqparse is available so the directive can parse files and accession IDs.
Widget only (Demo 3): Host
seqviz.jsand useany:bundle; no plugin required.
The seqparse npm module must be available at build time in the folder you are building in for the seqviz directive (Demos 1 & 2) to work. It cannot be installed globally. Use one of these approaches:
In your project folder: run
npm init, thennpm install seqparse.Using the supplied package: download the
package.jsonfrom this package (e.g. fromdist/directives/or the seqviz package root), place it in your build directory, then runnpm install.
Props and options¶
Widget / directive body¶
When using any:bundle or when the directive passes data to the widget:
| Field | Type | Default | Description |
|---|---|---|---|
name | string | — | Display name for the sequence |
seq | string | — | Raw sequence (e.g. DNA). Required for widget-only usage. |
annotations | array | [] | List of { name, start, end, direction?, color? } |
height | string | "600px" | Height of the visualization |
viewer | "linear" | "circular" | "both" | "both_flip" | "both" | Which view(s) to show |
class | string | "" | CSS/Tailwind classes for the container |
style | object | {} | Inline style overrides |
Directive options¶
For :::{seqviz} path-or-accession:
| Option | Type | Default | Description |
|---|---|---|---|
height | string | "600px" | Height of the visualization |
viewer | string | "both" | linear, circular, both, or both_flip |
class | string | "" | Tailwind/CSS classes |
style | object | {} | Style overrides |
The directive body can optionally override or extend parsed fields. See seqparse for supported formats and accession types.
How it works¶
Widget: The
seqviz.jsbundle is an AnyWidget ESM module. It receives a JSON object (name,seq,annotations,viewer,height, etc.) and renders the sequence view in the browser.Directive: The
seqvizdirective inseqviz.mjsproduces a custom block that a transform (in the same plugin) resolves. The transform uses seqparse to read a local file or fetch by accession, then merges the result with any directive body and turns the block into anany:bundlecall withseqviz.jsand the merged JSON.
Source¶
Widget and directive: dev.curvenote.components — seqviz
SeqViz library: Lattice
-Automation /seqviz seqparse (parsing): Lattice
-Automation /seqparse
Further reading¶
SeqViz (Lattice-Automation/seqviz) — JavaScript DNA, RNA, and protein sequence viewer
SeqViz plugin article (opensci.dev) — context and examples for the directive
seqparse — supported file formats and accession IDs
AnyWidget — widget model used by this package
Copyright © 2026 Purves. This article is distributed under the terms of the MIT License license.
- Timmons, J., Vigliecca, G., & LeShane, K. (2020). SeqViz. Computer software, Version 3.10.16. https://github.com/Lattice-Automation/seqviz
- Timmons, J. (2022). SeqParse. Computer software, Version 0.2.1. https://github.com/Lattice-Automation/seqparse