Coder Social home page Coder Social logo

draw_rna's Introduction

draw_rna

Generate quick secondary structures of nucleic acids via jupyter notebook or command line.

A communal and continuing effort by the Das Lab, Eterna Players, M. Wu, H. Wayment-Steele.

Dependencies

The default behavior is to output the secondary structure visualization to both svg and png. The png requires Inkscape, whose directory must be set by environmental variable INKSCAPEDIR.

Install

Clone this repository to your hard drive and install as follows:

git clone [email protected]:DasLab/draw_rna.git
cd draw_rna/
python setup.py install

Warning if you see errors in using the repository, it maybe due to your draw_rna directory sitting in a folder like src/ which already is in your Python Path. in that case, rename draw_rna to draw_rna_directory and/or move it to another spot in your system.

Basic Usage

Jupyter notebook

See example_files/demo.ipynb for more. In brief:


Input file

An input file is used to specify the sequence, secondary structure, and coloring of the desired drawing. The format is as follows

filename      # image will be written to filename.svg
GTGANNNNNTCAC # nucleic acid sequence
((((.....)))) # nucleic acid secondary structure in dot-bracket notation
rrrrbbbbbgggg # optional: coloring of each base (e.g. r for red, g for green, b for blue)

Multiple sequences can be specified in one file as in example_input.txt.

Execution

The draw script can be run with

python draw_rna/draw_all.py example_files/command_line/example_input.txt

You'll get files example_contours.svg, example_sequence_colors.svg, example_specific_colors.svg. Example output available in example_files/command_line/.

Sample secondary structure diagrams:

Notes on usage

Multistrand drawing

At the moment, current practice is to include blanks between strands such as:

filename     
GTGANN NNTCAC
((((.....))))
rrrrbbwbbgggg

And then remove nucleotides corresponding to blanks afterwards. (This would be a quick fix.)

NOTE ON render_rna and render_rna_flip:

'render_rna_flip.py' is what is currently called in the main routine and where major edits have been made. render_rna.py renders 3' -> 5'. TODO: handle 3' -> 5' drawing better.

Extended options

Draw a large thing with linear exterior loop and with a custom color vector:

python draw_all.py covid19_5primeUTR.txt --large_mode --color_values perc_conserved_5UTR.txt --png

If you use --color_values with an input file with multiple structures, the same colors will be applied to all the structures.

Draw from RDAT file containing reactivity

Requires RDATkit to be in working python path. Example command:

python draw_from_rdat.py ETERNA_R69_0000.rdat 297 --png

Movie mode

More coming eventually. For now, if you generate a bunch of stills, say from a cotranscriptional simulation, can string them together with ImageMagick:

convert -delay 25 my_stills_*.png my_great_trajectory.gif

draw_rna's People

Contributors

everyday847 avatar hwaymentsteele avatar ramyarangan avatar rhiju avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.