Next: , Previous: Parsing and Comparing, Up: Top


4 Utilities

The following utilities are used and therefore provided by the library:

— Function: int PS_dot_plot (char* sequence, char* filename)

reads base pair probabilities produced by pf_fold() from the global array pr and the pair list base_pair produced by fold() and produces a postscript “dot plot” that is written to filename. The “dot plot” represents each base pairing probability by a square of corresponding area in a upper triangle matrix. The lower part of the matrix contains the minimum free energy structure.

— Function: int PS_rna_plot (char* sequence, char* structure, char* filename)

produces a secondary structure graph in PostScript and writes it to filename. Note that this function has changed from previous versions and now expects the structure to be plotted in dot-bracket notation as an argument. It does not make use of the global base_pair array anymore.

— Function: int PS_rna_plot_a (char* sequence, char* structure, char* filename, char* pre, char* post)

Same as PS_rna_plot but adds extra PostScript macros for various annotations (see generated PS code). The pre and post variables contain PostScript code that is verbatim copied in the resulting PS file just before and after the structure plot.

— Function: int svg_RNA_plot (char* sequence, char* structure, char* filename)

produces a secondary structure plot in SVG format and writes it to filename.

— Function: int gmlRNA (char* sequence, char* structure, char* filename, char option)

produces a secondary structure graph in the Graph Meta Language gml and writes it to filename. If option is an uppercase letter the sequence is used to label nodes, if option equals 'X' or 'x' the resulting file will coordinates for an initial layout of the graph.

— Variable: int rna_plot_type

switches between different layout algorithms for drawing secondary structures in PS_rna_plot and gmlRNA. Current possibility are 0 for a simple radial drawing or 1 for the modified radial drawing taken from the naview program of Bruccoleri & Heinrich (1988).

— Function: char* random_string (int l, char* symbols)

generates a “random” string of characters from symbols with length l.

— Function: int hamming (char* s1, char* s2)

returns the number of positions in which s1 and s2 differ, the so called “Hamming” distance. s1 and s2 should have the same length.

— Function: unsigned char* pack_structure (char* struc)

returns a binary string encoding the secondary structure struc using a 5:1 compression scheme. The string is NULL terminated and can therefore be used with standard string functions such as strcmp(). Useful for programs that need to keep many structures in memory.

— Function: char* unpack_structure (unsigned char* packed)

translate a compressed binary string produced by pack_structure() back into the familiar dot bracket notation.

— Function: short* make_pair_table (char* structure)

returns a newly allocated table, such that: table[i]=j if (i.j) pair or 0 if i is unpaired, table[0] contains the length of the structure.

— Function: char* time_stamp (void)

returns a string containing the current date in the format “Fri Mar 19 21:10:57 1993”.

— Function: void nrerror (char* message)

writes message to stderr and aborts the program.

— Function: double urn ()

returns a pseudo random number in the range [0..1[, usually implemented by calling erand48().

— Variable: unsigned short xsubi[3]

is used by urn (). These should be set to some random number seeds before the first call to urn ().

— Function: int int_urn (int from, int to)

generates a pseudo random integer in the range [from, to].

— Function: void* space (unsigned int size)

returns a pointer to size bytes of allocated and 0 initialized memory; aborts with an error if memory is not available.

— Function: char* get_line (FILE* fp)

reads a line of arbitrary length from the stream *fp, and returns a pointer to the resulting string. The necessary memory is allocated and should be released using free() when the string is no longer needed.

Prototypes for PS_rna_plot() and PS_dot_plot() reside in PS_dot.h, the other functions are declared in utils.h.