Skip to main content

Nuc2D

Nuc2D visualizes RNA and DNA secondary structures as publication-ready SVG images.

Installation

pip install nuc2d

Quick start

from nuc2d import draw_svg

dpp_string = "(((..+...)))"

svg = draw_svg(
    dpp_string=dpp_string,
)

svg.saveas("output.svg")

The dpp_string argument should be specified in dot-parens-plus notation.

If you are using Jupyter Notebook or JupyterLab, you can also display the generated SVG directly:

from IPython.display import SVG, display

display(SVG(svg.tostring()))

Sequence annotation

Nucleotide sequences can be provided through the sequences argument.

sequences = ["AUGCA", "UGCCAU"]

svg = draw_svg(
    dpp_string=dpp_string,
    sequences=sequences,
)

Base-pair probability visualization

Base-pair probabilities can be visualized by providing a symmetric base-pair probability matrix through the probs argument.

# Base-pair probability matrix from a structure prediction tool.
# probs[i][j] is the probability of nucleotides i and j forming a base pair.
# The diagonal probs[i][i] represents the probability that nucleotide i is unpaired.
probs = ...

svg = draw_svg(
    dpp_string=dpp_string,
    probs=probs,
)

Output

nuc2d renders structures as SVG, making the resulting figures suitable for further editing and use in presentations and publications.

License

This project is licensed under the MIT License.

Release files for nuc2d 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nuc2d 0.3.0
File Size Uploaded
nuc2d-0.3.0.tar.gz 18.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nuc2d 0.3.0
File Interpreter ABI Platform
nuc2d-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.8 kB

Release files / nuc2d-0.3.0.tar.gz

Download URL nuc2d-0.3.0.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b303ede59064e46a5283ce99ff0d6e0f26d7e7b620bc2b90eabdce9241c2b7f9
BLAKE2b-256 checksum
How to use checksums
51d8384cebaa8e440ef60b15bf0c740a5a41f591f82f6d47a08828bc6e2682ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.7

Release files / nuc2d-0.3.0-py3-none-any.whl

Download URL nuc2d-0.3.0-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d4e67985219f924a0bdbf74f1c6a223f05070c2a9779cf7804ab96c494532e6
BLAKE2b-256 checksum
How to use checksums
0a0a241e05f05761f0b2fc758749d5b7059c7aa3e6d5d6049ca12032fa67f266
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.7

Release history Release notifications | RSS feed

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page