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

smilesCompound.c File Reference

Fault-tolerant structure to store the data of one SMILES, SMIRKS or SMARTS. More...

Go to the source code of this file.

Data Structures

struct  SmilesCompound

Defines

#define SMILESCOMPOUND_VERSION   "1.4.0"
#define SMILESCOMPOUND_DATE   "16-Mar-2004"
#define BOOLEAN_FALSE   0
 Boolean variables are simulated with the defines BOOLEAN_FALSE and BOOLEAN_TRUE.

#define BOOLEAN_TRUE   1
 Boolean variables are simulated with the defines BOOLEAN_FALSE and BOOLEAN_TRUE.

#define SmilesCompound_increaseCounter(scPtr)   ( (scPtr->counter)++)
 The member counter of structure SmilesCompound is increased by one.

#define SmilesCompound_decreaseCounter(scPtr)   ( (scPtr->counter)--)
 The member counter of structure SmilesCompound is decreased by one.


Typedefs

typedef SmilesCompoundSmilesCompound_Ptr
 A pointer to structure SmilesCompound is assigned the name SmilesCompound_Ptr.


Functions

SmilesCompound_Ptr SmilesCompound_create (char *const name, char *const smiles, const int daylight_type,\FILE *errorLogFile)
 Creates a SmilesCompound structure.

void SmilesCompound_destroy (void *scPtr)
 Destroys a SmilesCompound structure.

void SmilesCompound_display (void *scPtr, FILE *outputStream)
 Displays a structure SmilesCompound.

SmilesCompound_Ptr SmilesCompound_copy (const SmilesCompound_Ptr scPtr)
 Returns a deepcopy of the SmilesCompound scPtr.

int SmilesCompound_identical (const void *scPtr1, const void *scPtr2)
 Checks if the two SmilesCompounds scPtr1 and scPtr2 have identical char* smiles.

void SmilesCompound_setName (const SmilesCompound_Ptr scPtr, const char *const name)
 The name of structure SmilesCompound is set to name as the only name.

void SmilesCompound_addName (const SmilesCompound_Ptr scPtr, const char *const name)
 name is added to the list of names of structure SmilesCompound.

StringArray_Ptr SmilesCompound_getStringArrayOfNames (const SmilesCompound_Ptr scPtr)
 The member sAPtr (contains the name(s)) of structure SmilesCompound is returned.

int SmilesCompound_removeFromArrayOfNames (const SmilesCompound_Ptr scPtr, const char *name)
 All names of scPtr that are identical to name are removed from the StringArray that contains the names.

int SmilesCompound_setSmiles (const SmilesCompound_Ptr scPtr, char *smiles, const int daylight_type,\FILE *errorLogFile)
 The member smiles of structure SmilesCompound is set.

char * SmilesCompound_getSmiles (const SmilesCompound_Ptr scPtr)
 The member smiles of structure SmilesCompound is returned.

void SmilesCompound_setCounter (const SmilesCompound_Ptr scPtr, const int counter)
 The member counter of structure SmilesCompound is set.

int SmilesCompound_getCounter (const SmilesCompound_Ptr scPtr)
 The member counter of structure SmilesCompound is returned.

void SmilesCompound_setMoleculeHandle (const SmilesCompound_Ptr scPtr, const dt_Handle moleculeHandle)
 The member moleculeHandle of structure SmilesCompound is set.

dt_Handle SmilesCompound_getMoleculeHandle (const SmilesCompound_Ptr scPtr)
 The member moleculeHandle of structure SmilesCompound is returned.


Detailed Description

Fault-tolerant structure to store the data of one SMILES, SMIRKS or SMARTS.


