Functions

src/read.h File Reference

Functions that are responsible for reading and printing input, arguments and other stuff. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "structs.h"

Go to the source code of this file.

Functions

char * get_line (FILE *fp)
 Read a line from a file.
struct gotoh_arguments gotoh_readArguments (int argc, char *argv[])
 Read the command line arguments.
struct gotoh_settings gotoh_readSettings (gotoh_arguments ga)
 Initialize settings.
struct gotoh_motifSingle gotoh_readMotifSingle (char *file)
 Read a motif into a data structure.
struct gotoh_motif gotoh_readMotif2sided (char *file, gotoh_settings cfg)
 Read a 2-sided motif into a data structure.
struct gotoh_arguments gotoh_initArguments ()
 Initialize the arguments struct.
struct gotoh_settings gotoh_initSettings ()
 Initialize the settings struct.
void gotoh_printArguments (gotoh_arguments ga)
 Print arguments struct.
void gotoh_printSettings (gotoh_settings gs)
 Print settings struct.
void gotoh_printMotifSingle (struct gotoh_motifSingle m)
 Print the input motif.
void gotoh_printMotif (struct gotoh_motif m)
 Print the input Motif (2-sided).
void usage ()
 Print usage information.
void version ()
 Print version information.
void gotoh_freeArguments (gotoh_arguments ga)
 Free arguments struct.
void gotoh_freeSettings (gotoh_settings gs)
 Free settings struct.
void gotoh_freeMotifSingle (gotoh_motifSingle gm)
 Free struct for motif.
void gotoh_freeMotif (gotoh_motif gm)
 Free struct for 2-sided motif.
void gotoh_Error (char *msg, int v)
 Print error message and exit program.
void gotoh_Warning (char *msg, int v)
 Print warning to stderr, continue program.

Detailed Description

Functions that are responsible for reading and printing input, arguments and other stuff.

This file contains functions that read arguments and settings, prints them. There are functions that initialize and free necessary structs.


Function Documentation

char * get_line ( FILE *  fp  ) 

Read a line from a file.

  • fp Filepointer to an opended (at least for reading) file.

The function get_line() reads a line of arbitrary length from the file pointed to by fp. The file should be opened (at least) for reading before calling get_line().

Returns:
get_line() returns the read line as string.
void gotoh_Error ( char *  msg,
int  v 
)

Print error message and exit program.

  • msg Message as string
  • v Verbose value

Print error message and exit program.

void gotoh_freeArguments ( gotoh_arguments  ga  ) 

Free arguments struct.

  • ga Struct containing the command line arguments.
void gotoh_freeMotif ( gotoh_motif  gm  ) 

Free struct for 2-sided motif.

  • gm Struct containing all motif information
void gotoh_freeMotifSingle ( gotoh_motifSingle  gm  ) 

Free struct for motif.

  • gm Struct containing all motif information
void gotoh_freeSettings ( gotoh_settings  gs  ) 

Free settings struct.

  • gs Struct for settings
gotoh_arguments gotoh_initArguments (  )  [read]

Initialize the arguments struct.

Returns:
gotoh_initArguments() returns an initialized struct for the command line arguments.
gotoh_settings gotoh_initSettings (  )  [read]

Initialize the settings struct.

Returns:
gotoh_initSettings() returns an initialized struct for the settings.
void gotoh_printArguments ( gotoh_arguments  ga  ) 

Print arguments struct.

  • ga Struct for command line arguments
void gotoh_printMotif ( struct gotoh_motif  m  ) 

Print the input Motif (2-sided).

  • m Struct containing all motif information
void gotoh_printMotifSingle ( struct gotoh_motifSingle  m  ) 

Print the input motif.

  • m Struct containing all motif information
void gotoh_printSettings ( gotoh_settings  gs  ) 

Print settings struct.

  • gs Struct for settings
struct gotoh_arguments gotoh_readArguments ( int  argc,
char *  argv[] 
) [read]

Read the command line arguments.

  • argc Number of command line arguments
  • argv Array containing the command line arguments

gotoh_readArguments() reads the command line arguments and initializes the program respectively. If something is wrong with the input help messages are returned and the program exits.

Returns:
gotoh_readArguments() returns a struct containing the values for each argument.
struct gotoh_motif gotoh_readMotif2sided ( char *  file,
gotoh_settings  cfg 
) [read]

Read a 2-sided motif into a data structure.

  • file The filename of the file containing the motif as frequency patterns with list of paired positions.
  • cfg Struct containing the configuration settings

gotoh_readMotif2sided() reads the frequency patterns of both sides of the motif and the corresponding base pair information. For details on the format see scripts/reformat.pl.

Returns:
gotoh_readMotif2sided() returns a struct containing all information about the motif.
struct gotoh_motifSingle gotoh_readMotifSingle ( char *  file  )  [read]

Read a motif into a data structure.

  • file The filename of the file containing the motif as frequency pattern.

gotoh_readMotifSingle() reads the frequency pattern of the query motif into a datastruct. Additionally, it stores min and max values for each column of the motif as well as the information content.

Returns:
gotoh_readMotifSingle() returns a struct containing the matrices for frequency, min, max and information content.
struct gotoh_settings gotoh_readSettings ( gotoh_arguments  ga  )  [read]

Initialize settings.

  • ga Struct containing the command line arguments.

gotoh_readSettings() parses the command line arguments, checks the validity of each parameter and exits the program if something is wrong with the parameters.

Returns:
gotoh_readSettings() returns a struct containing the values for all settings.
void gotoh_Warning ( char *  msg,
int  v 
)

Print warning to stderr, continue program.

  • msg Message as string
  • v Verbose value

Print warning to stderr, continue program.

 All Classes Files Functions Variables