# Utilities - Odds and Ends

### Table of Contents

- Producing secondary structure graphs
- Producing (colored) dot plots for base pair probabilities
- Producing (colored) alignments
- RNA sequence related utilities
- RNA secondary structure related utilities
- Miscellaneous Utilities

## Producing secondary structure graphs

    int PS_rna_plot ( char *string,
                      char *structure,
                      char *file)

Produce a secondary structure graph in PostScript and write it to 'filename'.

    int PS_rna_plot_a (
                char *string,
                char *structure,
                char *file,
                char *pre,
                char *post)

Produce a secondary structure graph in PostScript including additional annotation macros and write it to 'filename'.

    int gmlRNA (char *string,
                char *structure,
                char *ssfile,
                char option)

Produce a secondary structure graph in Graph Meta Language (gml) and write it to a file.

    int ssv_rna_plot (char *string,
                      char *structure,
                      char *ssfile)

Produce a secondary structure graph in SStructView format.

    int svg_rna_plot (char *string,
                      char *structure,
                      char *ssfile)

Produce a secondary structure plot in SVG format and write it to a file.

    int xrna_plot ( char *string,
                    char *structure,
                    char *ssfile)

Produce a secondary structure plot for further editing in XRNA.

    int rna_plot_type

Switch for changing the secondary structure layout algorithm.

Two low-level functions provide direct access to the graph lauyouting algorithms:

    int simple_xy_coordinates ( short *pair_table,
                                float *X,
                                float *Y)

Calculate nucleotide coordinates for secondary structure plot the Simple way.

    int naview_xy_coordinates ( short *pair_table,
                                float *X,
                                float *Y)

See also:
  PS_dot.h and naview.h for more detailed descriptions.

Table of Contents

## Producing (colored) dot plots for base pair probabilities

    int PS_color_dot_plot ( char *string,
                            cpair *pi,
                            char *filename)

    int PS_color_dot_plot_turn (char *seq,
                                cpair *pi,
                                char *filename,
                                int winSize)

    int PS_dot_plot_list (char *seq,
                          char *filename,
                          plist *pl,
                          plist *mf,
                          char *comment)

Produce a postscript dot-plot from two pair lists.

    int PS_dot_plot_turn (char *seq,
                          struct plist *pl,
                          char *filename,
                          int winSize)

See also:
  PS_dot.h for more detailed descriptions.

## Producing (colored) alignments

    int PS_color_aln (
                const char *structure,
                const char *filename,
                const char *seqs[],
                const char *names[])

Table of Contents

## RNA sequence related utilities

Several functions provide useful applications to RNA sequences

    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.

    void str_DNA2RNA(char *sequence);

Convert a DNA input sequence to RNA alphabet.

    void str_uppercase(char *sequence);

Convert an input sequence to uppercase.

Table of Contents

## RNA secondary structure related utilities

    char *pack_structure (const char *struc)

Pack secondary secondary structure, 5:1 compression using base 3 encoding.

    char *unpack_structure (const char *packed)

Unpack secondary structure previously packed with pack_structure().

    short *make_pair_table (const char *structure)

Create a pair table of a secondary structure.

    short *copy_pair_table (const short *pt)

Get an exact copy of a pair table.

Table of Contents

## Miscellaneous Utilities

    void print_tty_input_seq (void)

Print a line to stdout that asks for an input sequence.

    void print_tty_constraint_full (void)

Print structure constraint characters to stdout (full constraint support).

    void print_tty_constraint (unsigned int option)

Print structure constraint characters to stdout. (constraint support is specified by option parameter).

    int   *get_iindx (unsigned int length)

Get an index mapper array (iindx) for accessing the energy matrices, e.g. in partition function related functions.

    int   *get_indx (unsigned int length)

Get an index mapper array (indx) for accessing the energy matrices, e.g. in MFE related functions.

    void constrain_ptypes (
                    const char *constraint,
                    unsigned int length,
                    char *ptype,
                    int *BP,
                    int min_loop_size,
                    unsigned int idx_type)

Insert constraining pair types according to constraint structure string.

    char  *get_line(FILE *fp);

Read a line of arbitrary length from a stream.

    unsigned int read_record(
                    char **header,
                    char **sequence,
                    char ***rest,
                    unsigned int options);

Get a data record from stdin.

    char  *time_stamp (void)

Get a timestamp.

    void warn_user (const char message[])

Print a warning message.

    void nrerror (const char message[])

Die with an error message.

    void   init_rand (void)

Make random number seeds.

    unsigned short xsubi[3];

Current 48 bit random number.

    double urn (void)

get a random number from [0..1]

    int    int_urn (int from, int to)

Generates a pseudo random integer in a specified range.

    void  *space (unsigned size)

Allocate space safely.

    void  *xrealloc ( void *p,
                      unsigned size)

Reallocate space safely.

See also:
  utils.h for a complete overview and detailed description of the utility functions

Table of Contents

Next Page: Examples