Parsing, Converting, and Comparing - Functions to Manipulate Sequence and Structure Strings
Utilities
Collaboration diagram for Parsing, Converting, and Comparing - Functions to Manipulate Sequence and Structure Strings:

## Files

file | string_utils.h
| General utility- and helper-functions for RNA sequence and structure strings used throughout the ViennaRNA Package.

## Macros

#define | XSTR(s) STR(s)
| Stringify a macro after expansion.
#define | STR(s) #s
| Stringify a macro argument.
#define | FILENAME_MAX_LENGTH 80
| Maximum length of filenames that are generated by our programs. More...
#define | FILENAME_ID_LENGTH 42
| Maximum length of id taken from fasta header for filename generation. More...

## Functions

char * | vrna_random_string (int l, const char symbols[])
| Create a random string using characters from a specified symbol set. More...
int | vrna_hamming_distance (const char *s1, const char *s2)
| Calculate hamming distance between two sequences. More...
int | vrna_hamming_distance_bound (const char *s1, const char *s2, int n)
| Calculate hamming distance between two sequences up to a specified length. More...
void | vrna_seq_toRNA (char *sequence)
| Convert an input sequence (possibly containing DNA alphabet characters) to RNA alphabet. More...
void | vrna_seq_toupper (char *sequence)
| Convert an input sequence to uppercase. More...
char * | vrna_cut_point_insert (const char *string, int cp)
| Add a separating '&' character into a string according to cut-point position. More...
char * | vrna_cut_point_remove (const char *string, int *cp)
| Remove a separating '&' character from a string. More...

## Detailed Description

## Macro Definition Documentation

#define FILENAME_MAX_LENGTH 80

`#include <ViennaRNA/string_utils.h>`

Maximum length of filenames that are generated by our programs.

This definition should be used throughout the complete ViennaRNA package wherever a static array holding filenames of output files is declared.

#define FILENAME_ID_LENGTH 42

`#include <ViennaRNA/string_utils.h>`

Maximum length of id taken from fasta header for filename generation.

this has to be smaller than FILENAME_MAX_LENGTH since in most cases, some suffix will be appended to the ID

## Function Documentation

char* vrna_random_string | ( | int | l,
|  | const char | symbols[]
| ) |  |

`#include <ViennaRNA/string_utils.h>`

Create a random string using characters from a specified symbol set.

Parameters

  l | The length of the sequence
  symbols | The symbol set

Returns
  A random string of length 'l' containing characters from the symbolset

int vrna_hamming_distance | ( | const char * | s1,
|  | const char * | s2
| ) |  |

`#include <ViennaRNA/string_utils.h>`

Calculate hamming distance between two sequences.

Parameters

  s1 | The first sequence
  s2 | The second sequence

Returns
  The hamming distance between s1 and s2

int vrna_hamming_distance_bound | ( | const char * | s1,
|  | const char * | s2,
|  | int | n
| ) |  |

`#include <ViennaRNA/string_utils.h>`

Calculate hamming distance between two sequences up to a specified length.

This function is similar to vrna_hamming_distance() but instead of comparing both sequences up to their actual length only the first 'n' characters are taken into account

Parameters

  s1 | The first sequence
  s2 | The second sequence

Returns
  The hamming distance between s1 and s2

void vrna_seq_toRNA | ( | char * | sequence | ) |

`#include <ViennaRNA/string_utils.h>`

Convert an input sequence (possibly containing DNA alphabet characters) to RNA alphabet.

This function substitudes T and t with U and u, respectively

Parameters

  sequence | The sequence to be converted

void vrna_seq_toupper | ( | char * | sequence | ) |

`#include <ViennaRNA/string_utils.h>`

Convert an input sequence to uppercase.

Parameters

  sequence | The sequence to be converted

char* vrna_cut_point_insert | ( | const char * | string,
|  | int | cp
| ) |  |

`#include <ViennaRNA/string_utils.h>`

Add a separating '&' character into a string according to cut-point position.

If the cut-point position is less or equal to zero, this function just returns a copy of the provided string. Otherwise, the cut-point character is set at the corresponding position

Parameters

  string | The original string
  cp | The cut-point position

Returns
  A copy of the provided string including the cut-point character

char* vrna_cut_point_remove | ( | const char * | string,
|  | int * | cp
| ) |  |

`#include <ViennaRNA/string_utils.h>`

Remove a separating '&' character from a string.

This function removes the cut-point indicating '&' character from a string and memorizes its position in a provided integer variable. If not '&' is found in the input, the integer variable is set to -1. The function returns a copy of the input string with the '&' being sliced out.

Parameters

  string | The original string
  cp | The cut-point position

Returns
  A copy of the input string with the '&' being sliced out