This structure stores the data of one SMILES, SMIRKS or SMARTS.
The structure is created with SmilesCompound_create, destroyed with SmilesCompound_destroy and displayed with SmilesCompound_display. With SmilesCompound_setnameOfMember and SmilesCompound_getnameOfMember the values of the individual members of the structure SmilesCompound could be set or gotten. SmilesCompound_identical checks if the smiles of two SmilesCompounds are identical (returns BOOLEAN_TRUE) or non-identical (returns BOOLEAN_FALSE). Non-Identity is only true if both smiles are canonical.
If a SmilesCompound is created with a SMILES, member smiles stores the canonical SMILES of that compound to allow for a idenditcal check (SmilesCompound_identical). Canonical SMIRKS are not supported by the Daylight Toolkit. Hence, the uniqueness check fails, if two reactions share the same semantics but differ lexicographically. The same holds for SMARTS.
The name of a SMILES, SMIRKS or SMARTS is stored in a StringArray. Thus, it is possible to store more than one name for a given SMILES, SMIRKS or SMARTS. Detailed information about accessibility of the name is provided by the documentation of the respective functions (SmilesCompound_setName, SmilesCompound_addName and SmilesCompound_getStringArrayOfNames).

Attention:
If the member smiles or the name of a SMILES, SMIRKS or SMART is set (SmilesCompound_setName, SmilesCompound_addName and SmilesCompound_setSmiles) the provided string is copied via strncpy. Hence, the string provided as an argument has to be freed by the caller of the function.

Description of the members:

smiles - string containing the SMILES, SMIRKS or SMARTS of one compound
counter - counts the occurence of a specific SMILES (does not work for SMIRKS and SMARTS as they cannot be converted to a canonical representation)
sAPtr - pointer on structure StringArray that stores one or more names of the SMILES, SMIRKS or SMARTS
moleculeHandle - dt_Handle on a Daylight object that correspoinds to smiles

fingerprintHandle - dt_Handle on a Daylight fingerprint object that corresponds to smiles

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

02/12/2003 - Uli Fechner - 1.0.2 - added the member counter and the functions SmilesCompound_getCounter, SmilesCompound_setCounter, SmilesCompound_increaseCounter and SmilesCompound_decreaseCounter; added the member moleculeHandle and the functions SmilesCompound_getMoleculeHandle and SmilesCompound_setMoleculeHandle

03/12/2003 - Uli Fechner - 1.0.3 - added support for write out of errors revieved from dt_smilinerrors (SmilesCompound_create); added function SmilesCompound_identical @ version 04/12/2003 - Uli Fechner - 1.0.4 - SmilesCompound_create stores now the canonical SMILES to allow for identical check between two SmilesCompouns; small change in SmilesCompound_display

08/12/2003 - Uli Fechner - 1.0.5 - changes in SmilesCompound_create to allow for the checking of a successful creation

10/12/2003 - Uli Fechner - 1.1.0 - changed the storage of a compound name from char* to StringArray; modified function SmilesCompound_create, SmilesCompound_destroy, SmilesCompound_display, SmilesCompound_setName, SmilesCompound_addName and SmilesCompound_getName accordingly; change in SmilesCompound_identical: if two SmilesCompounds are identical the StringArray of the source SmilesCompound is concatenated to the StringArray of the target compound

17/12/2003 - Uli Fechner - 1.2.0 - changed the name of SmilesCompound_getName to SmilesCompound_getStringArrayOfNames; complete re-write of SmilesCompound_setSmiles (changed return type from void to int); added SmilesCompound_copy

19/12/2003 - Uli Fechner - 1.2.1 - added function SmilesCompound_removeFromArrayOfNames; major bugifx in SmilesCompound_identical

29/01/2004 - Tina Grabowski - 1.3.0 - major change: added support for SMARTS; corresponding changes in SmilesCompound_create and SmilesCompound_setSmiles

16/03/2004 - UF - 1.4.0 - added member fingerprint and the functions SmilesCompound_getFingerprint and SmilesCompound_setFingerprint; renamed member daylightHandle to moleculeHandle in the complete file; renamed functions SmilesCompound_get/setDaylightHandle to SmilesCompound_get/setMoleculeHandle accordingly \code

Definition in file smilesCompound.c.


Define Documentation

#define BOOLEAN_FALSE   0
 

Boolean variables are simulated with the defines BOOLEAN_FALSE and BOOLEAN_TRUE.

Author:
Uli Fechner
Version:
03/12/2003 - Uli Fechner - initial release

Definition at line 94 of file smilesCompound.c.

#define BOOLEAN_TRUE   1
 

Boolean variables are simulated with the defines BOOLEAN_FALSE and BOOLEAN_TRUE.

