1 #ifndef RNATURTLE_H
2 #define RNATURTLE_H
3 
4 /**
5  *  @file ViennaRNA/plotting/RNApuzzler/RNAturtle.h
6  *  @ingroup  plotting_utils
7  *  @brief    Implementation of the RNAturtle RNA secondary structure layout algorithm @cite wiegreffe:2018
8  *
9  */
10 
11 /**
12  *  @addtogroup   plot_layout_utils
13  *  @{
14  */
15 
16 
17 /**
18  *  @brief Compute nucleotide coordinates for secondary structure plot using the <i>RNAturtle</i> algorithm @cite wiegreffe:2018
19  *
20  *  This function basically is a wrapper to vrna_plot_coords() that passes the @p plot_type #VRNA_PLOT_TYPE_TURTLE.
21  *
22  *  Here is a simple example how to use this function, assuming variable @p structure contains
23  *  a valid dot-bracket string:
24  *  @code{.c}
25  *  float  *x, *y;
26  *  double *arcs;
27  *
28  *  if (vrna_plot_coords_turtle(structure, &x, &y, &arcs)) {
29  *    printf("all fine");
30  *  } else {
31  *    printf("some failure occured!");
32  *  }
33  *
34  *  free(x);
35  *  free(y);
36  *  free(arcs);
37  *  @endcode
38  *
39  *  @note On success, this function allocates memory for X, Y and arc coordinates and assigns
40  *  the pointers at addressess @p x, @p y and @p arc_coords to the corresponding memory locations. It's
41  *  the users responsibility to cleanup this memory after usage!
42  *
43  *  @see  vrna_plot_coords(), vrna_plot_coords_turtle_pt(), vrna_plot_coords_circular(),
44  *        vrna_plot_coords_simple(), vrna_plot_coords_naview(), vrna_plot_coords_puzzler()
45  *
46  *  @param        structure   The secondary structure in dot-bracket notation
47  *  @param[inout] x           The address of a pointer of X coordinates (pointer will point to memory, or NULL on failure)
48  *  @param[inout] y           The address of a pointer of Y coordinates (pointer will point to memory, or NULL on failure)
49  *  @param[inout] arc_coords  The address of a pointer that will hold arc coordinates (pointer will point to memory, or NULL on failure)
50  *  @return                   The length of the structure on success, 0 otherwise
51  */
52 int
53 vrna_plot_coords_turtle(const char  *structure,
54                         float       **x,
55                         float       **y,
56                         double      **arc_coords);
57 
58 
59 /**
60  *  @brief Compute nucleotide coordinates for secondary structure plot using the <i>RNAturtle</i> algorithm @cite wiegreffe:2018
61  *
62  *  Same as vrna_plot_coords_turtle() but takes a pair table with the structure
63  *  information as input.
64  *
65  *  @note On success, this function allocates memory for X, Y and arc coordinates and assigns
66  *  the pointers at addressess @p x, @p y and @p arc_coords to the corresponding memory locations. It's
67  *  the users responsibility to cleanup this memory after usage!
68  *
69  *  @see  vrna_plot_coords_pt(), vrna_plot_coords_turtle(), vrna_plot_coords_circular_pt(),
70  *        vrna_plot_coords_simple_pt(), vrna_plot_coords_puzzler_pt(), vrna_plot_coords_naview_pt()
71  *
72  *  @param        pt          The pair table that holds the secondary structure
73  *  @param[inout] x           The address of a pointer of X coordinates (pointer will point to memory, or NULL on failure)
74  *  @param[inout] y           The address of a pointer of Y coordinates (pointer will point to memory, or NULL on failure)
75  *  @param[inout] arc_coords  The address of a pointer that will hold arc coordinates (pointer will point to memory, or NULL on failure)
76  *  @return                   The length of the structure on success, 0 otherwise
77  */
78 int
79 vrna_plot_coords_turtle_pt(short const *const pair_table,
80                            float              **x,
81                            float              **y,
82                            double             **arc_coords);
83 
84 
85 /**
86  * @}
87  */
88 
89 #endif
90