4 * \brief Secondary structure plot layout algorithms
7 * The ViennaRNA Package
9 #ifndef __VIENNA_RNA_PACKAGE_PLOT_LAYOUTS_H__
10 #define __VIENNA_RNA_PACKAGE_PLOT_LAYOUTS_H__
12 #include "data_structures.h"
16 #define PI 3.141592654
22 * \brief Definition of Plot type <i>simple</i>
24 * This is the plot type definition for several RNA structure plotting functions telling
25 * them to use <b>Simple</b> plotting algorithm
27 * \see rna_plot_type, PS_rna_plot_a(), PS_rna_plot(), svg_rna_plot(), gmlRNA(), ssv_rna_plot(), xrna_plot()
29 #define VRNA_PLOT_TYPE_SIMPLE 0
32 * \brief Definition of Plot type <i>Naview</i>
34 * This is the plot type definition for several RNA structure plotting functions telling
35 * them to use <b>Naview</b> plotting algorithm
37 * \see rna_plot_type, PS_rna_plot_a(), PS_rna_plot(), svg_rna_plot(), gmlRNA(), ssv_rna_plot(), xrna_plot()
39 #define VRNA_PLOT_TYPE_NAVIEW 1
42 * \brief Definition of Plot type <i>Circular</i>
44 * This is the plot type definition for several RNA structure plotting functions telling
45 * them to produce a <b>Circular plot</b>
47 * \see rna_plot_type, PS_rna_plot_a(), PS_rna_plot(), svg_rna_plot(), gmlRNA(), ssv_rna_plot(), xrna_plot()
49 #define VRNA_PLOT_TYPE_CIRCULAR 2
53 * \brief Switch for changing the secondary structure layout algorithm
55 * Current possibility are 0 for a simple radial drawing or 1 for the modified
56 * radial drawing taken from the \e naview program of \ref bruccoleri_88 "Bruccoleri & Heinrich (1988)".
58 * \note To provide thread safety please do not rely on this global variable in future implementations
59 * but pass a plot type flag directly to the function that decides which layout algorithm it may use!
61 * \see #VRNA_PLOT_TYPE_SIMPLE, #VRNA_PLOT_TYPE_NAVIEW, #VRNA_PLOT_TYPE_CIRCULAR
64 extern int rna_plot_type;
67 * \brief Calculate nucleotide coordinates for secondary structure plot the <i>Simple way</i>
69 * \see make_pair_table(), rna_plot_type, simple_circplot_coordinates(), naview_xy_coordinates(), PS_rna_plot_a(),
70 * PS_rna_plot, svg_rna_plot()
72 * \param pair_table The pair table of the secondary structure
73 * \param X a pointer to an array with enough allocated space to hold the x coordinates
74 * \param Y a pointer to an array with enough allocated space to hold the y coordinates
75 * \return length of sequence on success, 0 otherwise
77 int simple_xy_coordinates(short *pair_table,
82 * \brief Calculate nucleotide coordinates for <i>Circular Plot</i>
84 * This function calculates the coordinates of nucleotides mapped in equal distancies onto a unit circle.
86 * \note In order to draw nice arcs using quadratic bezier curves that connect base pairs one may calculate
87 * a second tangential point \f$P^t\f$ in addition to the actual R<sup>2</sup> coordinates.
88 * the simplest way to do so may be to compute a radius scaling factor \f$rs\f$ in the interval \f$[0,1]\f$ that
89 * weights the proportion of base pair span to the actual length of the sequence. This scaling factor
90 * can then be used to calculate the coordinates for \f$P^t\f$, i.e. \f$ P^{t}_x[i] = X[i] * rs\f$
91 * and \f$P^{t}_y[i] = Y[i] * rs\f$.
93 * \see make_pair_table(), rna_plot_type, simple_xy_coordinates(), naview_xy_coordinates(), PS_rna_plot_a(),
94 * PS_rna_plot, svg_rna_plot()
96 * \param pair_table The pair table of the secondary structure
97 * \param x a pointer to an array with enough allocated space to hold the x coordinates
98 * \param y a pointer to an array with enough allocated space to hold the y coordinates
99 * \return length of sequence on success, 0 otherwise
101 int simple_circplot_coordinates(short *pair_table,