Author:
Uli Fechner
Version:
03/12/2003 - Uli Fechner - initial release

Definition at line 103 of file smilesCompound.c.

#define SMILESCOMPOUND_DATE   "16-Mar-2004"
 

Definition at line 3 of file smilesCompound.c.

Referenced by displayVersionInformation().

#define SmilesCompound_decreaseCounter scPtr   )     ( (scPtr->counter)--)
 

The member counter of structure SmilesCompound is decreased by one.

Parameters:
scPtr pointer on the structure SmilesCompound the member counter belongs to
Author:
Uli Fechner
Version:
02/12/2003 - Uli Fechner - initial release

Definition at line 126 of file smilesCompound.c.

#define SmilesCompound_increaseCounter scPtr   )     ( (scPtr->counter)++)
 

The member counter of structure SmilesCompound is increased by one.

Parameters:
scPtr pointer on the structure SmilesCompound the member counter belongs to
Author:
Uli Fechner
Version:
02/12/2003 - Uli Fechner - initial release

Definition at line 115 of file smilesCompound.c.

#define SMILESCOMPOUND_VERSION   "1.4.0"
 

Definition at line 2 of file smilesCompound.c.

Referenced by displayVersionInformation().


Typedef Documentation

typedef SmilesCompound* SmilesCompound_Ptr
 

A pointer to structure SmilesCompound is assigned the name SmilesCompound_Ptr.

Definition at line 84 of file smilesCompound.c.

Referenced by main(), readDataFromStream(), SmilesCompound_copy(), SmilesCompound_create(), SmilesCompound_destroy(), SmilesCompound_display(), and SmilesCompound_identical().


Function Documentation

void SmilesCompound_addName const SmilesCompound_Ptr  scPtr,
const char *const  name
 

name is added to the list of names of structure SmilesCompound.

If name should be set as the only name of scPtr, function SmilesCompound_setName has to be used. If names are added with this function they are preceeded by a tab character to separate the individual names from each other in the output.

Attention:
The provided parameter name is copied. name is not freed afterwards. This has to be done by the caller of this function. name is not added to the list of names of scPtr if it is NULL.
Parameters:
scPtr pointer on the structure SmilesCompound the member name is added
name name of the compound
Author:
Uli Fechner
Version:
10/12/2003 - Uli Fechner - initial release

Definition at line 466 of file smilesCompound.c.

References MemoryError, SmilesCompound::sAPtr, StringArray_addElement(), and StringArray_create().

SmilesCompound_Ptr SmilesCompound_copy const SmilesCompound_Ptr  scPtr  ) 
 

Returns a deepcopy of the SmilesCompound scPtr.

Parameters:
scPtr pointer on the SmilesCompound that is copied
Return values:
SmilesCompound_Ptr a deepcopy of the SmilesCompound scPtr
Author:
Uli Fechner
Version:
17/12/2003 - Uli Fechner - initial release

Definition at line 369 of file smilesCompound.c.

References SmilesCompound::counter, MemoryError, SmilesCompound::moleculeHandle, SmilesCompound::sAPtr, SmilesCompound::smiles, SmilesCompound_Ptr, and StringArray_copy().

SmilesCompound_Ptr SmilesCompound_create char *const  name,
char *const  smiles,
const int  daylight_type,
\FILE *  errorLogFile
 

Creates a SmilesCompound structure.

