rna-draw 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rna_draw-0.2.0/CHANGELOG.md +145 -0
- rna_draw-0.2.0/CMakeLists.txt +182 -0
- rna_draw-0.2.0/LICENSE +21 -0
- rna_draw-0.2.0/Makefile +45 -0
- rna_draw-0.2.0/PKG-INFO +132 -0
- rna_draw-0.2.0/README.md +104 -0
- rna_draw-0.2.0/include/rna_layout/batch.hpp +55 -0
- rna_draw-0.2.0/include/rna_layout/bounding_boxes.hpp +119 -0
- rna_draw-0.2.0/include/rna_layout/bounding_wedge.hpp +46 -0
- rna_draw-0.2.0/include/rna_layout/config.hpp +129 -0
- rna_draw-0.2.0/include/rna_layout/config_tree.hpp +173 -0
- rna_draw-0.2.0/include/rna_layout/constructive_area_min.hpp +41 -0
- rna_draw-0.2.0/include/rna_layout/constructive_compaction.hpp +97 -0
- rna_draw-0.2.0/include/rna_layout/constructive_engine.hpp +105 -0
- rna_draw-0.2.0/include/rna_layout/constructive_envelope.hpp +114 -0
- rna_draw-0.2.0/include/rna_layout/constructive_geometry.hpp +184 -0
- rna_draw-0.2.0/include/rna_layout/debug_dump.hpp +91 -0
- rna_draw-0.2.0/include/rna_layout/edit.hpp +127 -0
- rna_draw-0.2.0/include/rna_layout/fallback.hpp +47 -0
- rna_draw-0.2.0/include/rna_layout/geometry.hpp +234 -0
- rna_draw-0.2.0/include/rna_layout/intersect_tree.hpp +263 -0
- rna_draw-0.2.0/include/rna_layout/intersections.hpp +169 -0
- rna_draw-0.2.0/include/rna_layout/layout_options.hpp +217 -0
- rna_draw-0.2.0/include/rna_layout/nucleotide_coords.hpp +54 -0
- rna_draw-0.2.0/include/rna_layout/overlap_batch.hpp +56 -0
- rna_draw-0.2.0/include/rna_layout/overlap_check.hpp +268 -0
- rna_draw-0.2.0/include/rna_layout/overlap_geometry.hpp +119 -0
- rna_draw-0.2.0/include/rna_layout/pair_table.hpp +64 -0
- rna_draw-0.2.0/include/rna_layout/pipeline.hpp +206 -0
- rna_draw-0.2.0/include/rna_layout/postpass.hpp +232 -0
- rna_draw-0.2.0/include/rna_layout/pseudoknot_docking.hpp +50 -0
- rna_draw-0.2.0/include/rna_layout/pseudoknot_engine.hpp +79 -0
- rna_draw-0.2.0/include/rna_layout/pseudoknot_extraction.hpp +46 -0
- rna_draw-0.2.0/include/rna_layout/pseudoknot_parsing.hpp +64 -0
- rna_draw-0.2.0/include/rna_layout/pseudoknot_placement.hpp +82 -0
- rna_draw-0.2.0/include/rna_layout/pseudoknot_proximity.hpp +83 -0
- rna_draw-0.2.0/include/rna_layout/pseudoknot_routing.hpp +107 -0
- rna_draw-0.2.0/include/rna_layout/pseudoknot_validate.hpp +62 -0
- rna_draw-0.2.0/include/rna_layout/puzzler.hpp +62 -0
- rna_draw-0.2.0/include/rna_layout/reactivity_io.hpp +95 -0
- rna_draw-0.2.0/include/rna_layout/render_svg.hpp +110 -0
- rna_draw-0.2.0/include/rna_layout/resolve.hpp +120 -0
- rna_draw-0.2.0/include/rna_layout/resolve_exterior.hpp +72 -0
- rna_draw-0.2.0/include/rna_layout/spatial_hash.hpp +143 -0
- rna_draw-0.2.0/include/rna_layout/structure_io.hpp +93 -0
- rna_draw-0.2.0/include/rna_layout/structure_tree.hpp +125 -0
- rna_draw-0.2.0/include/rna_layout/tree.hpp +80 -0
- rna_draw-0.2.0/include/rna_layout/turtle.hpp +91 -0
- rna_draw-0.2.0/include/rna_layout/types.hpp +182 -0
- rna_draw-0.2.0/pyproject.toml +112 -0
- rna_draw-0.2.0/rna_draw/__init__.py +28 -0
- rna_draw-0.2.0/rna_draw/__main__.py +6 -0
- rna_draw-0.2.0/rna_draw/_layout_core.pyi +106 -0
- rna_draw-0.2.0/rna_draw/colorer.py +230 -0
- rna_draw-0.2.0/rna_draw/data.py +128 -0
- rna_draw-0.2.0/rna_draw/document.py +144 -0
- rna_draw-0.2.0/rna_draw/document_render.py +411 -0
- rna_draw-0.2.0/rna_draw/document_schema.py +306 -0
- rna_draw-0.2.0/rna_draw/draw.py +599 -0
- rna_draw-0.2.0/rna_draw/figure.py +266 -0
- rna_draw-0.2.0/rna_draw/geometry.py +286 -0
- rna_draw-0.2.0/rna_draw/io_formats.py +47 -0
- rna_draw-0.2.0/rna_draw/layout/__init__.py +114 -0
- rna_draw-0.2.0/rna_draw/layout/base.py +172 -0
- rna_draw-0.2.0/rna_draw/overlap.py +519 -0
- rna_draw-0.2.0/rna_draw/overlap_native.py +135 -0
- rna_draw-0.2.0/rna_draw/parameters.py +16 -0
- rna_draw-0.2.0/rna_draw/reactivity/__init__.py +46 -0
- rna_draw-0.2.0/rna_draw/reactivity/align.py +56 -0
- rna_draw-0.2.0/rna_draw/reactivity/loader.py +91 -0
- rna_draw-0.2.0/rna_draw/reactivity/model.py +153 -0
- rna_draw-0.2.0/rna_draw/render_rna.py +432 -0
- rna_draw-0.2.0/rna_draw/scene.py +223 -0
- rna_draw-0.2.0/rna_draw/schema_utils.py +65 -0
- rna_draw-0.2.0/rna_draw/settings.py +27 -0
- rna_draw-0.2.0/rna_draw/spatial_hash.py +113 -0
- rna_draw-0.2.0/rna_draw/style.py +238 -0
- rna_draw-0.2.0/rna_draw/validate.py +276 -0
- rna_draw-0.2.0/src/layout_core/batch.cpp +94 -0
- rna_draw-0.2.0/src/layout_core/bindings.cpp +1298 -0
- rna_draw-0.2.0/src/layout_core/bindings_wasm.cpp +702 -0
- rna_draw-0.2.0/src/layout_core/bounding_boxes.cpp +252 -0
- rna_draw-0.2.0/src/layout_core/bounding_wedge.cpp +148 -0
- rna_draw-0.2.0/src/layout_core/broad_phase.cpp +307 -0
- rna_draw-0.2.0/src/layout_core/config.cpp +336 -0
- rna_draw-0.2.0/src/layout_core/config_changes.cpp +67 -0
- rna_draw-0.2.0/src/layout_core/config_tree.cpp +273 -0
- rna_draw-0.2.0/src/layout_core/constructive_area_min.cpp +268 -0
- rna_draw-0.2.0/src/layout_core/constructive_compaction.cpp +356 -0
- rna_draw-0.2.0/src/layout_core/constructive_engine.cpp +304 -0
- rna_draw-0.2.0/src/layout_core/constructive_envelope.cpp +370 -0
- rna_draw-0.2.0/src/layout_core/constructive_geometry.cpp +288 -0
- rna_draw-0.2.0/src/layout_core/debug_dump.cpp +60 -0
- rna_draw-0.2.0/src/layout_core/deltas.cpp +401 -0
- rna_draw-0.2.0/src/layout_core/diagrams.cpp +40 -0
- rna_draw-0.2.0/src/layout_core/edit.cpp +466 -0
- rna_draw-0.2.0/src/layout_core/exterior_boxes.cpp +100 -0
- rna_draw-0.2.0/src/layout_core/exterior_shape.cpp +189 -0
- rna_draw-0.2.0/src/layout_core/fallback.cpp +127 -0
- rna_draw-0.2.0/src/layout_core/geometry.cpp +236 -0
- rna_draw-0.2.0/src/layout_core/intersect_boxes.cpp +114 -0
- rna_draw-0.2.0/src/layout_core/intersect_tree.cpp +274 -0
- rna_draw-0.2.0/src/layout_core/intersections.cpp +298 -0
- rna_draw-0.2.0/src/layout_core/nucleotide_coords.cpp +184 -0
- rna_draw-0.2.0/src/layout_core/optimize.cpp +219 -0
- rna_draw-0.2.0/src/layout_core/optimize2.cpp +318 -0
- rna_draw-0.2.0/src/layout_core/orient.cpp +89 -0
- rna_draw-0.2.0/src/layout_core/overlap_batch.cpp +116 -0
- rna_draw-0.2.0/src/layout_core/overlap_check.cpp +530 -0
- rna_draw-0.2.0/src/layout_core/overlap_geometry.cpp +127 -0
- rna_draw-0.2.0/src/layout_core/pair_table.cpp +78 -0
- rna_draw-0.2.0/src/layout_core/pipeline.cpp +840 -0
- rna_draw-0.2.0/src/layout_core/postpass.cpp +485 -0
- rna_draw-0.2.0/src/layout_core/pseudoknot_docking.cpp +298 -0
- rna_draw-0.2.0/src/layout_core/pseudoknot_engine.cpp +141 -0
- rna_draw-0.2.0/src/layout_core/pseudoknot_extraction.cpp +145 -0
- rna_draw-0.2.0/src/layout_core/pseudoknot_parsing.cpp +121 -0
- rna_draw-0.2.0/src/layout_core/pseudoknot_placement.cpp +150 -0
- rna_draw-0.2.0/src/layout_core/pseudoknot_proximity.cpp +147 -0
- rna_draw-0.2.0/src/layout_core/pseudoknot_routing.cpp +186 -0
- rna_draw-0.2.0/src/layout_core/pseudoknot_validate.cpp +107 -0
- rna_draw-0.2.0/src/layout_core/puzzler.cpp +113 -0
- rna_draw-0.2.0/src/layout_core/reactivity_io.cpp +985 -0
- rna_draw-0.2.0/src/layout_core/render_svg.cpp +1750 -0
- rna_draw-0.2.0/src/layout_core/resolve.cpp +125 -0
- rna_draw-0.2.0/src/layout_core/resolve_ancestors.cpp +254 -0
- rna_draw-0.2.0/src/layout_core/resolve_exterior.cpp +209 -0
- rna_draw-0.2.0/src/layout_core/resolve_internal.hpp +521 -0
- rna_draw-0.2.0/src/layout_core/resolve_siblings.cpp +150 -0
- rna_draw-0.2.0/src/layout_core/rotation_angle.cpp +210 -0
- rna_draw-0.2.0/src/layout_core/rotation_angle2.cpp +207 -0
- rna_draw-0.2.0/src/layout_core/spatial_hash.cpp +227 -0
- rna_draw-0.2.0/src/layout_core/structure_io.cpp +459 -0
- rna_draw-0.2.0/src/layout_core/structure_tree.cpp +173 -0
- rna_draw-0.2.0/src/layout_core/tighten_loops.cpp +284 -0
- rna_draw-0.2.0/src/layout_core/turtle.cpp +549 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
What each version changed for the people who use rna_draw. Add a line under **Unreleased** with any
|
|
4
|
+
change a user would notice.
|
|
5
|
+
|
|
6
|
+
## Unreleased
|
|
7
|
+
|
|
8
|
+
## 0.2.0
|
|
9
|
+
|
|
10
|
+
- Exported images keep their letters at any circle size: a PNG or SVG no longer shows dots where the
|
|
11
|
+
screen shows letters.
|
|
12
|
+
- In the trace style a strand of one nucleotide is drawn as a point, and the Backbone switch says
|
|
13
|
+
that the trace is the backbone instead of offering to hide it.
|
|
14
|
+
- Where two strands meet, each 5′ and 3′ label sits by its own nucleotide.
|
|
15
|
+
- The Letters style leaves a visible piece of backbone between letters.
|
|
16
|
+
- SVG files write see-through colors as a color and an opacity, which Inkscape reads.
|
|
17
|
+
- A scene opened from a table is still found by its row's other columns after a save and reopen.
|
|
18
|
+
- Grid tiles count nucleotides, not strand breaks, and show the start of the sequence when two
|
|
19
|
+
scenes share a name.
|
|
20
|
+
- The editor names the nucleotide an edit acts on and what it pairs with; Export shows the size of
|
|
21
|
+
the PNG; Go to says which numbers the drawing holds; position numbers are easier to read.
|
|
22
|
+
- Layout: *Pseudoknots* is a choice (as lines, as helices) like the others. The layers under
|
|
23
|
+
*Customize appearance* carry small pictures.
|
|
24
|
+
- On a phone the header takes two lines, the legend sits above the zoom buttons, and the panel
|
|
25
|
+
under the drawing folds away to give the drawing the screen.
|
|
26
|
+
|
|
27
|
+
### Editor
|
|
28
|
+
|
|
29
|
+
- A sequence that comes without a structure is drawn as its predicted fold (ViennaRNA's minimum
|
|
30
|
+
free energy fold), whether typed, pasted or opened from a file such as FASTA; one strand, under
|
|
31
|
+
500 nt. **MFE** is lit, as when the fold is asked for by hand.
|
|
32
|
+
- Turning a helix with **Rotate** no longer throws the loop's unpaired nucleotides on top of each
|
|
33
|
+
other: a run longer than half the loop stays on its side, and the helix stops before either of
|
|
34
|
+
its ends reaches the next stem.
|
|
35
|
+
- The side panel starts with **Drawing style**, each choice with a small picture of the same three
|
|
36
|
+
nucleotides; the detailed controls are under **Customize appearance**, each row saying its
|
|
37
|
+
setting in words ("Numbers every 10 nt").
|
|
38
|
+
- Top bar: the name, **Open** and **Save** sit together, **+ Scene** is beside the scene
|
|
39
|
+
navigation, and **Help** is beside the theme switch.
|
|
40
|
+
- The tools show their names, in neutral icons; the one in hand takes the accent color. A tool's
|
|
41
|
+
how-to line leaves once the tool has been used.
|
|
42
|
+
- The canvas is plain; **Dot grid behind the drawing** under Customize appearance brings the dots back.
|
|
43
|
+
- Zoom reads **− 167% + Fit**: Fit is its own button.
|
|
44
|
+
- The grid puts two scenes side by side on a wide window, each with its name above it (in the
|
|
45
|
+
grid export too).
|
|
46
|
+
- Sequence and Structure line up letter over bracket, with their labels in one column.
|
|
47
|
+
|
|
48
|
+
- Values typed or pasted belong to the drawing they were pasted on: they move with their
|
|
49
|
+
nucleotides when one is inserted or deleted, come back with undo and redo, and are dropped when
|
|
50
|
+
another structure is opened. The Data panel names them **Pasted values**, with their own coverage
|
|
51
|
+
and range; they take the place of a data file.
|
|
52
|
+
- A pasted entry that is not a number is refused by position and text (`Value 3 ("oops")`), not
|
|
53
|
+
drawn as missing. `NA` stays the way to write a missing value.
|
|
54
|
+
- Saved while **MFE** is shown, a drawing keeps the structure as given: after opening it again,
|
|
55
|
+
**Target** puts that structure back.
|
|
56
|
+
- Export has **Include measurement legend**: the color ramp, the values at its ends and the color
|
|
57
|
+
of a missing value, under the drawing, in SVG and PNG.
|
|
58
|
+
- A highlight on a single nucleotide shows on the canvas and in PNG.
|
|
59
|
+
- A `.ct` file whose strands end (a row with no next row) opens as separate strands. A `.ct` or
|
|
60
|
+
`.bpseq` file whose pairs do not agree (row 1 names 9, row 9 names nothing) is refused, naming
|
|
61
|
+
both rows.
|
|
62
|
+
- A table row that cannot be drawn says why in its grid tile and opens with its own text in the
|
|
63
|
+
Sequence and Structure fields; putting it right there draws it, and the scene keeps the
|
|
64
|
+
correction.
|
|
65
|
+
- An open menu (Export, Help) takes the keyboard: Tab moves through it, Escape closes it and hands
|
|
66
|
+
the focus back, and Delete or a letter no longer edits the drawing behind it.
|
|
67
|
+
- Deleting a nucleotide no longer shows a stray `undefined` label while the new layout is made.
|
|
68
|
+
|
|
69
|
+
- Data read from a file stays with its scene: stepping to another scene and back, saving and
|
|
70
|
+
opening again all keep the values, the missing positions and the range.
|
|
71
|
+
- Undo and redo still work after a visit to another scene.
|
|
72
|
+
- With the grid on screen, **Export** offers the grid as one SVG or PNG, each scene with its name;
|
|
73
|
+
the menu says which scene the single export writes.
|
|
74
|
+
- **Save** is off, and says why, while the sequence and structure typed are not what is drawn.
|
|
75
|
+
- A data file's summary counts measured values in one way: "3 of 9 residues have values (5 rows
|
|
76
|
+
supplied, 2 missing)".
|
|
77
|
+
- When a data file's positions fit counted from 0 and from 1, the Data panel asks which.
|
|
78
|
+
- A structure file that cannot be read shows one message and leaves the drawing and its data alone.
|
|
79
|
+
- A search with no match says so in the drawing area, with **Clear search**.
|
|
80
|
+
- Zoom out no longer enlarges a drawing that fits below the smallest zoom.
|
|
81
|
+
- **Go to** beside the zoom buttons selects a nucleotide by number and centers on it.
|
|
82
|
+
- The shape, font, pair and numbering choices tell screen readers which is on.
|
|
83
|
+
|
|
84
|
+
- A session holds many scenes: a table row, a record of a multi-record file, or a copy made with
|
|
85
|
+
**+ Scene**. Each scene keeps its own style, coloring and layers; **Apply this look to all scenes**
|
|
86
|
+
copies one look to every scene. The grid draws each scene as it was left, hand moves and painted
|
|
87
|
+
colors included.
|
|
88
|
+
- Filter bar: narrow scenes by a sequence and structure motif and by length. Keys step through
|
|
89
|
+
scenes and switch to the grid.
|
|
90
|
+
- **Target | MFE** switches between the given structure and the predicted fold, and can mark where
|
|
91
|
+
the two differ.
|
|
92
|
+
- Pair symbols are drawn between the nucleotides and helices widen to make room for them. Position
|
|
93
|
+
numbers sit on the outside of the structure.
|
|
94
|
+
- Undo takes back every change, including style, numbering and layout, one whole step at a time.
|
|
95
|
+
- Backbone color can be set. A hint says when the circles cover the backbone.
|
|
96
|
+
- A transparent export has real holes inside rings and letters instead of disks in the canvas color.
|
|
97
|
+
- A pseudoknot is marked on the outside of its loop, and its dashed line goes around the drawing
|
|
98
|
+
instead of through nucleotides, helices and loops, in a few straight pieces that keep a gap from both. Pseudoknot pairs are colored as paired and can
|
|
99
|
+
be unpaired.
|
|
100
|
+
- Dot-bracket text may wrap over several lines or put sequence and structure side by side. A
|
|
101
|
+
bracket with no partner is refused instead of drawn unpaired.
|
|
102
|
+
- Data values opened or pasted for a scene are saved with the session.
|
|
103
|
+
- Works on a phone: menus fit the screen and pinch zooms. The view cannot be scrolled past the
|
|
104
|
+
structure.
|
|
105
|
+
- A file that cannot be opened (a saved drawing that is not one, a structure with a bracket
|
|
106
|
+
missing) leaves the scenes on screen as they were.
|
|
107
|
+
- While the grid is shown, keys no longer edit the scene behind it; ⌘Enter draws only from the
|
|
108
|
+
structure box, and not over a layout under way.
|
|
109
|
+
- **Add pair** works on a pseudoknot pair. Letters deleted in the strip leave the drawing too.
|
|
110
|
+
- Undo and redo keep a helix or nucleotide picked with Move or Rotate selected, and redo brings
|
|
111
|
+
back values that the undo of an edit took away.
|
|
112
|
+
- **Target** pressed while the target is shown no longer reverts edits made by hand; when the
|
|
113
|
+
sequence was edited and the structure given no longer fits, the editor says so.
|
|
114
|
+
- Values read from a data file keep the file's name after a change of scene and in a saved file. A
|
|
115
|
+
row whose values cannot be read still shows its structure in the grid.
|
|
116
|
+
- Drawing the same molecule again keeps its values, whether they were typed or read from a file.
|
|
117
|
+
- An arrow key held down to move a selection is one undo step. A drawing with edits still being
|
|
118
|
+
laid out is not left for another scene until the layout is done.
|
|
119
|
+
|
|
120
|
+
### Python
|
|
121
|
+
|
|
122
|
+
- `figure` and `grid`: with no `background` the figure is transparent, rings and letters included; a
|
|
123
|
+
chosen `background` also fills them. Pseudoknots are marked outside their loops, as in the editor.
|
|
124
|
+
- `figure` raises `ValueError` for a bracket with no partner, and accepts NumPy arrays as `data`.
|
|
125
|
+
- The PNG command line and `layout_guaranteed` read `+` and `&` as strand separators instead of
|
|
126
|
+
drawing them as nucleotides. Bad input prints a one-line error.
|
|
127
|
+
- seaborn is no longer a dependency. The unused `motif` option of the PNG renderer is gone.
|
|
128
|
+
- `.ct` and `.bpseq` files numbered from elsewhere (11–16), or with a gap in the numbers, keep
|
|
129
|
+
their pairs; a row number given twice or a partner the file does not hold is refused by number.
|
|
130
|
+
A nucleotide the alphabet lacks (`P`, `m6A`, `-`) is read as `N`.
|
|
131
|
+
- Text with a second `>` record is refused instead of joined into one molecule; a table under
|
|
132
|
+
another ending (`.txt`) reports what is wrong with the table.
|
|
133
|
+
- A data table whose header names fewer columns than its rows have (R's `write.table`) is refused
|
|
134
|
+
with the two counts, not read one column off.
|
|
135
|
+
- Circle plots are no longer flagged: neighbours sit one step apart, and a ring of three is widened
|
|
136
|
+
to clear its own backbone.
|
|
137
|
+
- `figure(helix_width=...)` must be a positive number, and `background` cannot add markup to the SVG.
|
|
138
|
+
- `flagged` is documented as it behaves: overlaps, a pseudoknot drawn as a line, or a fallback layout.
|
|
139
|
+
- `parse_structure_file` reads a file of several strands (separated by `+`, as `figure` takes them)
|
|
140
|
+
and refuses a bracket with no partner.
|
|
141
|
+
|
|
142
|
+
## 0.1.0
|
|
143
|
+
|
|
144
|
+
The first version with the C++ layout engine, the SVG figures (`figure`, `grid`), the web and
|
|
145
|
+
desktop editor, the `rna-draw` JavaScript package and the `<rna-draw>` element.
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.15...3.27)
|
|
2
|
+
# A fixed project name (not `${SKBUILD_PROJECT_NAME}`) so this also
|
|
3
|
+
# configures cleanly for a standalone `cmake -B build && cmake --build
|
|
4
|
+
# build && ctest --test-dir build` invocation, not only through
|
|
5
|
+
# scikit-build-core's `pip install -e .`.
|
|
6
|
+
project(rna_draw LANGUAGES CXX C)
|
|
7
|
+
|
|
8
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
9
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
10
|
+
|
|
11
|
+
# Two consumers of ONE engine: the pybind11 module for Python (default) and
|
|
12
|
+
# a WebAssembly module for the web editor (`emcmake cmake -B build-wasm`,
|
|
13
|
+
# detected via the Emscripten toolchain's EMSCRIPTEN variable). The WASM
|
|
14
|
+
# build has no Python in the loop and skips the std::thread batch files.
|
|
15
|
+
if(NOT EMSCRIPTEN)
|
|
16
|
+
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
|
|
17
|
+
endif()
|
|
18
|
+
|
|
19
|
+
# FP REPRODUCIBILITY (cpp-reviewer refinement #1): pin a matched
|
|
20
|
+
# floating-point flag on the native library/module so its geometry is
|
|
21
|
+
# deterministic (no FMA contraction or expression-reassociation drift
|
|
22
|
+
# across builds). Applied to every native target below via
|
|
23
|
+
# `RNA_DRAW_FP_FLAGS`.
|
|
24
|
+
if(MSVC)
|
|
25
|
+
set(RNA_DRAW_FP_FLAGS /fp:precise)
|
|
26
|
+
else()
|
|
27
|
+
set(RNA_DRAW_FP_FLAGS -ffp-contract=off)
|
|
28
|
+
endif()
|
|
29
|
+
|
|
30
|
+
# pybind11 is a build-system requirement (pyproject.toml [build-system]);
|
|
31
|
+
# locate its CMake config via the interpreter that is actually building us,
|
|
32
|
+
# rather than relying on scikit-build-core to pre-populate CMAKE_PREFIX_PATH.
|
|
33
|
+
if(NOT EMSCRIPTEN)
|
|
34
|
+
execute_process(
|
|
35
|
+
COMMAND "${Python_EXECUTABLE}" -m pybind11 --cmakedir
|
|
36
|
+
OUTPUT_VARIABLE pybind11_DIR
|
|
37
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
38
|
+
)
|
|
39
|
+
find_package(pybind11 CONFIG REQUIRED)
|
|
40
|
+
endif()
|
|
41
|
+
|
|
42
|
+
enable_testing()
|
|
43
|
+
|
|
44
|
+
# ---------------------------------------------------------------------------
|
|
45
|
+
# rna_layout: the owned modern-C++ port (Milestone A, cpp-layout-core).
|
|
46
|
+
# A self-contained tree (include/rna_layout, src/layout_core) -- no
|
|
47
|
+
# ViennaRNA header/symbol dependency. It is the shipped production engine
|
|
48
|
+
# (`rna_draw.layout.production`). This slice adds the config-tree/
|
|
49
|
+
# bounding-box/wedge construction (Milestone A step 4) on top of the
|
|
50
|
+
# foundation value types + geometry/config helpers + the turtle-base engine
|
|
51
|
+
# (`rna_layout::layout_turtle`).
|
|
52
|
+
# ---------------------------------------------------------------------------
|
|
53
|
+
set(RNA_LAYOUT_CORE_SOURCES
|
|
54
|
+
src/layout_core/geometry.cpp
|
|
55
|
+
src/layout_core/config.cpp
|
|
56
|
+
src/layout_core/pair_table.cpp
|
|
57
|
+
src/layout_core/turtle.cpp
|
|
58
|
+
src/layout_core/bounding_boxes.cpp
|
|
59
|
+
src/layout_core/config_tree.cpp
|
|
60
|
+
src/layout_core/bounding_wedge.cpp
|
|
61
|
+
src/layout_core/intersections.cpp
|
|
62
|
+
src/layout_core/intersect_boxes.cpp
|
|
63
|
+
src/layout_core/intersect_tree.cpp
|
|
64
|
+
src/layout_core/broad_phase.cpp
|
|
65
|
+
src/layout_core/nucleotide_coords.cpp
|
|
66
|
+
src/layout_core/resolve_exterior.cpp
|
|
67
|
+
src/layout_core/deltas.cpp
|
|
68
|
+
src/layout_core/config_changes.cpp
|
|
69
|
+
src/layout_core/resolve_siblings.cpp
|
|
70
|
+
src/layout_core/rotation_angle.cpp
|
|
71
|
+
src/layout_core/rotation_angle2.cpp
|
|
72
|
+
src/layout_core/exterior_boxes.cpp
|
|
73
|
+
src/layout_core/resolve_ancestors.cpp
|
|
74
|
+
src/layout_core/optimize.cpp
|
|
75
|
+
src/layout_core/optimize2.cpp
|
|
76
|
+
src/layout_core/resolve.cpp
|
|
77
|
+
src/layout_core/puzzler.cpp
|
|
78
|
+
src/layout_core/debug_dump.cpp
|
|
79
|
+
src/layout_core/overlap_geometry.cpp
|
|
80
|
+
src/layout_core/spatial_hash.cpp
|
|
81
|
+
src/layout_core/overlap_check.cpp
|
|
82
|
+
src/layout_core/structure_tree.cpp
|
|
83
|
+
src/layout_core/postpass.cpp
|
|
84
|
+
src/layout_core/tighten_loops.cpp
|
|
85
|
+
src/layout_core/edit.cpp
|
|
86
|
+
src/layout_core/structure_io.cpp
|
|
87
|
+
src/layout_core/reactivity_io.cpp
|
|
88
|
+
src/layout_core/render_svg.cpp
|
|
89
|
+
src/layout_core/fallback.cpp
|
|
90
|
+
src/layout_core/pipeline.cpp
|
|
91
|
+
src/layout_core/exterior_shape.cpp
|
|
92
|
+
src/layout_core/diagrams.cpp
|
|
93
|
+
src/layout_core/orient.cpp
|
|
94
|
+
src/layout_core/constructive_geometry.cpp
|
|
95
|
+
src/layout_core/constructive_envelope.cpp
|
|
96
|
+
src/layout_core/constructive_compaction.cpp
|
|
97
|
+
src/layout_core/constructive_area_min.cpp
|
|
98
|
+
src/layout_core/constructive_engine.cpp
|
|
99
|
+
src/layout_core/pseudoknot_parsing.cpp
|
|
100
|
+
src/layout_core/pseudoknot_extraction.cpp
|
|
101
|
+
src/layout_core/pseudoknot_placement.cpp
|
|
102
|
+
src/layout_core/pseudoknot_proximity.cpp
|
|
103
|
+
src/layout_core/pseudoknot_docking.cpp
|
|
104
|
+
src/layout_core/pseudoknot_routing.cpp
|
|
105
|
+
src/layout_core/pseudoknot_validate.cpp
|
|
106
|
+
src/layout_core/pseudoknot_engine.cpp
|
|
107
|
+
)
|
|
108
|
+
# The std::thread batch entry points (SPEED lever B1) stay native-only: the
|
|
109
|
+
# WASM build is single-threaded and reaches the engine one call at a time.
|
|
110
|
+
if(NOT EMSCRIPTEN)
|
|
111
|
+
list(APPEND RNA_LAYOUT_CORE_SOURCES
|
|
112
|
+
src/layout_core/batch.cpp
|
|
113
|
+
src/layout_core/overlap_batch.cpp
|
|
114
|
+
)
|
|
115
|
+
endif()
|
|
116
|
+
|
|
117
|
+
add_library(rna_layout_core STATIC ${RNA_LAYOUT_CORE_SOURCES})
|
|
118
|
+
# The Python extension is a shared module: on Linux its static inputs must be position independent.
|
|
119
|
+
set_target_properties(rna_layout_core PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
120
|
+
target_include_directories(rna_layout_core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
|
121
|
+
target_compile_options(rna_layout_core PRIVATE ${RNA_DRAW_FP_FLAGS})
|
|
122
|
+
|
|
123
|
+
if(EMSCRIPTEN)
|
|
124
|
+
# WebAssembly module for the web editor: a flat C ABI (bindings_wasm.cpp)
|
|
125
|
+
# over the same static library. ES6 module, caller-owned buffers on the
|
|
126
|
+
# module heap, growable memory for 5,000-nt structures.
|
|
127
|
+
add_executable(rna_layout_wasm src/layout_core/bindings_wasm.cpp)
|
|
128
|
+
target_link_libraries(rna_layout_wasm PRIVATE rna_layout_core)
|
|
129
|
+
target_compile_options(rna_layout_wasm PRIVATE ${RNA_DRAW_FP_FLAGS} -fwasm-exceptions)
|
|
130
|
+
target_compile_options(rna_layout_core PRIVATE -fwasm-exceptions)
|
|
131
|
+
set_target_properties(rna_layout_wasm PROPERTIES OUTPUT_NAME rna_layout SUFFIX .mjs)
|
|
132
|
+
target_link_options(rna_layout_wasm PRIVATE
|
|
133
|
+
-fwasm-exceptions
|
|
134
|
+
-sMODULARIZE=1 -sEXPORT_ES6=1 -sEXPORT_NAME=createRnaLayout
|
|
135
|
+
-sALLOW_MEMORY_GROWTH=1 -sENVIRONMENT=web,worker,node
|
|
136
|
+
"-sEXPORTED_FUNCTIONS=['_rl_last_error','_rl_structure_length','_rl_layout_puzzler','_rl_check_overlaps_count','_rl_check_overlaps_report','_rl_check_routed_lines','_rl_layout_guaranteed','_rl_last_pair_map','_rl_last_crossing_pairs','_rl_last_crossing_lines','_rl_parent_opener','_rl_loop_ring','_rl_loop_center','_rl_swing_limits','_rl_rotate_helix','_rl_flip_helix','_rl_move_branch','_rl_translate','_rl_flip_drawing','_rl_scale_drawing','_rl_principal_angle','_rl_orient_drawing','_rl_parse_structure','_rl_parsed_field','_rl_strict_pair_map','_rl_parse_reactivity','_rl_reactivity_table','_rl_reactivity_text','_rl_align_reactivity','_malloc','_free']"
|
|
137
|
+
"-sEXPORTED_RUNTIME_METHODS=['cwrap','HEAPF64','HEAP32','UTF8ToString']"
|
|
138
|
+
)
|
|
139
|
+
else()
|
|
140
|
+
# SPEED lever B1 (`.claude/plans/current-plan-speed.md`): `batch.cpp` uses
|
|
141
|
+
# `std::thread`, which needs an explicit pthreads link on some platforms/
|
|
142
|
+
# toolchains (a no-op where the standard library already provides it).
|
|
143
|
+
find_package(Threads REQUIRED)
|
|
144
|
+
target_link_libraries(rna_layout_core PUBLIC Threads::Threads)
|
|
145
|
+
|
|
146
|
+
pybind11_add_module(_layout_core src/layout_core/bindings.cpp)
|
|
147
|
+
target_link_libraries(_layout_core PRIVATE rna_layout_core)
|
|
148
|
+
target_compile_options(_layout_core PRIVATE ${RNA_DRAW_FP_FLAGS})
|
|
149
|
+
|
|
150
|
+
install(TARGETS _layout_core DESTINATION rna_draw)
|
|
151
|
+
|
|
152
|
+
# ctest unit tests: pure C++, no Python/pybind11 in the loop. A pip install
|
|
153
|
+
# (scikit-build-core sets SKBUILD) builds the module only: the 42 test
|
|
154
|
+
# programs took most of the time of an install from source.
|
|
155
|
+
if(SKBUILD)
|
|
156
|
+
return()
|
|
157
|
+
endif()
|
|
158
|
+
foreach(rna_layout_test_name geometry_test config_test turtle_test tree_test
|
|
159
|
+
bounding_boxes_test config_tree_test bounding_wedge_test
|
|
160
|
+
intersections_test intersect_tree_test puzzler_test
|
|
161
|
+
deltas_test resolve_siblings_test resolve_ancestors_test
|
|
162
|
+
optimize_test broad_phase_test overlap_geometry_test
|
|
163
|
+
spatial_hash_test overlap_check_test overlap_batch_test
|
|
164
|
+
structure_tree_test postpass_test edit_test structure_io_test
|
|
165
|
+
reactivity_io_test render_svg_test
|
|
166
|
+
fallback_test pipeline_test exterior_shape_test
|
|
167
|
+
diagrams_test orient_test constructive_geometry_test
|
|
168
|
+
constructive_envelope_test constructive_compaction_test
|
|
169
|
+
constructive_area_min_test constructive_engine_test
|
|
170
|
+
pseudoknot_parsing_test pseudoknot_extraction_test
|
|
171
|
+
pseudoknot_placement_test pseudoknot_proximity_test
|
|
172
|
+
pseudoknot_routing_test pseudoknot_validate_test
|
|
173
|
+
pseudoknot_engine_test)
|
|
174
|
+
add_executable(${rna_layout_test_name} src/layout_core/tests/${rna_layout_test_name}.cpp)
|
|
175
|
+
target_link_libraries(${rna_layout_test_name} PRIVATE rna_layout_core)
|
|
176
|
+
target_compile_options(${rna_layout_test_name} PRIVATE ${RNA_DRAW_FP_FLAGS})
|
|
177
|
+
# Tests that read repo fixtures (e.g. the mockup scene JSON) find them here.
|
|
178
|
+
target_compile_definitions(${rna_layout_test_name}
|
|
179
|
+
PRIVATE RNA_DRAW_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
|
|
180
|
+
add_test(NAME ${rna_layout_test_name} COMMAND ${rna_layout_test_name})
|
|
181
|
+
endforeach()
|
|
182
|
+
endif()
|
rna_draw-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yesselman Lab, University of Nebraska–Lincoln
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
rna_draw-0.2.0/Makefile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# The development checks, in one place. `make check` after a change (about half a minute), `make full`
|
|
2
|
+
# before a push (about two minutes). After a change to the C++, `make engine` first.
|
|
3
|
+
MAKEFLAGS += --jobs=4 --output-sync=target
|
|
4
|
+
BIN ?= .venv/bin/
|
|
5
|
+
# Some tools (Node, Ninja) make the pipes they are handed non-blocking, which stops macOS's make 3.81
|
|
6
|
+
# from handing out jobs: its two are kept from every recipe.
|
|
7
|
+
NO_JOB_PIPE = 3<&- 4<&-
|
|
8
|
+
|
|
9
|
+
.PHONY: check full audit engine python cpp web app desktop docs
|
|
10
|
+
|
|
11
|
+
check: python cpp web
|
|
12
|
+
|
|
13
|
+
full: check app desktop docs
|
|
14
|
+
|
|
15
|
+
# Rebuilds what is made from the C++: the test programs, the Python extension, the editor's WebAssembly.
|
|
16
|
+
engine:
|
|
17
|
+
(cmake --build build) $(NO_JOB_PIPE)
|
|
18
|
+
(uv pip install -q --python $(BIN)python -e .) $(NO_JOB_PIPE)
|
|
19
|
+
(cd web && npm run -s wasm) $(NO_JOB_PIPE)
|
|
20
|
+
|
|
21
|
+
python:
|
|
22
|
+
($(BIN)ruff check -q .) $(NO_JOB_PIPE)
|
|
23
|
+
($(BIN)pytest -q -n 4) $(NO_JOB_PIPE)
|
|
24
|
+
|
|
25
|
+
cpp:
|
|
26
|
+
(cmake --build build > /dev/null) $(NO_JOB_PIPE)
|
|
27
|
+
(ctest --test-dir build --output-on-failure | tail -3) $(NO_JOB_PIPE)
|
|
28
|
+
(node web/spike/harness.mjs "$(CURDIR)/build-wasm/rna_layout.mjs" web/spike/fixtures.json | tail -1) $(NO_JOB_PIPE)
|
|
29
|
+
|
|
30
|
+
web:
|
|
31
|
+
(cd web && npm run -s check && npm test -s) $(NO_JOB_PIPE)
|
|
32
|
+
|
|
33
|
+
# The built editor in headless Chromium.
|
|
34
|
+
app:
|
|
35
|
+
(cd web && npm run -s build && npm run -s build:lib && npm run -s test:render) $(NO_JOB_PIPE)
|
|
36
|
+
|
|
37
|
+
desktop: app
|
|
38
|
+
(cd electron && npm test -s) $(NO_JOB_PIPE)
|
|
39
|
+
|
|
40
|
+
docs:
|
|
41
|
+
(uvx mkdocs build --strict -q -d build/docs-site) $(NO_JOB_PIPE)
|
|
42
|
+
|
|
43
|
+
# The slower visual audit, run now and then.
|
|
44
|
+
audit:
|
|
45
|
+
(cd web && npm run -s build && npm run -s test:audit) $(NO_JOB_PIPE)
|
rna_draw-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rna_draw
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Draw nucleic acid secondary structures with layouts that are checked for overlaps.
|
|
5
|
+
Keywords: RNA,secondary structure,visualization,bioinformatics
|
|
6
|
+
Author-Email: Joe Yesselman <jyesselm@unl.edu>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: C++
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
13
|
+
Project-URL: Homepage, https://github.com/YesselmanLab/rna_draw
|
|
14
|
+
Project-URL: Documentation, https://yesselmanlab.github.io/rna_draw/docs/
|
|
15
|
+
Project-URL: Editor, https://yesselmanlab.github.io/rna_draw/
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Requires-Dist: matplotlib
|
|
18
|
+
Requires-Dist: numpy
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
22
|
+
Requires-Dist: pytest-timeout; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
24
|
+
Requires-Dist: ruff; extra == "dev"
|
|
25
|
+
Requires-Dist: mypy; extra == "dev"
|
|
26
|
+
Requires-Dist: scipy; extra == "dev"
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
<h1 align="center">rna_draw</h1>
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
Draw, edit and compare nucleic acid secondary structures.<br>
|
|
33
|
+
One C++ layout engine behind an interactive editor, a Python library for notebooks and a command line.
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<a href="https://yesselmanlab.github.io/rna_draw/"><b>Open the editor in your browser</b></a>
|
|
38
|
+
·
|
|
39
|
+
<a href="https://yesselmanlab.github.io/rna_draw/docs/"><b>Documentation</b></a>
|
|
40
|
+
·
|
|
41
|
+
<a href="https://colab.research.google.com/github/YesselmanLab/rna_draw/blob/main/examples/rna_draw_demo.ipynb"><b>Try the Python library in Google Colab</b></a>
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<a href="https://github.com/YesselmanLab/rna_draw/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/YesselmanLab/rna_draw/actions/workflows/ci.yml/badge.svg"></a>
|
|
46
|
+
<img alt="Python 3.9+" src="https://img.shields.io/badge/python-3.9%2B-3776ab">
|
|
47
|
+
<img alt="C++17" src="https://img.shields.io/badge/C%2B%2B-17-00599c">
|
|
48
|
+
<img alt="WebAssembly" src="https://img.shields.io/badge/engine-WebAssembly-654ff0">
|
|
49
|
+
</p>
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
## Why rna_draw
|
|
54
|
+
|
|
55
|
+
- **Independent overlap validation.** Each layout is evaluated by an independent overlap checker,
|
|
56
|
+
and any detected overlaps are explicitly flagged. This validation applies across structures ranging
|
|
57
|
+
from 13-nucleotide hairpins to 4,000-nucleotide rRNAs, including structures containing pseudoknots.
|
|
58
|
+
- **Consistent rendering across interfaces.** A shared C++17 layout engine is compiled natively for
|
|
59
|
+
Python and to WebAssembly for the browser-based editor, ensuring consistent layouts across the
|
|
60
|
+
editor, library, and command-line interface.
|
|
61
|
+
- **Computational efficiency.** Typical structures are laid out in milliseconds. The editor operates
|
|
62
|
+
entirely within the browser, without requiring a server.
|
|
63
|
+
- **Data-driven visualization.** Nucleotides can be colored by base identity, pairing status,
|
|
64
|
+
structural element, sequence position, strand, or per-nucleotide measurements, including DMS and
|
|
65
|
+
SHAPE reactivities.
|
|
66
|
+
- **Notebook integration.** Individual figures, grids of multiple structures, and an embedded
|
|
67
|
+
interactive editor are each accessible through a single function call.
|
|
68
|
+
|
|
69
|
+
## Use it
|
|
70
|
+
|
|
71
|
+
| You want to | Use |
|
|
72
|
+
|---|---|
|
|
73
|
+
| Draw or edit a structure now | [The editor](https://yesselmanlab.github.io/rna_draw/) in a browser; nothing is installed or uploaded. **Fold** predicts a structure from a sequence. ([guide](https://yesselmanlab.github.io/rna_draw/docs/editor/)) |
|
|
74
|
+
| Make figures in a script or notebook | The Python library: `rd.figure`, `rd.grid`, `rd.editor`. ([guide](https://yesselmanlab.github.io/rna_draw/docs/python/)) |
|
|
75
|
+
| Look through hundreds of designs | Open a CSV, TSV, JSON or Parquet table in the editor. ([guide](https://yesselmanlab.github.io/rna_draw/docs/editor/)) |
|
|
76
|
+
| Draw structures from your own JavaScript, in a browser or Node | The `rna-draw` npm package: `draw(structure)` returns an SVG. ([guide](https://yesselmanlab.github.io/rna_draw/docs/javascript/)) |
|
|
77
|
+
| Show a structure on your web page | The `<rna-draw>` element, or a link that carries the drawing. ([guide](https://yesselmanlab.github.io/rna_draw/docs/embed/)) |
|
|
78
|
+
| Work offline | The desktop app (`electron/`), or the editor run locally. ([guide](https://yesselmanlab.github.io/rna_draw/docs/editor/)) |
|
|
79
|
+
| Have a coding agent set it up or change it | Point it at [AGENTS.md](https://github.com/YesselmanLab/rna_draw/blob/main/AGENTS.md). |
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import rna_draw as rd
|
|
83
|
+
|
|
84
|
+
rd.figure("(((((....)))))", "GGGACUUCGGUCCC") # an SVG figure; shows inline in a notebook
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<script type="module" src="https://yesselmanlab.github.io/rna_draw/embed.js"></script>
|
|
89
|
+
<rna-draw structure="(((((....)))))" sequence="GGGACUUCGGUCCC"></rna-draw>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
On Linux, which includes Google Colab, the library installs from a prebuilt wheel; elsewhere it
|
|
93
|
+
compiles in under a minute ([install](https://yesselmanlab.github.io/rna_draw/docs/python/)).
|
|
94
|
+
|
|
95
|
+
```shell
|
|
96
|
+
python -m pip install rna_draw --find-links https://github.com/YesselmanLab/rna_draw/releases/expanded_assets/wheels
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## How the layout works
|
|
100
|
+
|
|
101
|
+
Structures pass through up to four engines, most compact first, and the first result that passes the
|
|
102
|
+
overlap checker is used:
|
|
103
|
+
|
|
104
|
+
1. an RNApuzzler-style layout with loop-inflation repair,
|
|
105
|
+
2. a constructive layout that is free of overlaps by construction,
|
|
106
|
+
3. a pseudoknot layout that draws crossing pairs over a nested drawing (a stack of them as one mark:
|
|
107
|
+
a line beside each run of residues and one dashed line joining the two),
|
|
108
|
+
4. a circle, which always succeeds and is always flagged.
|
|
109
|
+
|
|
110
|
+
[docs/layout_algorithm.md](https://yesselmanlab.github.io/rna_draw/docs/layout_algorithm/) describes each stage and the measurements behind
|
|
111
|
+
it.
|
|
112
|
+
|
|
113
|
+
## Development
|
|
114
|
+
|
|
115
|
+
[AGENTS.md](https://github.com/YesselmanLab/rna_draw/blob/main/AGENTS.md) has the setup, build, run and test commands for every part of the repository,
|
|
116
|
+
written so that a person or a coding agent can follow them. Continuous integration runs all the tests
|
|
117
|
+
on Linux for every push. On `main` it also publishes the editor and the documentation to GitHub Pages
|
|
118
|
+
and uploads the Linux wheels to the
|
|
119
|
+
[`wheels` release](https://github.com/YesselmanLab/rna_draw/releases/tag/wheels). Publishing a GitHub release builds the package for Linux, macOS and Windows and
|
|
120
|
+
sends it to PyPI (`.github/workflows/release.yml`).
|
|
121
|
+
[CHANGELOG.md](https://github.com/YesselmanLab/rna_draw/blob/main/CHANGELOG.md) lists what each version changed.
|
|
122
|
+
|
|
123
|
+
## Credits
|
|
124
|
+
|
|
125
|
+
rna_draw is released under the [MIT licence](https://github.com/YesselmanLab/rna_draw/blob/main/LICENSE).
|
|
126
|
+
|
|
127
|
+
Developed by the [Yesselman Lab](https://github.com/YesselmanLab) at the University of
|
|
128
|
+
Nebraska–Lincoln. The primary layout follows the RNApuzzler algorithm (Wiegreffe et al., 2019),
|
|
129
|
+
reimplemented here in C++. Folding in the editor is the
|
|
130
|
+
[ViennaRNA Package](https://www.tbi.univie.ac.at/RNA/) (Lorenz et al., 2011) compiled to WebAssembly,
|
|
131
|
+
under [its own licence](https://github.com/YesselmanLab/rna_draw/blob/main/web/src/engine/fold/VIENNARNA_LICENSE.txt); the layout engine and the Python
|
|
132
|
+
library contain none of it.
|
rna_draw-0.2.0/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<h1 align="center">rna_draw</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
Draw, edit and compare nucleic acid secondary structures.<br>
|
|
5
|
+
One C++ layout engine behind an interactive editor, a Python library for notebooks and a command line.
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://yesselmanlab.github.io/rna_draw/"><b>Open the editor in your browser</b></a>
|
|
10
|
+
·
|
|
11
|
+
<a href="https://yesselmanlab.github.io/rna_draw/docs/"><b>Documentation</b></a>
|
|
12
|
+
·
|
|
13
|
+
<a href="https://colab.research.google.com/github/YesselmanLab/rna_draw/blob/main/examples/rna_draw_demo.ipynb"><b>Try the Python library in Google Colab</b></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://github.com/YesselmanLab/rna_draw/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/YesselmanLab/rna_draw/actions/workflows/ci.yml/badge.svg"></a>
|
|
18
|
+
<img alt="Python 3.9+" src="https://img.shields.io/badge/python-3.9%2B-3776ab">
|
|
19
|
+
<img alt="C++17" src="https://img.shields.io/badge/C%2B%2B-17-00599c">
|
|
20
|
+
<img alt="WebAssembly" src="https://img.shields.io/badge/engine-WebAssembly-654ff0">
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
## Why rna_draw
|
|
26
|
+
|
|
27
|
+
- **Independent overlap validation.** Each layout is evaluated by an independent overlap checker,
|
|
28
|
+
and any detected overlaps are explicitly flagged. This validation applies across structures ranging
|
|
29
|
+
from 13-nucleotide hairpins to 4,000-nucleotide rRNAs, including structures containing pseudoknots.
|
|
30
|
+
- **Consistent rendering across interfaces.** A shared C++17 layout engine is compiled natively for
|
|
31
|
+
Python and to WebAssembly for the browser-based editor, ensuring consistent layouts across the
|
|
32
|
+
editor, library, and command-line interface.
|
|
33
|
+
- **Computational efficiency.** Typical structures are laid out in milliseconds. The editor operates
|
|
34
|
+
entirely within the browser, without requiring a server.
|
|
35
|
+
- **Data-driven visualization.** Nucleotides can be colored by base identity, pairing status,
|
|
36
|
+
structural element, sequence position, strand, or per-nucleotide measurements, including DMS and
|
|
37
|
+
SHAPE reactivities.
|
|
38
|
+
- **Notebook integration.** Individual figures, grids of multiple structures, and an embedded
|
|
39
|
+
interactive editor are each accessible through a single function call.
|
|
40
|
+
|
|
41
|
+
## Use it
|
|
42
|
+
|
|
43
|
+
| You want to | Use |
|
|
44
|
+
|---|---|
|
|
45
|
+
| Draw or edit a structure now | [The editor](https://yesselmanlab.github.io/rna_draw/) in a browser; nothing is installed or uploaded. **Fold** predicts a structure from a sequence. ([guide](https://yesselmanlab.github.io/rna_draw/docs/editor/)) |
|
|
46
|
+
| Make figures in a script or notebook | The Python library: `rd.figure`, `rd.grid`, `rd.editor`. ([guide](https://yesselmanlab.github.io/rna_draw/docs/python/)) |
|
|
47
|
+
| Look through hundreds of designs | Open a CSV, TSV, JSON or Parquet table in the editor. ([guide](https://yesselmanlab.github.io/rna_draw/docs/editor/)) |
|
|
48
|
+
| Draw structures from your own JavaScript, in a browser or Node | The `rna-draw` npm package: `draw(structure)` returns an SVG. ([guide](https://yesselmanlab.github.io/rna_draw/docs/javascript/)) |
|
|
49
|
+
| Show a structure on your web page | The `<rna-draw>` element, or a link that carries the drawing. ([guide](https://yesselmanlab.github.io/rna_draw/docs/embed/)) |
|
|
50
|
+
| Work offline | The desktop app (`electron/`), or the editor run locally. ([guide](https://yesselmanlab.github.io/rna_draw/docs/editor/)) |
|
|
51
|
+
| Have a coding agent set it up or change it | Point it at [AGENTS.md](https://github.com/YesselmanLab/rna_draw/blob/main/AGENTS.md). |
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
import rna_draw as rd
|
|
55
|
+
|
|
56
|
+
rd.figure("(((((....)))))", "GGGACUUCGGUCCC") # an SVG figure; shows inline in a notebook
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```html
|
|
60
|
+
<script type="module" src="https://yesselmanlab.github.io/rna_draw/embed.js"></script>
|
|
61
|
+
<rna-draw structure="(((((....)))))" sequence="GGGACUUCGGUCCC"></rna-draw>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
On Linux, which includes Google Colab, the library installs from a prebuilt wheel; elsewhere it
|
|
65
|
+
compiles in under a minute ([install](https://yesselmanlab.github.io/rna_draw/docs/python/)).
|
|
66
|
+
|
|
67
|
+
```shell
|
|
68
|
+
python -m pip install rna_draw --find-links https://github.com/YesselmanLab/rna_draw/releases/expanded_assets/wheels
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## How the layout works
|
|
72
|
+
|
|
73
|
+
Structures pass through up to four engines, most compact first, and the first result that passes the
|
|
74
|
+
overlap checker is used:
|
|
75
|
+
|
|
76
|
+
1. an RNApuzzler-style layout with loop-inflation repair,
|
|
77
|
+
2. a constructive layout that is free of overlaps by construction,
|
|
78
|
+
3. a pseudoknot layout that draws crossing pairs over a nested drawing (a stack of them as one mark:
|
|
79
|
+
a line beside each run of residues and one dashed line joining the two),
|
|
80
|
+
4. a circle, which always succeeds and is always flagged.
|
|
81
|
+
|
|
82
|
+
[docs/layout_algorithm.md](https://yesselmanlab.github.io/rna_draw/docs/layout_algorithm/) describes each stage and the measurements behind
|
|
83
|
+
it.
|
|
84
|
+
|
|
85
|
+
## Development
|
|
86
|
+
|
|
87
|
+
[AGENTS.md](https://github.com/YesselmanLab/rna_draw/blob/main/AGENTS.md) has the setup, build, run and test commands for every part of the repository,
|
|
88
|
+
written so that a person or a coding agent can follow them. Continuous integration runs all the tests
|
|
89
|
+
on Linux for every push. On `main` it also publishes the editor and the documentation to GitHub Pages
|
|
90
|
+
and uploads the Linux wheels to the
|
|
91
|
+
[`wheels` release](https://github.com/YesselmanLab/rna_draw/releases/tag/wheels). Publishing a GitHub release builds the package for Linux, macOS and Windows and
|
|
92
|
+
sends it to PyPI (`.github/workflows/release.yml`).
|
|
93
|
+
[CHANGELOG.md](https://github.com/YesselmanLab/rna_draw/blob/main/CHANGELOG.md) lists what each version changed.
|
|
94
|
+
|
|
95
|
+
## Credits
|
|
96
|
+
|
|
97
|
+
rna_draw is released under the [MIT licence](https://github.com/YesselmanLab/rna_draw/blob/main/LICENSE).
|
|
98
|
+
|
|
99
|
+
Developed by the [Yesselman Lab](https://github.com/YesselmanLab) at the University of
|
|
100
|
+
Nebraska–Lincoln. The primary layout follows the RNApuzzler algorithm (Wiegreffe et al., 2019),
|
|
101
|
+
reimplemented here in C++. Folding in the editor is the
|
|
102
|
+
[ViennaRNA Package](https://www.tbi.univie.ac.at/RNA/) (Lorenz et al., 2011) compiled to WebAssembly,
|
|
103
|
+
under [its own licence](https://github.com/YesselmanLab/rna_draw/blob/main/web/src/engine/fold/VIENNARNA_LICENSE.txt); the layout engine and the Python
|
|
104
|
+
library contain none of it.
|