R2R - software to speed the depiction of aesthetic consensus RNA secondary structures
© Weinberg and Breaker; licensee BioMed Central Ltd. 2011
Received: 21 July 2010
Accepted: 4 January 2011
Published: 4 January 2011
With continuing identification of novel structured noncoding RNAs, there is an increasing need to create schematic diagrams showing the consensus features of these molecules. RNA structural diagrams are typically made either with general-purpose drawing programs like Adobe Illustrator, or with automated or interactive programs specific to RNA. Unfortunately, the use of applications like Illustrator is extremely time consuming, while existing RNA-specific programs produce figures that are useful, but usually not of the same aesthetic quality as those produced at great cost in Illustrator. Additionally, most existing RNA-specific applications are designed for drawing single RNA molecules, not consensus diagrams.
We created R2R, a computer program that facilitates the generation of aesthetic and readable drawings of RNA consensus diagrams in a fraction of the time required with general-purpose drawing programs. Since the inference of a consensus RNA structure typically requires a multiple-sequence alignment, the R2R user annotates the alignment with commands directing the layout and annotation of the RNA. R2R creates SVG or PDF output that can be imported into Adobe Illustrator, Inkscape or CorelDRAW. R2R can be used to create consensus sequence and secondary structure models for novel RNA structures or to revise models when new representatives for known RNA classes become available. Although R2R does not currently have a graphical user interface, it has proven useful in our efforts to create 100 schematic models of distinct noncoding RNA classes.
R2R makes it possible to obtain high-quality drawings of the consensus sequence and structural models of many diverse RNA structures with a more practical amount of effort. R2R software is available at http://breaker.research.yale.edu/R2R and as an Additional file.
Numerous structured RNAs have been identified in the last decade that are involved in a variety of biological processes [1–3]. Researchers are often aided by a graphical depiction of the consensus sequence and structural features of a given RNA class. Unfortunately, few tools have been designed to create such consensus diagrams [4, 5], and available tools represent only sequence conservation or base-pairing probabilities in their output.
Several programs have been created to draw individual RNA molecules, and thus inherently address many of the issues associated with drawing a consensus diagram. Some programs implement algorithms that automatically determine a feasible layout of the RNA molecule [5–11], and several allow a user to adjust layouts interactively [8, 12–14]. The layouts generated by these approaches are of practical value, and the automated approaches require minimal human effort. However, the resulting drawings are often not as readable or as aesthetic as those generated manually. To prepare high-quality diagrams for publications, researchers often use general-purpose drawing programs such as Adobe Illustrator. However, this approach is very time consuming.
The goal of R2R is to facilitate the creation of RNA consensus diagrams by bioinformaticians that are comparable in quality to those produced using Adobe Illustrator, but take less time to create. Because consensus diagrams are generally derived from multiple-sequence alignments, R2R takes as input a multiple-sequence alignment in Stockholm format  with added annotation to direct the drawing. R2R can also create depictions of single RNA sequences. Because of the effort still required to draw highly aesthetic diagrams, R2R is not usually appropriate for drawing raw candidate RNAs predicted by bioinformatics, but rather is intended primarily for use in preparing publications of RNAs. Using R2R, we have created over 100 RNA drawings in previous publications [16–19].
R2R source code is freely available and is distributed with over 100 example input and output files in both PDF and SVG format (Additional file 1). A user manual is also available (Additional file 2).
An example consensus diagram
Pseudoknot drawing styles
Drawing of individual RNA molecules
Design principles for RNA secondary structural diagrams
R2R facilitates the application of the following design principles for RNA secondary structure diagrams. Although little research has investigated practical benefits of different RNA drawing styles , the principles integrated into R2R are similar to broadly followed guidelines for RNA depictions [10, 22] and some are related to ideas accepted in the field of graph layout [10, 23].
The principles are as follows. First, nucleotides or other symbols should not overlap. Second, nucleotides within bulges and loops should ideally be drawn along circles. Such a layout leads to symmetry  in the looped nucleotides, which share a common property. The circular layout also avoids arbitrarily drawing attention to individual nucleotides that might otherwise be located on a corner. Third, stems should ideally run horizontally or vertically, to emphasize the common structural role of stems. Fourth, the distance between consecutive nucleotide positions along the RNA backbone should be constant throughout the diagram. This principle avoids inelegant bunching of nucleotides, or extra space between nucleotides that draws unwarranted attention or requires additional clarification for the user to follow the RNA backbone. Finally, the diagram should be compact, which is both aesthetic and space-saving. Some of these principles often conflict, and the inference of an optimal solution may require some manual intervention.
Consensus diagrams merit annotation to highlight the extent of nucleotide conservation and to feature evidence supporting the proposed structure. This information, which is included in Figure 1, is automatically calculated by R2R (see below). Other annotations useful in consensus diagrams are the depiction of variable-length, poorly conserved regions as well as modular structures. R2R supports such annotations (e.g., see Figure 1), based on the user's explicit judgment regarding the RNA motif data.
Automatically calculated consensus annotation
Some annotations specific to consensus diagrams are automatically computed by R2R, using approaches described previously . R2R graphically depicts the extent of conservation at nucleotide positions within an RNA. To reduce bias caused by highly similar sequences, sequences are weighted by the GSC algorithm  as implemented by the Infernal software package . If the weighted frequency of a nucleotide exceeds 75%, R2R draws the nucleotide with a specific color (e.g., Figure 1) to indicate whether its frequency exceeds 75%, 90% or 97%, although these parameters can be adjusted. Otherwise, if the nucleotide is a purine or pyrimidine with a frequency above 75%, R2R indicates whether this frequency exceeds the same thresholds. The conservation of purine or pyrimidine identity is often associated with structural constraints. If a position does not meet the preceding criteria, R2R reports whether a nucleotide is present in the position with weighted frequency more than 50%, 75%, 90% or 97%, or otherwise does not show the nucleotide position.
R2R does not indicate other patterns of conservation. For example, the nucleotide immediately 5' to the hammerhead ribozyme cleavage site must be A, C or U , but this will not be indicated automatically by R2R. However, we concluded that routinely annotating such conservation patterns would unduly complicate diagrams, and users could add such distinctions that are desired. We also considered using entropy  as a measure of conservation. Although entropy measures conservation in a more general manner, we found it difficult to develop an intuition for how specific levels of entropy relate to likely biochemical constraints.
R2R marks each predicted base pair to indicate covariation (e.g., Figure 1). If two RNAs can form a Watson-Crick or G-U base pair at equivalent locations, and the base pair identities differ at both positions (e.g., A-U in one sequence and C-G in another), R2R classifies the base pair as covarying. If they vary at only one position (e.g., A-U in one sequence and G-U in another), the base pair is considered to carry a compatible mutation. Base pairs whose nucleotides are invariant have no mutational evidence for or against such base-pair predictions, and are marked accordingly. Each of these classifications is indicated unobtrusively by shading the base pairs with specific colors. Positions that contain non-canonical base pairs with a frequency exceeding 10% are not shaded.
This automated R2R annotation does not reflect the extent or confidence of covariation. While such information can be useful, we believe that thorough evaluation of covariation evidence ultimately requires analysis of the full sequence alignment. For example, misleading covariation can result from an incorrect alignment of sequences, or from alignments of sequences that do not function as structured RNAs. Unfortunately, there is no accepted method to assign confidence that entirely eliminates the need to analyze the full alignment.
User effort required with R2R
Since R2R's overriding goal is to facilitate highly aesthetic diagrams, it requires the user to give it explicit instructions to customize the RNA layout (e.g., Figure 1C), and to edit R2R's raw output in a general-purpose drawing program (e.g., compare raw Figure 1B with finished Figure 1A). In our experience, this manual effort is usually modest. The ~800-nucleotide GOLLD RNA  structure took us roughly 16 hours to draw using R2R, mainly owing to the challenge of finding a layout that fits within a page. However, most RNAs are hairpin structures that do not require any kind of customization, and were easily drawn in minutes. RNAs with complex structural features (e.g., pseudoknots or multistem junctions where the default layout is unsatisfactory) or annotations (e.g., modular structures or nucleotide positions with special significance) were still usually completed within 30-60 minutes.
Despite the capabilities offered by R2R, we see some areas for improvement. First, a graphical user interface would allow additional researchers to more easily use R2R, and could help to make some tasks even faster for all users. Second, numerous features are possible to enrich diagrams with additional layout, particularly for RNAs with unusual biochemical features. Third, further automation of layout selection would speed the use of R2R. Fourth, R2R is also not designed to implement schematic diagrams that display extensive tertiary interactions or to project diagrams that are positioned to better reflect positions of nucleotides or substructures in atomic-resolution models (e.g., the newer secondary structure format for group I introns ).
Default layout of loops
By default, all nucleotides in a loop are positioned along a common circle. R2R keeps the distance between consecutive nucleotides strictly constant. Previous solutions to this problem assumed that distance between base-paired nucleotides is equal to the distance between consecutive nucleotides , but these distances are not assumed to be equal in R2R. Given a radius r, the angle between nucleotides along the circle is calculated based on the isosceles triangle with sides r, r and d, where d is the fixed distance between consecutive nucleotides or between base-paired nucleotides. Suppose r* is the radius of a suitable circle for a given loop. If nucleotides are drawn with radius r < r*, the sum of angles will exceed 360 degrees, while r > r* will result in fewer than 360 degrees. R2R uses binary search to solve for r*. A similar approach was also developed for VARNA . For bulges or a side of an internal loop, the angles should sum to 180 degrees.
Layout of multistem junctions expressed as a non-linear program
In many RNA structures, it is desirable to arrange the nucleotides within a multistem junction on a circle, while constraining the stems on the junction to be oriented in specific directions (e.g., Figures 1 or 3). These directions are typically dictated by a desire to avoid overlaps in other parts of the diagram, or to promote consistency or symmetry in overall stem directions. The stem-direction constraints make it impossible in general to follow a perfect circle, but a close approximation is usually feasible. In R2R, the stem directions are specified by the user, which avoids creating a much harder global optimization problem for the computer.
This layout problem is formulated in R2R in terms of a non-linear program (NLP), consisting of a non-linear objective function that is minimized subject to non-linear constraints. The NLP is solved by CFSQP . Gradients of objective or constraint functions, which are used by CFSQP, are calculated using automatic differentiation. In automatic differentiation, mathematical functions are built using an abstract numeric data type that represents a symbolic expression, and the resulting symbolic expression is differentiated recursively.
R2R provides three different mathematical formulations to express the notion that the junction should approximate a circle. All methods use highly non-linear functions, and the optimizer can get stuck in local minima. Therefore, it is sometimes useful to try multiple formulations, although the second formulation usually produces an acceptable layout (Additional file 2).
In formulating the objective function, we assume that it is sudden changes in radius that is most visually distracting. For each base-paired nucleotide n, we calculate the distance dn between n and c (circle center), and the distance da between c and the nucleotide adjacent to n (Figure 7C). The objective function is the sum of squares of the differences dn-da, for all n.
The second and third formulations of multistem junction NLPs are similar to one another. In both, the radius of the circle is again a variable, but no points are explicitly constrained to lie on it (Figure 7D). Variables are the x and y coordinates of the 5' nucleotides of each stem on the junction. However, when two base-paired nucleotides are consecutive (i.e., no unpaired nucleotides are between them), only one variable is used: the angle of the vector from one base-paired nucleotide to the adjacent one. For each junction of unpaired nucleotides between two stems, these nucleotides are drawn along a circle, but each junction's circle has its own independent center and radius (Figure 7E). The center and radius values of such circles are expressed as a constraint in terms of the positions of the base-paired nucleotides flanking the given junction and the constant distance between consecutive nucleotides (see "Default layout of loops").
The objective function for the second formulation measures the deviations of the junctions to the overall multistem junction circle. To approximate the integral, evenly spaced points along each junction are used. The number of points used is N+2+3V where N is the number of unpaired nucleotides, the number 2 reflects the two flanking paired nucleotides and V is the number of variable-length regions. The objective function is the sum of the squared differences dpc-r, where dpc is the distance between a junction point p and the main circle's center c, and r is the radius of the main circle (Figure 7E). The third formulation's objective function uses the idea that it is deviations in slope that are most jarring. Thus, it measures the deviations at regularly spaced points between the vector from the point to the main circle's center and the vector from the same point to the junction's circle center. The objective function is the sum of squared differences between the cosine of the angle between the two vectors and 1 (which represents equal angles).
Nucleotides can be forced to align horizontally by constraining their x coordinates to be equal. Using scalar projections, R2R allows alignment at arbitrary angles (not just horizontal), and also allows aligning the centroids of multiple nucleotides (e.g., Figure 3). These features apply to all NLP formulations.
R2R has sufficient functionality to draw a wide variety of RNA structures and greatly reduce the time necessary to create aesthetic and readable diagrams, which will become increasingly important as more noncoding RNAs are discovered.
Availability and requirements
Project name: R2R
Project home page: http://breaker.research.yale.edu/R2R
Operating system(s): Platform independent. Note: R2R is only tested using the GNU C++ Compiler.
Programming language: C/C++ and Perl.
Other requirements: CFSQP is needed for some methods of automated layout of multistem junctions. Other aspects of R2R will function with or without CFSQP. CFSQP is free for research and development purposes.
License: GNU General Public License.
Any restrictions to use by non-academics: None.
We thank attendees of the 2009 Computational methods for RNA analysis meeting in Benasque, Spain, and Carla Weinberg, David Weinberg and Paul Gardner for helpful comments. We also thank Jonathan Perreault, Phil McCown, Tyler Ames and other Breaker lab members, for helpful discussions or for testing the R2R software. RNA science in the Breaker lab is supported in part by Howard Hughes Medical Institute.
- Waters LS, Storz G: Regulatory RNAs in bacteria. Cell 2009, 136: 615–628. 10.1016/j.cell.2009.01.043PubMed CentralView ArticlePubMedGoogle Scholar
- Roth A, Breaker RR: The structural and functional diversity of metabolite-binding riboswitches. Annu Rev Biochem 2009, 78: 305–334. 10.1146/annurev.biochem.78.070507.135656View ArticlePubMedGoogle Scholar
- Hüttenhofer A, Schattner P, Polacek N: Non-coding RNAs: hope or hype? Trends Genet 2005, 21: 289–297.View ArticlePubMedGoogle Scholar
- Gruber AR, Lorenz R, Bernhart SH, Neubock R, Hofacker IL: The Vienna RNA websuite. Nucleic Acids Res 2008, 36: W70–74. 10.1093/nar/gkn188PubMed CentralView ArticlePubMedGoogle Scholar
- Seibel PN, Müller T, Dandekar T, Wolf M: Synchronous visual analysis and editing of RNA sequence and secondary structure alignments using 4SALE. BMC Res Notes 2008, 1: 91. 10.1186/1756-0500-1-91PubMed CentralView ArticlePubMedGoogle Scholar
- Muller G, Gaspin C, Etienne A, Westhof E: Automatic display of RNA secondary structures. Comput Appl Biosci 1993, 9: 551–561.PubMedGoogle Scholar
- Shapiro BA, Maizel J, Lipkin LE, Currey K, Whitney C: Generating non-overlapping displays of nucleic acid secondary structure. Nucleic Acids Res 1984, 12: 75–88. 10.1093/nar/12.1Part1.75PubMed CentralView ArticlePubMedGoogle Scholar
- Wiese KC, Glen E, Vasudevan A: JViz.Rna--a Java tool for RNA secondary structure visualization. IEEE Trans Nanobioscience 2005, 4: 212–218. 10.1109/TNB.2005.853646View ArticlePubMedGoogle Scholar
- Byun Y, Han K: PseudoViewer3: generating planar drawings of large-scale RNA structures with pseudoknots. Bioinformatics 2009, 25: 1435–1437. 10.1093/bioinformatics/btp252View ArticlePubMedGoogle Scholar
- Auber D, Delest M, Domenger J-P, Dulucq S: Efficient drawing of RNA secondary structure. J Graph Algorithms Appl 2006, 10: 329–351.View ArticleGoogle Scholar
- Bruccoleri RE, Heinrich G: An improved algorithm for nucleic acid secondary structure display. Comput Appl Biosci 1988, 4: 167–173.PubMedGoogle Scholar
- De Rijk P, Wuyts J, De Wachter R: RnaViz 2: an improved representation of RNA secondary structure. Bioinformatics 2003, 19: 299–300. 10.1093/bioinformatics/19.2.299View ArticlePubMedGoogle Scholar
- Darty K, Denise A, Ponty Y: VARNA: Interactive drawing and editing of the RNA secondary structure. Bioinformatics 2009, 25: 1974–1975. 10.1093/bioinformatics/btp250PubMed CentralView ArticlePubMedGoogle Scholar
- Donohue JP[http://rna.ucsc.edu/rnacenter/xrna/xrna.html]
- Weinberg Z, Barrick JE, Yao Z, Roth A, Kim JN, Gore J, Wang JX, Lee ER, Block KF, Sudarsan N, Neph S, Tompa M, Ruzzo WL, Breaker RR: Identification of 22 candidate structured RNAs in bacteria using the CMfinder comparative genomics pipeline. Nucleic Acids Res 2007, 35: 4809–4819. 10.1093/nar/gkm487PubMed CentralView ArticlePubMedGoogle Scholar
- Weinberg Z, Regulski EE, Hammond MC, Barrick JE, Yao Z, Ruzzo WL, Breaker RR: The aptamer core of SAM-IV riboswitches mimics the ligand-binding site of SAM-I riboswitches. RNA 2008, 14: 822–828. 10.1261/rna.988608PubMed CentralView ArticlePubMedGoogle Scholar
- Weinberg Z, Perreault J, Meyer MM, Breaker RR: Exceptional structured noncoding RNAs revealed by bacterial metagenome analysis. Nature 2009, 462: 656–659. 10.1038/nature08586PubMed CentralView ArticlePubMedGoogle Scholar
- Weinberg Z, Wang JX, Bogue J, Yang J, Corbino K, Moy RH, Breaker RR: Comparative genomics reveals 104 candidate structured RNAs from bacteria, archaea, and their metagenomes. Genome Biol 2010, 11: R31. 10.1186/gb-2010-11-3-r31PubMed CentralView ArticlePubMedGoogle Scholar
- Lawrence C, Zhou JL, Tits AL: User's guide for CFSQP version 2.5: A C code for solving (large scale) constrained nonlinear (minimax) optimization problems, generating iterates satisfying all inequality constraints. Technical report TR-94–16r1, University of Maryland, College Park 1997.Google Scholar
- Pace NR, Thomas BC, Woese CR: Probing RNA structure, function, and history by comparative analysis. In The RNA World. 2nd edition. Edited by: Gesteland RF, Cech TR, Atkins JF. Cold Spring Harbor, New York: Cold Spring Harbor Laboratory Press; 1999.Google Scholar
- Shapiro BA, Lipkin LE, Maizel J: An interactive technique for the display of nucleic acid secondary structure. Nucleic Acids Res 1982, 10: 7041–7052. 10.1093/nar/10.21.7041PubMed CentralView ArticlePubMedGoogle Scholar
- Di Battista G, Eades P, Tamassia R, Tollis JG: Graph drawing: algorithms for the visualization of graphs. New Jersey, USA: Prentice Hall; 1999.Google Scholar
- Gerstein M, Sonnhammer ELL, Chothia C: Volume changes in protein evolution. Journal of Molecular Biology 1994, 236: 1067–1078. 10.1016/0022-2836(94)90012-4View ArticlePubMedGoogle Scholar
- Nawrocki EP, Kolbe DL, Eddy SR: Infernal 1.0: inference of RNA alignments. Bioinformatics 2009, 25: 1335–1337. 10.1093/bioinformatics/btp157PubMed CentralView ArticlePubMedGoogle Scholar
- Ruffner DE, Stormo GD, Uhlenbeck OC: Sequence requirements of the hammerhead RNA self-cleavage reaction. Biochemistry 1990, 29: 10695–10702. 10.1021/bi00499a018View ArticlePubMedGoogle Scholar
- Durbin R, Eddy SR, Krogh A, Mitchison G: Biological Sequence Analysis: Probabilistic models of proteins and nucleic acids. Cambridge, UK: Cambridge University Press; 1998.View ArticleGoogle Scholar
- Cech TR, Damberger SH, Gutell RR: Representation of the secondary and tertiary structure of group I introns. Nat Struct Biol 1994, 1: 273–280. 10.1038/nsb0594-273View ArticlePubMedGoogle Scholar
- Gardner PP, Daub J, Tate JG, Nawrocki EP, Kolbe DL, Lindgreen S, Wilkinson AC, Finn RD, Griffiths-Jones S, Eddy SR, Bateman A: Rfam: updates to the RNA families database. Nucleic Acids Res 2009, 37: D136–140. 10.1093/nar/gkn766PubMed CentralView ArticlePubMedGoogle Scholar
- Jucker FM, Pardi A: Solution structure of the CUUG hairpin loop: a novel RNA tetraloop motif. Biochemistry 1995, 34: 14416–14427. 10.1021/bi00044a019View ArticlePubMedGoogle Scholar
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.