Main Page | Data Structures | File List | Data Fields | Globals

retroflux.c File Reference

This is the main file of the program flux. More...

#include "includes.h"

Go to the source code of this file.

Defines

#define RETROFLUX_VERSION   "0.3.4"
#define RETROFLUX_DATE   "06-Aug-2004"

Functions

int main (int argc, char *argv[])
 Main function of the program.

int filterMolecules (char *reactants, const List_Ptr filterSmilesPtr, FILE *errorLogFile)
 Takes a SMILES string with several molecules and checks if one of these molecules is contained in filterSmilesPtr.

void enqueueMolecules (char *reactants, char *reactionName, const SmilesCompound_Ptr product,\const List_Ptr listPtr, FILE *errorLogFile)
 Takes a SMILES string with several molecules and adds each molecule to reactants.

void parseClp (const int argc, char *argv[], CLP_Ptr clpPtr)
 Parses the command line parameters.

List_Ptr readDataFromFile (const char *const filename, const int daylight_type, const int uniqueData,\FILE *errorLogFile)
List_Ptr readDataFromStream (FILE *inputStream, const char *const nameOfStream,\const int daylight_type, const int uniqueData, FILE *errorLogFile)
 Reads the data of a stream and stores it in a structure List.

DoubleArrayPtr getFileProperties (FILE *inputStream, const char *const nameOfStream)
 Examines the properties of a file stream.

void displayHelpText (const CLP_Ptr clpPtr)
 Displays the help text on standard error.

void displayVersionInformation (void)
 Displays the version information text on standard error.

List_Ptr readDataFromFile (const char *const filename, const int daylight_type,\const int uniqueData, FILE *errorLogFile)
 Reads the data of a file and stores it in a structure List.


Detailed Description

This is the main file of the program flux.

All other files are included here via the inclusion of the file includes.h.

Author:
Uli Fechner
Version:
10/12/2003 - Uli Fechner - 0.1 - initial stable release

17/12/2003 - Uli Fechner - 0.2 - changed function prototype of enqueueMolecules; major changes in enqueueMolecules; adjusted corresponding function call in retroflux

07/01/2004 - UF - 0.3 - introduced the filter SMILES file; added function filterMolecules, changes in retroflux, parseClp and displayHelpText

30/01/2004 - UF - 0.3.1 - small changes in enqueueMolecules, filterMolecules and readDataFromStream to reflect changes in the file smilesCompound.c

23/02/2004 - UF - 0.3.2 - added a reaction counter in the stderr output (retroflux)

16/03/2004 - UF - 0.3.3 - function SmilesCompound_getDaylightHandle was renamed to SmilesCompound_getMoleculeHandle; this change is now reflected in retroflux

06/08/2004 - UF - 0.3.4 - changes in readDataFromFile and readDataFromStream

Definition in file retroflux.c.


Define Documentation

#define RETROFLUX_DATE   "06-Aug-2004"
 

Definition at line 63 of file retroflux.c.

Referenced by displayHelpText(), displayVersionInformation(), and main().

#define RETROFLUX_VERSION   "0.3.4"
 

Definition at line 62 of file retroflux.c.

Referenced by displayHelpText(), displayVersionInformation(), and main().


Function Documentation

void displayHelpText const CLP_Ptr  clpPtr  ) 
 

Displays the help text on standard error.

Parameters:
clpPtr pointer on structure CommandLineParameters that is used to store all the command line parameters
Author:
Uli Fechner
Version:
24/11/2003 - Uli Fechner - initial release

7/1/2003 - UF - added help text for the f option

Definition at line 735 of file retroflux.c.

References CLP_Ptr, RETROFLUX_DATE, and RETROFLUX_VERSION.

Referenced by parseClp().

void displayVersionInformation void   ) 
 

Displays the version information text on standard error.

Author:
Uli Fechner
Version:
28/11/2003 - Uli Fechner - initial release

Definition at line 779 of file retroflux.c.

References CLP_DATE, CLP_VERSION, DOUBLEARRAY_DATE, DOUBLEARRAY_VERSION, DOUBLELINKEDLIST_DATE, DOUBLELINKEDLIST_VERSION, GENERALDEFINES_DATE, GENERALDEFINES_VERSION, GIVENCLP_DATE, GIVENCLP_VERSION, INCLUDES_DATE, INCLUDES_VERSION, RETROFLUX_DATE, RETROFLUX_VERSION, SMILESCOMPOUND_DATE, and SMILESCOMPOUND_VERSION.

Referenced by parseClp().

void enqueueMolecules char *  reactants,
char *  reactionName,
const SmilesCompound_Ptr  product,
\const List_Ptr  listPtr,
FILE *  errorLogFile
 