The structure SmilesCompound is created. The memory of the structure itself and of its members is allocated automatically. The name and the SMILES, SMIRKS or SMARTS string have to be provided as arguments.
The function returns a SmilesCompound_Ptr on the newly created structure SmilesCompound or BOOLEAN_FALSE if the creation of the SmilesCompound fails somehow. Thus, the caller of this function should check for the return value BOOLEAN_FALSE, to guarantee the successful creation of the SmilesCompound.
Parameter daylight_type may have one of the following three values:

  • DAYLIGHT_SMILES to indicate that smiles is a SMILES
  • DAYLIGHT_SMIRKS to indicate that smiles is a SMIRKS
  • DAYLIGHT_SMARTS to indicate that smiles is a SMARTS
    Attention:
    The provided parameters name and smiles are copied. name and smiles are not freed afterwards. This has to be done by the caller of this function. A Daylight object of the SMILES, SMIRKS or SMARTS that is represented by the char* smiles is automatically created with the function dt_smilin, dt_smirkin and dt_smartin, respectively.
    Parameters:
    name the name (i.e. identifier) of the SMILES, SMIRKS or SMARTS
    smiles the SMILES, SMIRKS or SMARTS string of the compound
    daylight_type variable to indicate whether smiles contains SMILES, SMIRKS or SMARTS
    errorLogFile file pointer on the error log file
    Return values:
    SmilesCompound_Ptr pointer on the newly created structure SmilesCompound or BOOLEAN_FALSE if the creation fails somehow
    Author:
    Uli Fechner
    Version:
    28/11/2003 - Uli Fechner - initial release

    02/12/2003 - Uli Fechner - added support for member counter and moleculeHandle; added boolean parameter transform

    03/12/2003 - Uli Fechner - added parameter errorLogFile to write out errors revieved from dt_smilinerrors

    04/12/2003 - Uli Fechner - the counter is set to one during creation; the smiles is either the canonical SMILES generated with dt_cansmiles in case of a SMILES or the original input in case of a SMIRK

    08/12/2003 - Uli Fechner - if dt_cansmiles or dt_smirkin is not able to return a valid SMILES or transform object the function returns BOOLEAN_FALSE

    10/12/2003 - Uli Fechner - reflect the change of name storage (name is no longer stored in a char* but in a StringArray)

    29/01/2004 - Tina Grabowski - major change: added support for reading SMARTS

Definition at line 208 of file smilesCompound.c.

References BOOLEAN_FALSE, SmilesCompound::counter, DAYLIGHT_SMARTS, DAYLIGHT_SMILES, DAYLIGHT_SMIRKS, MemoryError, SmilesCompound::moleculeHandle, SmilesCompound::sAPtr, SmilesCompound::smiles, SmilesCompound_Ptr, StringArray_addElement(), StringArray_create(), and StringArray_destroy().

Referenced by readDataFromStream().

void SmilesCompound_destroy void *  scPtr  ) 
 

Destroys a SmilesCompound structure.

The structure SmilesCompound the pointer scPtr refers to is destroyed. The memory of the structure itself and of its members is freed automatically.

Parameters:
scPtr pointer on structure SmilesCompound that should be destroyed
Author:
Uli Fechner
Version:
28/11/2003 - Uli Fechner - initial release

02/12/2003 - Uli Fechner - added support for the member moleculeHandle

10/12/2003 - Uli Fechner - reflect the change of name storage (name is no longer stored in a char* but in a StringArray)

Definition at line 309 of file smilesCompound.c.

References AbortProgram, SmilesCompound::moleculeHandle, SmilesCompound::sAPtr, SmilesCompound::smiles, SmilesCompound_Ptr, and StringArray_destroy().

Referenced by readDataFromStream(), and SmilesCompound_setSmiles().

void SmilesCompound_display void *  scPtr,
FILE *  outputStream
 

Displays a structure SmilesCompound.

The structure SmilesCompound the pointer scPtr refers to is displayed on the FILE* outputStream.

Parameters:
scPtr pointer on the structure SmilesCompound that should be displayed
outputStream FILE* on the stream the output should be sent to
Author:
Uli Fechner
Version:
28/11/2003 - Uli Fechner - initial release

02/12/2003 - Uli Fechner - added support for member counter and moleculeHandle

04/12/2003 - Uli Fechner - member counter is now displayed regardless of the value; revoked support for moleculeHandle as from now on the canonical smiles is stored in smiles

10/12/2003 - Uli Fechner - removed output of dt_typename; changed order of output; reflect the change of name storage (name is no longer stored in a char* but in a StringArray)

Definition at line 347 of file smilesCompound.c.

References SmilesCompound::sAPtr, SmilesCompound_getCounter(), SmilesCompound_getSmiles(), SmilesCompound_Ptr, StringArray_display(), and StringArray_getNumberOfElements().

Referenced by readDataFromStream().

int SmilesCompound_getCounter const SmilesCompound_Ptr  scPtr  ) 
 

The member counter of structure SmilesCompound is returned.

