OEIUPAC Functions

OECapitalizeName

std::string OECapitalizeName(const char *ptr)

Capitalize the appropriate first letter of a name generated by OECreateIUPACName. This function should be called after translating the name to a foreign langauge, but before converting the character set encoding.

OECreateIUPACName

std::string OECreateIUPACName(const OEChem::OEMolBase &mol,
                              const unsigned char *style=OENamStyleOpenEye)

This function attempts to generate a ‘reasonable’ IUPAC name for the given molecule, mol, and return the result in a C++ STL string. These ‘reasonable’ names attempts to be one of the recommended IUPAC names for a compound, however occassionally this function may fall back to using IUPAC ‘systematic’ naming for parts of a molecule. Any parts of a molecule that cannot be named, result in the substring BLAH appearing in the returned string.

The optional style argument can be used to control and customize the style of the names generated by this function. The nine currently predefined name styles are OEIUPAC::OENamStyleOpenEye (the default), OEIUPAC::OENamStyleIUPAC, OEIUPAC::OENamStyleIUPAC79, OEIUPAC::OENamStyleIUPAC93, OEIUPAC::OENamStyleTraditional, OEIUPAC::OENamStyleAutoNom, OEIUPAC::OENamStyleCAS, OEIUPAC::OENamStyleCASIndex and OEIUPAC::OENamStyleSystematic.

After the name has been generated it may be translated into one of several languages, for example using the OEToGerman or OEToJapanese functions, then optionally capitalized using OECapitalizeName, and finally converted into a final character encoding, for example using OEToUTF8 or OEToHTML.

OEFromChinese

std::string OEFromChinese(const char *ptr)

Convert the chemical name specified by ‘ptr’ from simplified or traditional Chinese to English.

OEFromDanish