Takes a SMILES string with several molecules and adds each molecule to reactants.

This function takes a SMILES string with several molecules that are separated by a '.' (reactants) and stores each molecule individually in the List listPtr points on. Molecules are inserted at the tail of the list. reactionName and errorLogFile are used as a function argument to SmilesCompound_create.

Parameters:
reactants SMILES string that contains several molecules
reactionName name of the reaction the SMILES string resulted from
product 
listPtr pointer on a List that stores the individual molecules that result from reactants
errorLogFile file pointer on the error log file
Author:
Uli Fechner
Version:
04/12/2003 - Uli Fechner - initial release

07/12/2003 - Uli Fechner - the reactants are now named according to the scheme compoundName.reactionName, where compoundName is the name of the product

17/12/2003 - Uli Fechner - major changes related to the creation of the reactant SmilesCompound

Definition at line 345 of file retroflux.c.

References BOOLEAN_FALSE, DAYLIGHT_SMILES, List_insertTail(), List_Ptr, MemoryError, SmilesCompound_copy(), SmilesCompound_destroy(), SmilesCompound_getStringArrayOfNames(), SmilesCompound_Ptr, SmilesCompound_setSmiles(), and StringArray_mapConcatenate().

Referenced by main().

int filterMolecules char *  reactants,
const List_Ptr  filterSmilesPtr,
FILE *  errorLogFile
 

Takes a SMILES string with several molecules and checks if one of these molecules is contained in filterSmilesPtr.

This function takes a SMILES string with several molecules that are separated by a '.' (reactants) and stores each molecule individually in the List listPtr points on. Molecules are inserted at the tail of the list. reactionName and errorLogFile are used as a function argument to SmilesCompound_create.

Parameters:
reactants SMILES string that contains several molecules
filterSmilesPtr pointer on a List that stores the molecules that should be filtered
errorLogFile file pointer on the error log file
Author:
Uli Fechner
Version:
07/01/2004 - Uli Fechner - initial release

Definition at line 286 of file retroflux.c.

References BOOLEAN_FALSE, BOOLEAN_TRUE, DAYLIGHT_SMILES, List_isContained(), List_Ptr, MemoryError, SmilesCompound_create(), SmilesCompound_destroy(), and SmilesCompound_Ptr.

Referenced by main().

DoubleArrayPtr getFileProperties FILE *  inputStream,
const char *const  nameOfStream
 

Examines the properties of a file stream.

The number of columns, characters per column and the number of rows are counted and the result of this examination are stored in a structure DoubleArray. This DoubleArray contains three elements regarded to the properties of dataFile:

  • index 0 - number of columns
  • index 1 - maximum number of characters per column
  • index 2 - number of rows
The file is also checked for integrity, i.e. it is checked, if it has the same number of columns in all rows. If this is not the case, the define FileIntegrityError is called and the program aborts.

Parameters:
inputStream file pointer of the stream to examine
nameOfStream string indicating the name of the stream
Return values:
DoubleArrayPtr contains the properties of inputStream
Author:
Uli Fechner
Version:
28/11/2003 - Uli Fechner - initial release

Definition at line 647 of file retroflux.c.

References AbortProgram, DoubleArray_create(), DoubleArray_setValue(), DoubleArrayPtr, FileIntegrityError, and MemoryError.

Referenced by readDataFromStream().

int main int  argc,
char *  argv[]
 

Main function of the program.

The main function just calls the other functions. It is reduced to contain only function calls whenever possible.

Parameters:
argc the number of arguments provided via the command line by executing the program
*argv[] string array containing the command line arguments
Return values:
int exit code of the program
Author:
Uli Fechner
Version:
10/12/2003 - Uli Fechner - initial release

17/12/2003 - Uli Fechner - adjusted function call of enqueueMolecules

07/01/2004 - UF - major change: introduced the filter SMILES file; this leads to several changes in the nested while loops as well as the addition of the reading of the filter SMILES file

23/03/2004 - UF - added a reaction counter in the stderr output

Definition at line 105 of file retroflux.c.

References BOOLEAN_FALSE, BOOLEAN_TRUE, CLP_create(), CLP_destroy(), CLP_display(), CLP_getErrorLogFile(), CLP_getFilterFile(), CLP_getOutputFile(), CLP_getReactionFile(), CLP_Ptr, DAYLIGHT_SMILES, DAYLIGHT_SMIRKS, enqueueMolecules(), FileWriteError, filterMolecules(), List_destroy(), List_display(), List_getNext(), List_getNumberOfNodes(), List_hasNext(), List_Ptr, List_remove(), List_rewind(), List_setName(), parseClp(), readDataFromFile(), readDataFromStream(), RETROFLUX_DATE, RETROFLUX_VERSION, SmilesCompound_getCounter(), SmilesCompound_getMoleculeHandle(), SmilesCompound_getStringArrayOfNames(), SmilesCompound_Ptr, and StringArray_getElement().

