@rnacanvas/code 2.0.2 → 3.0.0
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.
- package/README.md +23 -0
- package/dist/main.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -26,6 +26,29 @@ app.drawing.setPadding(500);
|
|
|
26
26
|
app.drawingView.fitToContent();
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
### Drawing from schema
|
|
30
|
+
|
|
31
|
+
[RNA 2D JSON schemas](https://docs.r2dt.bio/en/latest/editors.html#rna-2d-json-schema)
|
|
32
|
+
(generated by tools such as [R2DT](https://rnacentral.org/r2dt))
|
|
33
|
+
can be directly drawn.
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
// a URL to an RNA 2D JSON schema
|
|
37
|
+
var schemaURL = 'https://www.ebi.ac.uk/Tools/services/rest/r2dt/result/r2dt-R20240905-135809-0737-54467708-p1m/json';
|
|
38
|
+
|
|
39
|
+
fetch(schemaURL)
|
|
40
|
+
.then(response => response.text())
|
|
41
|
+
.then(text => app.drawSchema(JSON.parse(text)))
|
|
42
|
+
// ensure the drawing is big enough to fit the drawn structure
|
|
43
|
+
.then(() => app.drawing.setPadding(1000))
|
|
44
|
+
// fit the user's view of the drawing to the drawn structure
|
|
45
|
+
.then(() => app.drawingView.fitToContent());
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Note that this method may throw for invalid schemas,
|
|
49
|
+
in which case the drawing of the app may be left in a partially drawn state
|
|
50
|
+
(e.g., with only part of a schema having been drawn).
|
|
51
|
+
|
|
29
52
|
### Controlling the layout of bases
|
|
30
53
|
|
|
31
54
|
See the [full documentation](https://pzhaojohnson.github.io/rnacanvas.bases-layout/)
|