std::string OEFromDanish(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Danish to English.

OEFromDutch

std::string OEFromDutch(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Dutch to English.

OEFromFrench

std::string OEFromFrench(const char *ptr)

Convert the chemical name specified by ‘ptr’ from French to English.

OEFromGerman

std::string OEFromGerman(const char *ptr)

Convert the chemical name specified by ‘ptr’ from German to English.

OEFromGreek

std::string OEFromGreek(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Greek to English.

OEFromHungarian

std::string OEFromHungarian(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Hungarian to English.

OEFromIrish

std::string OEFromIrish(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Irish to English.

OEFromItalian

std::string OEFromItalian(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Italian to English.

OEFromJapanese

std::string OEFromJapanese(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Japanese to English.

OEFromKOI8R

std::string OEFromKOI8R(const char *ptr)

Convert the string ‘ptr’ from the Russian KOI-8 character encoding to Lexichem‘s default encoding using \u escapes to represent non-ASCII unicode characters.

OEFromLanguage

std::string OEFromLanguage(const char *ptr, unsigned int lang)

This is a helper wrapper function that can be used to convert the chemical name specified by ‘ptr’ from the language specified by ‘lang’ to English. The languages are specified by the constants with the OE_LANG_ prefix described in the OEIUPAC namespace.

OEFromPolish

std::string OEFromPolish(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Polish to English.

OEFromRomanian

std::string OEFromRomanian(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Romanian to English.

OEFromRussian

std::string OEFromRussian(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Russian to English.

OEFromSlovak

std::string OEFromSlovak(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Slovak to English.

OEFromSpanish

std::string OEFromSpanish(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Spanish to English.

OEFromSwedish

std::string OEFromSwedish(const char *ptr)

Convert the chemical name specified by ‘ptr’ from Swedish to English.

OEFromUTF8

std::string OEFromUTF8(const char *ptr)

Convert the string ‘ptr’ from the UTF-8 character encoding to Lexichem‘s default encoding using ‘u’ escapes to represent non-ASCII unicode characters.

OEFromWelsh

std::string OEFromWelsh(const char *ptr)

Convert the chemical name specified by ‘ptr’ from simplified or traditional Welsh to English.

OEGetCIPStereo

char OEGetCIPStereo(const OEChem::OEMolBase &mol,
                    const OEChem::OEAtomBase *atm)
char OEGetCIPStereo(const OEChem::OEMolBase &mol,
                    const OEChem::OEBondBase *bnd)

These functions return the Cahn-Ingold-Prelog descriptor for the given atom or bond stereo center, from the stereochemistry set on the OEMolBase. For chiral atom centers, the OEAtomBase form of this function returns either ‘R’ or ‘S’ for specified CIP stereo centers, ‘N’ for CIP stereo centers that don’t have stereo specified (i.e. OEAtomBase::HasStereoSpecified returns false), and ‘X’ for atoms that are not CIP stereo centers. For double bonds, the OEBondBase form of this function returns either ‘E’ or ‘Z’ specified CIP stereo centers, ‘N’ for CIP stereo centers that don’t have stereo specified (i.e. OEBondBase::HasStereoSpecified returns false), and ‘X’ for bonds that are not CIP stereo centers.

OEIUPACGetArch

const char *OEIUPACGetArch()

OEIUPACGetLicensee

bool OEIUPACGetLicensee(std::string &licensee)

OEIUPACGetPlatform

const char *OEIUPACGetPlatform()

OEIUPACGetRelease

const char *OEIUPACGetRelease()

OEIUPACGetSite

bool OEIUPACGetSite(std::string &site)

OEIUPACGetVersion

unsigned int OEIUPACGetVersion()

OEIUPACIsLicensed

bool OEIUPACIsLicensed(const char *feature=0, unsigned int *expdate=0)

Determine whether a valid license file is present. This function may be called without a legitimate run-time license to determine whether it is safe to call any of OEIUPAC’s functionality.

The ‘features’ argument can be used to check for a valid license to OEIUPAC along with that feature. For example, to verify that OEIUPAC can be used from Python:

if (!OEIUPACIsLicensed("python"))
   OEThrow.Warning("OEIUPAC is not licensed for the python feature");

The second argument can be used to get the expiration date of the license. This is an array of size three with the date returned as {day, month, year}. Even if the function returns false due to an expired license, the expdate will show that expiration date. A value of a zeroes implies that no license or date was found.

unsigned int expdate[3];
if (OEIUPACIsLicensed(0, expdate))
{
   OEThrow.Info("License expires: day: %d  month: %d year: %d",
                 expdate[0], expdate[1], expdate[2]);
}

OELowerCaseName

std::string OELowerCaseName(const char *ptr)

Convert the specified compound name to lower-case. This function understands chemical nomenclature and foreign alphabets. This function should be called prior to translating a name from a foreign language, as the language translation routines assume that the name is lower-case.

OENameLocant

std::string OENameLocant(unsigned int loc, bool iupac=false)

Generate the lexical form of a LexiChem locant index. The molecule’s created by the function OEParseIUPACName are annotated with locant infomation in each atom’s integer atom type field. These locant indices may be retrieved using OEChem’s OEAtomBase::GetIntType method.

OEParseIUPACName

bool OEParseIUPACName(OEChem::OEMolBase &mol, const char *name)

This function parses the compound name (not necessarily a systematic or preferred IUPAC name) from the NUL-terminated string given by name, and places the processed molecule in mol. This function returns true if the name could be parsed without problems. When returning false, the contents of mol contain as much of the name as could be processed.

OEReorderIndexName

std::string OEReorderIndexName(const char *ptr)

Attempt to reorder the specified permuted index name. The permute strings such as “benzene, chloro-” into the form “chloro-benzene” which can then be processed by Lexichem‘s OEParseIUPACName function.

This function returns an empty string (or the original input string) if it’s argument is not recognized as a permuted index name.

OESetCIPStereo

bool OESetCIPStereo(OEChem::OEMolBase &mol, OEChem::OEAtomBase *atm, char s)
bool OESetCIPStereo(OEChem::OEMolBase &mol, OEChem::OEBondBase *bnd, char s)

These functions set the internal OEChem stereochemistry from the given CIP stereo descriptor. For the OEAtomBase form, the descriptor s must be either ‘R’ or ‘S’, and for the OEBondBase form, the descriptor s must be either ‘E’ or ‘Z’. This function returns true if the stereochemistry was successfully set, and false otherwise: i.e. the descriptor was invalid or the specified atom or bond was not a CIP stereo center.

OEToASCII

std::string OEToASCII(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName post-processed by a language translation function, from the default ISO-8859-1 encoding, which includes 8-bit European characters, into a reduced 7-bit ASCII representation by stripping the accents off of the 8-bit characters.

OEToBritish

std::string OEToBritish(const char *ptr, bool sulph)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from the default American output, to either British spelling (when ‘sulph’ is true) or IUPAC international spelling (when ‘sulph’ is false).

OEToChinese

std::string OEToChinese(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Simplified Chinese.

OEToDanish

std::string OEToDanish(const char *ptr)

OEToDutch

std::string OEToDutch(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Dutch.

OEToEUCJP

std::string OEToEUCJP(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName post-processed by a call to OEToJapanese, from the default encoding which uses ‘u’ escapes to represent unicode characters to instead use the EUC-JP character encoding for japanese characters.

OEToFrench

std::string OEToFrench(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to French.

OEToGerman

std::string OEToGerman(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to German.

OEToGreek

std::string OEToGreek(const char *ptr)

OEToHTML

std::string OEToHTML(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName possibly post-processed by a language translation function, from the default encoding to use HTML mark-up to represent accented characters, unicode characters and superscripts.

OEToHungarian

std::string OEToHungarian(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Hungarian.

OEToIrish

std::string OEToIrish(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Irish.

OEToItalian

std::string OEToItalian(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Italian.

OEToJapanese

std::string OEToJapanese(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Japanese.

OEToLanguage

std::string OEToLanguage(const char *ptr, unsigned int lang)

This is a helper wrapper function that can be used to convert the chemical name specified by ‘ptr’ from English to the language specified by ‘lang’. The languages are specified by the constants with the OE_LANG_ prefix described in the OEIUPAC namespace.

OEToPolish

std::string OEToPolish(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Polish.

OEToRomanian

std::string OEToRomanian(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Romanian.

OEToRussian

std::string OEToRussian(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Russian.

OEToSJIS

std::string OEToSJIS(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName post-processed by a call to OEToJapanese, from the default encoding which uses ‘u’ escapes to represent unicode characters to instead use the Shift-JIS character encoding for japanese characters.

OEToSlovak

std::string OEToSlovak(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Slovak.

OEToSpanish

std::string OEToSpanish(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Spanish.

OEToSwedish

std::string OEToSwedish(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Swedish.

OEToUTF8

std::string OEToUTF8(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName post-processed by a language translation function, from the default ISO-8859-1 encoding which uses ‘u’ escapes to represent unicode characters to instead use the UTF-8 character encoding for accented and other characters.

OEToWelsh

std::string OEToWelsh(const char *ptr)

Convert the string ‘ptr’, typically the output of the function OECreateIUPACName, from English to Welsh.