VARNA API is a Python interface for [VARNA](http://varna.lri.fr/index.php), a Java lightweight component and applet for drawing the RNA secondary structure.
VARNA allows users to produce drawing in a non-iteractive way via command line.
However, the command line might be massive and complicate in some use cases.
VARNA API aims to simplify such process.
__NOTE__: The VARNA API is 0-indexed unlike VARNA, which is 1-indexed.
## Example
The command below highlights region 11-21 and adds a non-canonical base pair at position (14,20)
on secondary structure `((((((.((((((........)))))).((((((.......))))))..))))))`.
Then we can add operations on drawing by calling object functions, such as `VARNA.set_algorithm()` to choose a drawing algorithm, `VARNA.add_highlight_region()` to highlight a region etc.
```python
v.set_algorithm('line')
v.add_highlight_region(0,5,radius=20)
```
Finally, we can draw the secondary structure
```python
v.savefig(path_to_store)
```
## Credits
Please kindly cite VARNA [supporting manuscript](https://doi.org/10.1093/bioinformatics/btp250) if you use VARNA API in your research.
VARNA API is a Python interface for [VARNA](http://varna.lri.fr/index.php), a Java lightweight component and applet for drawing the RNA secondary structure.
VARNA allows users to produce drawing in a non-iteractive way via command line.
However, the command line might be massive and complicate in some use cases.
VARNA API aims to simplify such process.
__NOTE__: The VARNA API is 0-indexed unlike VARNA, which is 1-indexed.
## Example
The command below highlights region 11-21 and adds a non-canonical base pair at position (14,20)
on secondary structure `((((((.((((((........)))))).((((((.......))))))..))))))`.
Then we can add operations on drawing by calling object functions, such as `VARNA.set_algorithm()` to choose a drawing algorithm, `VARNA.add_highlight_region()` to highlight a region etc.
```python
v.set_algorithm('line')
v.add_highlight_region(0,5,radius=20)
```
Finally, we can draw the secondary structure
```python
v.savefig(path_to_store)
```
## Credits
Please kindly cite VARNA [supporting manuscript](https://doi.org/10.1093/bioinformatics/btp250) if you use VARNA API in your research.
We offer two python classes [VARNA](#varnaapi.VARNA) and [Comparison](#varnaapi.Comparison) corresponding to the classic mode and the comparison mode in VARNA.
In VARNA API, we offer three Python classes [VARNA](#varnaapi.VARNA), [Comparison](#varnaapi.Comparison), and [Motif](#varnaapi.Motif) for RNA secondary structure visualisation.
The first two correspond to the classic and the comparison mode in VARNA. The last one is the special case for motif drawing.
Both [Comparison](#varnaapi.Comparison) and [Motif](#varnaapi.Motif) are inherited classes of [VARNA](#varnaapi.VARNA).
| flat | In `radiate` drawing mode, redraws the whole structure, aligning to a baseline the base featured on the exterior loops (aka "dangling ends") | False |
[^1]: Since there is no canonical definition of pseudoknotted portions, a maximal planar subset is extracted from the input structure, defined to be the planar portion, and used as a scaffold for the drawing algorithms.