void parseClp const int  argc,
char *  argv[],
CLP_Ptr  clpPtr
 

Parses the command line parameters.

The command line parameters are parsed here. Additionally, it is checked whether the standard in is connected to a terminal. If this is the case, no input file is provided and the help text of the program is printed on standard error. It is also checked here if there are any incompatibilities of the options provided at the command line. If so, the program aborts with an appropriate error message.

Parameters:
argc the number of arguments provided via the command line by executing the program
*argv[] string array containing the command line arguments
clpPtr pointer on structure CommandLineParameters that is used to store all the command line parameters
Author:
Uli Fechner
Version:
24/11/2003 - Uli Fechner - initial release

02/12/2003 - Uli Fechner - changed option '-r' to mandatory

03/12/2003 - Uli Fechner - now automatically setting the name of the error log file

01/07/2004 - UF - added support for the f option (filter file)

Definition at line 407 of file retroflux.c.

References AbortProgram, BOOLEAN_FALSE, BOOLEAN_TRUE, CLP_getOutputFile(), CLP_Ptr, CLP_setErrorLogFile(), CLP_setFilterFile(), CLP_setOutputFile(), CLP_setReactionFile(), displayHelpText(), displayVersionInformation(), Given_CLP_Ptr, GivenClp_create(), GivenClp_destroy(), GivenClp_getOption(), GivenClp_setOption(), MandatoryOption, and MemoryError.

Referenced by main().

List_Ptr readDataFromFile const char *const  filename,
const int  daylight_type,
\const int  uniqueData,
FILE *  errorLogFile
 

Reads the data of a file and stores it in a structure List.

Attention:
This is mainly a wrapper for function readDataFromStream!
Parameters:
filename the name of the file to read
daylight_type indicates the file type (DAYLIGHT_SMILES, DAYLIGHT_SMIRKS, DAYLIGHT_SMARTS)
uniqueData if set to BOOLEAN_TRUE input SMILES are filtered to yield unique SMILES
errorLogFile file pointer on the error log file
Return values:
List_Ptr points on structure List containing the content of filename
Author:
Uli Fechner
Version:
28/11/2003 - Uli Fechner - initial release

09/06/2004 - UF - added new parameter uniqueData

Definition at line 495 of file retroflux.c.

References FileReadError, List_Ptr, and readDataFromStream().

Referenced by main().

List_Ptr readDataFromFile const char *const  filename,
const int  daylight_type,
const int  uniqueData,
\FILE *  errorLogFile
 

List_Ptr readDataFromStream FILE *  inputStream,
const char *const  nameOfStream,
\const int  daylight_type,
const int  uniqueData,
FILE *  errorLogFile
 

Reads the data of a stream and stores it in a structure List.

Parameters:
inputStream file pointer of the stream to read
nameOfStream string indicating the name of the stream
daylight_type indicates the file type (DAYLIGHT_SMILES, DAYLIGHT_SMIRKS, DAYLIGHT_SMARTS)
uniqueData if set to BOOLEAN_TRUE input SMILES are filtered to yield unique SMILES
errorLogFile file pointer on the error log file
Return values:
List_Ptr points on structure List containing the content of inputStream
Author:
Uli Fechner
Version:
28/11/2003 - Uli Fechner - initial release

08/12/2003 - Uli Fechner - considered unsuccessful creations of SmilesCompounds due to invalid input SMILES; added error output

09/06/2004 - UF - added new parameter uniqueData; bugfix: SMILES without a name were assigned an empty string;

11/06/2004 - UF - MAJOR change: from now on the first column is the SMILES and the second column is the name (if any; before the 1st column was the name and the 2nd column was the SMILES); this follows the common format of SMILES files

05/07/2004 - UF - if no name is provided the SMILES/SMARTS/SMIRKS is taken as a name

Definition at line 527 of file retroflux.c.

References BOOLEAN_FALSE, DoubleArray_destroy(), DoubleArray_getValue(), DoubleArrayPtr, getFileProperties(), List_create(), List_insertTail(), List_Ptr, MemoryError, SmilesCompound_create(), SmilesCompound_destroy(), SmilesCompound_display(), SmilesCompound_identical(), SmilesCompound_Ptr, StringArray_addElement(), StringArray_create(), StringArray_destroy(), StringArray_display(), StringArray_getNumberOfElements(), and StringArray_Ptr.

Referenced by main(), and readDataFromFile().


Generated on Tue Nov 9 16:27:12 2004 for retroflux by doxygen 1.3.6