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

countSmarts.c File Reference

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

#include "includes.h"

Go to the source code of this file.

Defines

#define COUNTSMARTS_VERSION   "0.1"
#define COUNTSMARTS_DATE   "11-JUN-2004"

Functions

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

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

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

List_Ptr readDataFromStream (FILE *inputStream, const char *const nameOfStream,\const int daylight_type, const int uniqueData, FILE *errorLogFile)
DoubleArrayPtr getFileProperties (FILE *inputStream, const char *const nameOfStream)
 Examines the properties of a file stream.

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

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

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.


Detailed Description

This is the main file of the program countSmarts.

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

Author:
Uli Fechner
Version:
11/06/2004 - UF - 0.1 - initial stable release

Definition in file countSmarts.c.


Define Documentation

#define COUNTSMARTS_DATE   "11-JUN-2004"
 

Definition at line 27 of file countSmarts.c.

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

#define COUNTSMARTS_VERSION   "0.1"
 

Definition at line 26 of file countSmarts.c.

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


Function Documentation

void displayHelpText  ) 
 

Displays the help text on standard error.

Author:
UF
Version:
22/04/04 - UF - initial release

Definition at line 544 of file countSmarts.c.

References COUNTSMARTS_DATE, and COUNTSMARTS_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 587 of file countSmarts.c.

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

Referenced by parseClp().

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 458 of file countSmarts.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:
Kristina Grabowski
Version:
20/02/2004 - Uli Fechner - 0.1 - initial stable release

Definition at line 60 of file countSmarts.c.

References BOOLEAN_TRUE, CLP_create(), CLP_destroy(), CLP_display(), CLP_getErrorLogFile(), CLP_getMatchingType(), CLP_getOutputFile(), CLP_getSmartsFile(), CLP_getUniqueSmiles(), CLP_Ptr, COUNTSMARTS_DATE, COUNTSMARTS_VERSION, DAYLIGHT_SMARTS, DAYLIGHT_SMILES, FileWriteError, List_destroy(), List_getNext(), List_getNumberOfNodes(), List_hasNext(), List_Ptr, List_rewind(), List_setName(), parseClp(), readDataFromFile(), readDataFromStream(), SmilesCompound_getCounter(), SmilesCompound_getMoleculeHandle(), SmilesCompound_getSmiles(), SmilesCompound_getStringArrayOfNames(), SmilesCompound_Ptr, StringArray_getElement(), and StringArray_getNumberOfElements().

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:
Kritsina Grabowski
Version:
20/02/04 - Uli Fechner - initial release

Definition at line 220 of file countSmarts.c.

References AbortProgram, BOOLEAN_FALSE, BOOLEAN_TRUE, CLP_getOutputFile(), CLP_Ptr, CLP_setErrorLogFile(), CLP_setMatchingType(), CLP_setOutputFile(), CLP_setSmartsFile(), CLP_setUniqueSmiles(), 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 308 of file countSmarts.c.

References FileReadError, List_Ptr, and readDataFromStream().

Referenced by main().

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

Definition at line 339 of file countSmarts.c.

References BOOLEAN_FALSE, 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().

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


Generated on Mon Nov 8 16:04:07 2004 for countSmarts by doxygen 1.3.6