Skip to main content

Python Class for VARNA

Project description

VARNA API is a Python interface for VARNA, 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 ((((((.((((((........)))))).((((((.......))))))..)))))).

java -cp VARNAv3-93.jar fr.orsay.lri.varna.applications.VARNAcmd -sequenceDBN "                                                       " -structureDBN "((((((.((((((........)))))).((((((.......))))))..))))))" -o example.png -algorithm radiate -auxBPs "(14,20):color=#FF00FF,thickness=1.0,edge5=s,edge3=wc,stericity=cis" -highlightRegion "11-21:radius=15.0,fill=#9999FF,outline=#3333FF"

The equivalence in python is

from varnaapi import VARNA
v = VARNA(structure="((((((.((((((........)))))).((((((.......))))))..))))))")
v.add_highlight_region(10,20)
v.add_aux_BP(13, 19, edge5="s", color="#FF00FF")
v.savefig("example.png")

Installation

python3 -m pip install varnaapi

Usage

Here, we show the basic usage of varnaapi. Please refer the API page for more details. The first thing after importing varnaapi is to setup the location of VARNA used. The default is VARNAv3-93.jar in the current folder.

import varnaapi
varnaapi.set_VARNA(path_to_VARNA)

Each drawing in VARNA is an object called VARNA created from given secondary structure or/and RNA sequence.

ss = "((((((.((((((........)))))).((((((.......))))))..))))))"
v = varnaapi.VARNA(structure=ss)

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.

v.set_algorithm('line')
v.add_highlight_region(0, 5, radius=20)

Finally, we can draw the secondary structure

v.savefig(path_to_store)

Credits

Please kindly cite VARNA supporting manuscript if you use VARNA API in your research. Download bibtex format.

Darty, K., Denise, A., & Ponty, Y. (2009). VARNA: Interactive drawing and editing of the RNA secondary structure. Bioinformatics, 25(15), 1974.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

varnaapi-0.1.0.tar.gz (673.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

varnaapi-0.1.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file varnaapi-0.1.0.tar.gz.

File metadata

  • Download URL: varnaapi-0.1.0.tar.gz
  • Upload date:
  • Size: 673.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.9

File hashes

Hashes for varnaapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f50aec5cab0cadbd6a7e8e92564bd1b8a7136687e37d27c9ea018fa2631fb04b
MD5 a3b2d36146ccc907c783c17f854cb322
BLAKE2b-256 1299fc46d1d14130299e55ef361d5efe39cb51ddd0f7a4de62faff3d3cfa5088

See more details on using hashes here.

File details

Details for the file varnaapi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: varnaapi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.9

File hashes

Hashes for varnaapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de38311fff151b46e778bab3512106e6bf0b9cd6d70f7b37af939462f5b5a8f1
MD5 5ae5d3cafac724a6b72b850fe6f4a2ce
BLAKE2b-256 e734c6fe620c4a505cef80ecf2af662ab09d74418e5e4f1f033a0b259d1c7b77

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page