RNAlib-2.5.1
strings.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
28#include <stdarg.h>
30
34#define XSTR(s) STR(s)
35
39#define STR(s) #s
40
41#ifndef FILENAME_MAX_LENGTH
42
49#define FILENAME_MAX_LENGTH 80
50
57#define FILENAME_ID_LENGTH 42
58
59#endif
60
61#ifdef HAVE_CONFIG_H
62#include <config.h>
63#ifndef HAVE_STRDUP
64char *
65strdup(const char *s);
66
67
68#endif
69#endif
70
89char *
90vrna_strdup_printf(const char *format,
91 ...);
92
93
108char *
109vrna_strdup_vprintf(const char *format,
110 va_list argp);
111
112
131int
133 const char *format,
134 ...);
135
136
149int
151 const char *format,
152 va_list args);
153
154
159#define VRNA_TRIM_LEADING 1U
160
165#define VRNA_TRIM_TRAILING 2U
166
171#define VRNA_TRIM_IN_BETWEEN 4U
172
177#define VRNA_TRIM_SUBST_BY_FIRST 8U
178
183#define VRNA_TRIM_DEFAULT ( VRNA_TRIM_LEADING | VRNA_TRIM_TRAILING )
184
189#define VRNA_TRIM_ALL ( VRNA_TRIM_DEFAULT | VRNA_TRIM_IN_BETWEEN )
190
237unsigned int
238vrna_strtrim(char *string,
239 const char *delimiters,
240 unsigned int keep,
241 unsigned int options);
242
243
290char **
291vrna_strsplit(const char *string,
292 const char *delimiter);
293
294
295char *
296vrna_strjoin(const char **strings,
297 const char *delimiter);
298
299
307char *
309 const char symbols[]);
310
311
319int
321 const char *s2);
322
323
334int
336 const char *s2,
337 int n);
338
339
347void
348vrna_seq_toRNA(char *sequence);
349
350
356void
357vrna_seq_toupper(char *sequence);
358
359
374void
375vrna_seq_reverse(char *sequence);
376
377
396char *
397vrna_DNA_complement(const char *sequence);
398
399
406char *
407vrna_seq_ungapped(const char *sequence);
408
409
421char *
422vrna_cut_point_insert(const char *string,
423 int cp);
424
425
438char *
439vrna_cut_point_remove(const char *string,
440 int *cp);
441
442
447#ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
448
453DEPRECATED(void
454 str_uppercase(char *sequence),
455 "Use vrna_seq_toupper() instead");
456
462DEPRECATED(void
463 str_DNA2RNA(char *sequence),
464 "Use vrna_seq_toRNA() instead");
465
471DEPRECATED(char *random_string(int l,
472 const char symbols[]),
473 "Use vrna_random_string() instead");
474
480DEPRECATED(int
481 hamming(const char *s1,
482 const char *s2),
483 "Use vrna_hamming_distance() instead");
484
490DEPRECATED(int
491 hamming_bound(const char *s1,
492 const char *s2,
493 int n),
494 "Use vrna_hamming_distance_bound() instead");
495
496#endif
497
498#endif
Various data structures and pre-processor macros.
int vrna_strcat_vprintf(char **dest, const char *format, va_list args)
Safely append a formatted string to another string.
int vrna_hamming_distance(const char *s1, const char *s2)
Calculate hamming distance between two sequences.
char * vrna_cut_point_insert(const char *string, int cp)
Add a separating '&' character into a string according to cut-point position.
void vrna_seq_toupper(char *sequence)
Convert an input sequence to uppercase.
char * vrna_DNA_complement(const char *sequence)
Retrieve a DNA sequence which resembles the complement of the input sequence.
char * vrna_seq_ungapped(const char *sequence)
Remove gap characters from a nucleotide sequence.
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_strdup_printf(const char *format,...)
Safely create a formatted string.
char * vrna_strdup_vprintf(const char *format, va_list argp)
Safely create a formatted string.
char * vrna_random_string(int l, const char symbols[])
Create a random string using characters from a specified symbol set.
int vrna_strcat_printf(char **dest, const char *format,...)
Safely append a formatted string to another string.
void vrna_seq_toRNA(char *sequence)
Convert an input sequence (possibly containing DNA alphabet characters) to RNA alphabet.
unsigned int vrna_strtrim(char *string, const char *delimiters, unsigned int keep, unsigned int options)
Trim a string by removing (multiple) occurences of a particular character.
void vrna_seq_reverse(char *sequence)
Reverse a string in-place.
char * vrna_cut_point_remove(const char *string, int *cp)
Remove a separating '&' character from a string.
char ** vrna_strsplit(const char *string, const char *delimiter)
Split a string into tokens using a delimiting character.
void str_uppercase(char *sequence)
Convert an input sequence to uppercase.
int hamming_bound(const char *s1, const char *s2, int n)
Calculate hamming distance between two sequences up to a specified length.
void str_DNA2RNA(char *sequence)
Convert a DNA input sequence to RNA alphabet.
char * random_string(int l, const char symbols[])
Create a random string using characters from a specified symbol set.
int hamming(const char *s1, const char *s2)
Calculate hamming distance between two sequences.