Parameters:
scPtr pointer on the structure SmilesCompound the member counter belongs to
Return values:
int value of the member counter
Author:
Uli Fechner
Version:
02/12/2003 - Uli Fechner - initial release

Definition at line 652 of file smilesCompound.c.

References SmilesCompound::counter.

Referenced by main(), SmilesCompound_display(), SmilesCompound_identical(), and SmilesCompound_removeFromArrayOfNames().

dt_Handle SmilesCompound_getMoleculeHandle const SmilesCompound_Ptr  scPtr  ) 
 

The member moleculeHandle of structure SmilesCompound is returned.

Parameters:
scPtr pointer on the structure SmilesCompound the member moleculeHandle belongs to
Return values:
dt_Handle value of the member moleculeHandle
Author:
Uli Fechner
Version:
02/12/2003 - Uli Fechner - initial release

Definition at line 676 of file smilesCompound.c.

References SmilesCompound::moleculeHandle.

Referenced by main().

char * SmilesCompound_getSmiles const SmilesCompound_Ptr  scPtr  ) 
 

The member smiles of structure SmilesCompound is returned.

Parameters:
scPtr pointer on the structure SmilesCompound the member smiles belongs to
Return values:
char* SMILES string of the compound
Author:
Uli Fechner
Version:
28/11/2003 - Uli Fechner - initial release

Definition at line 628 of file smilesCompound.c.

References SmilesCompound::smiles.

Referenced by main(), and SmilesCompound_display().

StringArray_Ptr SmilesCompound_getStringArrayOfNames const SmilesCompound_Ptr  scPtr  ) 
 

The member sAPtr (contains the name(s)) of structure SmilesCompound is returned.

Parameters:
scPtr pointer on the structure SmilesCompound the member name belongs to
Return values:
StringArray_Ptr pointer on structure StringArray that contains the name(s) of the compound
Author:
Uli Fechner
Version:
28/11/2003 - Uli Fechner - initial release

10/12/2003 - Uli Fechner - reflect the change of name storage (name is no longer stored in a char* but in a StringArray)

17/12/2003 - Uli Fechner - changed the function name from SmilesCompound_getName to SmilesCompound_getStringArrayOfNames

Definition at line 494 of file smilesCompound.c.

References SmilesCompound::sAPtr, and StringArray_Ptr.

Referenced by main(), and SmilesCompound_removeFromArrayOfNames().

int SmilesCompound_identical const void *  scPtr1,
const void *  scPtr2
 

Checks if the two SmilesCompounds scPtr1 and scPtr2 have identical char* smiles.

If the two SmilesCompounds scPtr1 and scPtr2 have identical char* smiles, the counter of scPtr1 is increased by one and a copy of the StringArray of scPtr2 is concatenated to the StringArray sAPtr.

Parameters:
scPtr1 pointer on the first structure SmilesCompound
scPtr2 pointer on the second structure SmilesCompound
Return values:
int BOOLEAN_TRUE if the smiles of scPtr1 and scPtr2 are identical, BOOLEAN_FALSE otherwise
Author:
Uli Fechner
Version:
03/12/2003 - Uli Fechner - initial release

10/12/2003 - Uli Fechner - if the smiles of two compounds are identical, a copy of StringArray of scPtr2 is concatenated to the StringArray of scPtr1

19/12/2003 - Uli Fechner - major bugifx: the counter is now updated correctly

Definition at line 405 of file smilesCompound.c.

References BOOLEAN_FALSE, BOOLEAN_TRUE, SmilesCompound_getCounter(), SmilesCompound_Ptr, SmilesCompound_setCounter(), and StringArray_concatenate().

Referenced by readDataFromStream().

int SmilesCompound_removeFromArrayOfNames const SmilesCompound_Ptr  scPtr,
const char *  name
 

All names of scPtr that are identical to name are removed from the StringArray that contains the names.

Attention:
The counter of the respective SmilesCompound referred to by scPtr is automatically adjusted as follows: newValue = oldValue - occurrencesOfName.
Parameters:
scPtr pointer on the structure SmilesCompound that contains the array of names
name the name that is looked for in the StringArray of scPtr
Return values:
int the number of occurences of name in scPtr's array of names
Author:
Uli Fechner
Version:
19/12/2003 - Uli Fechner - initial release

