RNAlib-2.4.4
string_utils.h
Go to the documentation of this file.
1 #ifndef VIENNA_RNA_PACKAGE_STRING_UTILS_H
2 #define VIENNA_RNA_PACKAGE_STRING_UTILS_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 
27 #include <stdarg.h>
29 
33 #define XSTR(s) STR(s)
34 
38 #define STR(s) #s
39 
40 #ifndef FILENAME_MAX_LENGTH
41 
48 #define FILENAME_MAX_LENGTH 80
49 
56 #define FILENAME_ID_LENGTH 42
57 
58 #endif
59 
60 #ifdef HAVE_CONFIG_H
61 #include <config.h>
62 #ifndef HAVE_STRDUP
63 char *strdup(const char *s);
64 
65 
66 #endif
67 #endif
68 
87 char *vrna_strdup_printf(const char *format,
88  ...);
89 
90 
105 char *vrna_strdup_vprintf(const char *format,
106  va_list argp);
107 
108 
127 int vrna_strcat_printf(char **dest,
128  const char *format,
129  ...);
130 
131 
144 int vrna_strcat_vprintf(char **dest,
145  const char *format,
146  va_list args);
147 
148 
187 char **vrna_strsplit(const char *string,
188  const char *delimiter);
189 
190 
198 char *vrna_random_string(int l,
199  const char symbols[]);
200 
201 
209 int vrna_hamming_distance(const char *s1,
210  const char *s2);
211 
212 
223 int vrna_hamming_distance_bound(const char *s1,
224  const char *s2,
225  int n);
226 
227 
235 void vrna_seq_toRNA(char *sequence);
236 
237 
243 void vrna_seq_toupper(char *sequence);
244 
245 
257 char *vrna_cut_point_insert(const char *string,
258  int cp);
259 
260 
273 char *vrna_cut_point_remove(const char *string,
274  int *cp);
275 
276 
281 #ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
282 
287 DEPRECATED(void str_uppercase(char *sequence), "Use vrna_seq_toupper() instead");
288 
294 DEPRECATED(void str_DNA2RNA(char *sequence), "Use vrna_seq_toRNA() instead");
295 
301 DEPRECATED(char *random_string(int l,
302  const char symbols[]),
303 "Use vrna_random_string() instead");
304 
310 DEPRECATED(int hamming(const char *s1,
311  const char *s2),
312 "Use vrna_hamming_distance() instead");
313 
319 DEPRECATED(int hamming_bound(const char *s1,
320  const char *s2,
321  int n),
322 "Use vrna_hamming_distance_bound() instead");
323 
324 #endif
325 
326 #endif
void str_uppercase(char *sequence)
Convert an input sequence to uppercase.
int vrna_hamming_distance(const char *s1, const char *s2)
Calculate hamming distance between two sequences.
char ** vrna_strsplit(const char *string, const char *delimiter)
Split a string into tokens using a delimiting character.
char * vrna_strdup_printf(const char *format,...)
Safely create a formatted string.
int vrna_hamming_distance_bound(const char *s1, const char *s2, int n)
Calculate hamming distance between two sequences up to a specified length.
char * vrna_random_string(int l, const char symbols[])
Create a random string using characters from a specified symbol set.
Various data structures and pre-processor macros.
void vrna_seq_toRNA(char *sequence)
Convert an input sequence (possibly containing DNA alphabet characters) to RNA alphabet.
char * vrna_cut_point_insert(const char *string, int cp)
Add a separating &#39;&&#39; character into a string according to cut-point position.
void str_DNA2RNA(char *sequence)
Convert a DNA input sequence to RNA alphabet.
char * vrna_cut_point_remove(const char *string, int *cp)
Remove a separating &#39;&&#39; character from a string.
int vrna_strcat_printf(char **dest, const char *format,...)
Safely append a formatted string to another string.
int hamming(const char *s1, const char *s2)
Calculate hamming distance between two sequences.
char * random_string(int l, const char symbols[])
Create a random string using characters from a specified symbol set.
int vrna_strcat_vprintf(char **dest, const char *format, va_list args)
Safely append a formatted string to another string.
void vrna_seq_toupper(char *sequence)
Convert an input sequence to uppercase.
char * vrna_strdup_vprintf(const char *format, va_list argp)
Safely create a formatted string.
int hamming_bound(const char *s1, const char *s2, int n)
Calculate hamming distance between two sequences up to a specified length.