Skip to main content

nuc2d

nuc2d is a Python library for parsing, annotating, laying out, and rendering nucleic acid secondary structures.

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.2.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.2.0
File Size Uploaded
nuc2d-0.2.0.tar.gz 17.4 kB Details

Built distribution (wheel)

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

Total release size: 35.4 kB

Release files / nuc2d-0.2.0.tar.gz

Download URL nuc2d-0.2.0.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7202ef581eedfb981d3f38e5611e4b43bd8c2ac075de23bee1c0f77174122095
BLAKE2b-256 checksum
How to use checksums
8a7f88807219ed475906c61bab2daec2a1eb8a8d4b6a33b65638e9520b8a7abd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.7

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

Download URL nuc2d-0.2.0-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a403703f3c49d22a6f7a79b4140123023d5c0324341e05f7d5171f11d9c7ca0c
BLAKE2b-256 checksum
How to use checksums
9d446abcb313c75012b0e7ff9b9d8c08660bac4b47d20e089e9874a52885a17e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.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

0.3.0

2 release files

This release

0.2.0 This release

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