1 #ifndef VIENNA_RNA_PACKAGE_ALPHABET_H
2 #define VIENNA_RNA_PACKAGE_ALPHABET_H
3 
4 #ifdef VRNA_WARN_DEPRECATED
5 # if defined(__clang__)
6 #  define DEPRECATED(func, msg) func __attribute__ ((deprecated("", msg)))
7 # elif defined(__GNUC__)
8 #  define DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
9 # else
10 #  define DEPRECATED(func, msg) func
11 # endif
12 #else
13 # define DEPRECATED(func, msg) func
14 #endif
15 
16 /**
17  *  @file     alphabet.h
18  *  @ingroup  utils, alphabet_utils
19  *  @brief    Functions to process, convert, and generally handle different nucleotide
20  *            and/or base pair alphabets
21  */
22 
23 /**
24  *  @addtogroup alphabet_utils
25  *  @{
26  *  @brief  Functions to cope with various aspects related to the nucleotide sequence alphabet
27  */
28 
29 #include <ViennaRNA/fold_compound.h>
30 #include <ViennaRNA/model.h>
31 
32 unsigned int
33 vrna_sequence_length_max(unsigned int options);
34 
35 
36 int
37 vrna_nucleotide_IUPAC_identity(char a,
38                                char b);
39 
40 
41 void
42 vrna_ptypes_prepare(vrna_fold_compound_t  *fc,
43                     unsigned int          options);
44 
45 
46 /**
47  *  @brief Get an array of the numerical encoding for each possible base pair (i,j)
48  *
49  *  @note This array is always indexed in column-wise order, in contrast to previously
50  *  different indexing between mfe and pf variants!
51  *
52  *  @see  vrna_idx_col_wise(), #vrna_fold_compound_t
53  *
54  */
55 char *
56 vrna_ptypes(const short *S,
57             vrna_md_t   *md);
58 
59 
60 /**
61  *  @brief Get a numerical representation of the nucleotide sequence
62  *
63  *  @param  sequence    The input sequence in upper-case letters
64  *  @param  md          A pointer to a #vrna_md_t data structure that specifies the conversion type
65  *  @return             A list of integer encodings for each sequence letter (1-based). Position 0 denotes the length of the list
66  */
67 short *
68 vrna_seq_encode(const char  *sequence,
69                 vrna_md_t   *md);
70 
71 
72 /**
73  *  @brief Get a numerical representation of the nucleotide sequence (simple version)
74  *
75  */
76 short *
77 vrna_seq_encode_simple(const char *sequence,
78                        vrna_md_t  *md);
79 
80 
81 /**
82  *  @brief  Encode a nucleotide character to numerical value
83  *
84  *  This function encodes a nucleotide character to its numerical representation as required by many functions in RNAlib.
85  *
86  *  @see  vrna_nucleotide_decode(), vrna_seq_encode()
87  *
88  *  @param  c   The nucleotide character to encode
89  *  @param  md  The model details that determine the kind of encoding
90  *  @return     The encoded nucleotide
91  */
92 int
93 vrna_nucleotide_encode(char       c,
94                        vrna_md_t  *md);
95 
96 
97 /**
98  *  @brief  Decode a numerical representation of a nucleotide back into nucleotide alphabet
99  *
100  *  This function decodes a numerical representation of a nucleotide character back into nucleotide alphabet
101  *
102  *  @see  vrna_nucleotide_encode(), vrna_seq_encode()
103  *
104  *  @param  enc The encoded nucleotide
105  *  @param  md  The model details that determine the kind of decoding
106  *  @return     The decoded nucleotide character
107  */
108 char
109 vrna_nucleotide_decode(int        enc,
110                        vrna_md_t  *md);
111 
112 
113 void
114 vrna_aln_encode(const char    *sequence,
115                 short         **S_p,
116                 short         **s5_p,
117                 short         **s3_p,
118                 char          **ss_p,
119                 unsigned int  **as_p,
120                 vrna_md_t     *md);
121 
122 
123 unsigned int
124 vrna_get_ptype_md(int       i,
125                   int       j,
126                   vrna_md_t *md);
127 
128 
129 unsigned int
130 vrna_get_ptype(int  ij,
131                char *ptype);
132 
133 
134 unsigned int
135 vrna_get_ptype_window(int   i,
136                       int   j,
137                       char  **ptype);
138 
139 
140 /**
141  *  @}
142  */
143 
144 #ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
145 
146 DEPRECATED(char *get_ptypes(const short   *S,
147                             vrna_md_t     *md,
148                             unsigned int  idx_type),
149            "Use vrna_pytpes() instead");
150 
151 #endif
152 
153 #endif
154