Definition at line 511 of file smilesCompound.c.

References SmilesCompound_getCounter(), SmilesCompound_getStringArrayOfNames(), SmilesCompound_setCounter(), and StringArray_removeElement().

void SmilesCompound_setCounter const SmilesCompound_Ptr  scPtr,
const int  counter
 

The member counter of structure SmilesCompound is set.

Parameters:
scPtr pointer on the structure SmilesCompound the member counter is set
counter integer value that is assigned to the member counter
Author:
Uli Fechner
Version:
02/12/2003 - Uli Fechner - initial release

Definition at line 640 of file smilesCompound.c.

References SmilesCompound::counter.

Referenced by SmilesCompound_identical(), and SmilesCompound_removeFromArrayOfNames().

void SmilesCompound_setMoleculeHandle const SmilesCompound_Ptr  scPtr,
const dt_Handle  moleculeHandle
 

The member moleculeHandle of structure SmilesCompound is set.

Parameters:
scPtr pointer on the structure SmilesCompound the member moleculeHandle is set
moleculeHandle dt_Handle that is assigned to the member moleculeHandle
Author:
Uli Fechner
Version:
02/12/2003 - Uli Fechner - initial release

Definition at line 664 of file smilesCompound.c.

References SmilesCompound::moleculeHandle.

void SmilesCompound_setName const SmilesCompound_Ptr  scPtr,
const char *const  name
 

The name of structure SmilesCompound is set to name as the only name.

The member sAPtr is destroyed and newly created with name as the only name. Thus, all names that were stored previously are lost. If name should be added to the list of names, function SmilesCompound_addName has to be used.

Attention:
The provided parameter name is copied. name is not freed afterwards. This has to be done by the caller of this function. name is not set as the name of scPtr if it is NULL.
Parameters:
scPtr pointer on the structure SmilesCompound the member name is set
name name of the compound
Author:
Uli Fechner
Version:
28/11/2003 - Uli Fechner - initial release

10/12/2003 - Uli Fechner - complete rewrite to reflect the change of name storage (name is no longer stored in a char* but in a StringArray)

Definition at line 434 of file smilesCompound.c.

References MemoryError, SmilesCompound::sAPtr, StringArray_addElement(), StringArray_create(), and StringArray_destroy().

int SmilesCompound_setSmiles const SmilesCompound_Ptr  scPtr,
char *  smiles,
const int  daylight_type,
\FILE *  errorLogFile
 

The member smiles of structure SmilesCompound is set.

If the function is called the previous smiles and moleculeHandle are destroyed. A new Daylight object is created with dt_smilin, dt_smirkin or dt_smartin if a SMILES, SMIRKS or SMARTS is provided, respectively. In case of a SMILES the given smiles is converted to a canonical representation with dt_cansmiles. If dt_smilin or dt_cansmiles fails somehow, the complete SmilesCompound is destroyed and the function returns BOOLEAN_FALSE. If everything goes smoothly BOOLEAN_TRUE is returned.

Attention:
The provided parameter smiles is copied. smiles is not freed afterwards. This has to be done by the caller of this function.
Parameters:
scPtr pointer on the structure SmilesCompound the member smiles is set
smiles SMILES, SMIRKS or SMARTS string
daylight_type variable to indicate whether smiles contains SMILES, SMIRKS or SMARTS
errorLogFile file pointer on the error log file
Author:
Uli Fechner
Version:
28/11/2003 - Uli Fechner - initial release

17/12/2003 - Uli Fechner - re-written from scratch; now, provides consistency between smiles and moleculeHandle

29/01/2004 - Tina Grabowski - major change: added support for SMIRKS and SMARTS as SmilesCompound_create does

Definition at line 544 of file smilesCompound.c.

References BOOLEAN_FALSE, BOOLEAN_TRUE, DAYLIGHT_SMARTS, DAYLIGHT_SMILES, DAYLIGHT_SMIRKS, MemoryError, SmilesCompound::moleculeHandle, SmilesCompound::sAPtr, SmilesCompound::smiles, SmilesCompound_destroy(), and StringArray_destroy().


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