Commit 9556c939 authored by htyao's avatar htyao
Browse files

Home page

parent 5164053a
......@@ -3,7 +3,6 @@ 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
......@@ -42,21 +41,75 @@ ss = "((((((.((((((........)))))).((((((.......))))))..))))))"
v = varnaapi.Structure(structure=ss)
The object contains a member function to save the drawing into
One can call the member function `#!python BasicDraw.savefig()` with given file name to save the drawing. The format is either `png` or `svg`, that VARNA will determine from the file name.
While using jupyter notebook, one can also set the option `show` to `#!python True` to show the drawing in the notebook
v.savefig("my_drawing.png", show=True)
or simply use the member function `#!python`.
The later one creates a temporary file in `png` format for drawing.
### Configuration
### Operations
Then we can add operations on drawing by calling member functions, such as `VARNA.set_algorithm()` to choose a drawing algorithm, `VARNA.add_highlight_region()` to highlight a region etc.
In VARNA, one can chose the structure drawing algorithm, change the style for base pair, or hide backbone in drawing etc.
The full list of parameters with default value can be found here.
In library, the easiest way to modify these parameters is through the member function `#!python BasicDraw.update()`.
Some parameters, such as algorithm, can be set up via specific function. The rest will be supported in future update.
v.update(algorithm='naview', baStyle='none', drawBackbone=False, np='#006400')
!!! note "Color parameters"
Value for all color parameters in VARNA API should be readable by the object [colour.Color](, such as human color name, hex, RGB etc.
#### Save configuration
The library offers function to save the parameters setting in YAML format for the further use.
#### Load configuration
There are two ways to load the saved configuration.
The first one is using the member function of `BasicDraw`.
The second way is loading the configuration as a global setting in the opened session.
!!! note "Parameter value priority order"
VARNA API uses parameter values in the following order, _i.e._ if the value in the current order is undefined, then the next one is used
- Value set by `varnaapi.BasicDraw.update()` or similar functions
- Object Value loaded using `varnaapi.BasicDraw.load_param()`
- Global values loaded using `varnaapi.load_cofig()`
- Default parameter values.
#### Operations
VARNA allows different operations on drawing, such as highlighting a region, adding auxiliary base pairs.
This can be achieved by using the proper functions. We invite users to read API for more details.
v.add_highlight_region(0, 5, radius=20)
v.add_aux_bp(0, 9, color='red')
Finally, we can draw the secondary structure
!!! note "The VARNA API is 0-indexed unlike VARNA, which is 1-indexed."
## Credits
Please kindly cite VARNA [supporting manuscript]( if you use VARNA API in your research.
......@@ -32,4 +32,6 @@ plugins:
- footnotes
- pymdownx.highlight
- pymdownx.inlinehilite
- pymdownx.superfences
- admonition
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment