RDKit: RDKit::FileParserUtils Namespace Reference

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
Functions | Variables
RDKit::FileParserUtils Namespace Reference

## Functions
RDKIT_FILEPARSERS_EXPORT std::string_view | strip (std::string_view orig, std::string stripChars=" \t\r\n")
template<typename T>
T | stripSpacesAndCast (std::string_view input, bool acceptSpaces=false)
template<typename T>
T | stripSpacesAndCast (const std::string &input, bool acceptSpaces=false)
RDKIT_FILEPARSERS_EXPORT int | toInt (const std::string &input, bool acceptSpaces=true)
RDKIT_FILEPARSERS_EXPORT unsigned int | toUnsigned (const std::string &input, bool acceptSpaces=true)
RDKIT_FILEPARSERS_EXPORT double | toDouble (const std::string &input, bool acceptSpaces=true)
RDKIT_FILEPARSERS_EXPORT int | toInt (const std::string_view input, bool acceptSpaces=true)
RDKIT_FILEPARSERS_EXPORT unsigned int | toUnsigned (std::string_view input, bool acceptSpaces=true)
RDKIT_FILEPARSERS_EXPORT double | toDouble (const std::string_view input, bool acceptSpaces=true)
RDKIT_FILEPARSERS_EXPORT std::string | getV3000CTAB (const ROMol &tmol, const boost::dynamic_bitset<> &wasAromatic, int confId=-1, unsigned int precision=6)
std::string | getV3000CTAB (const ROMol &tmol, int confId=-1, unsigned int precision=6)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
RDKIT_FILEPARSERS_EXPORT std::string | getV3000Line (std::istream *inStream, unsigned int &line)
RDKIT_FILEPARSERS_EXPORT bool | ParseV3000CTAB (std::istream *inStream, unsigned int &line, RWMol *mol, Conformer *&conf, bool &chiralityPossible, unsigned int &nAtoms, unsigned int &nBonds, bool strictParsing=true, bool expectMEND=true, bool expectMacroAtoms=false)
RDKIT_FILEPARSERS_EXPORT bool | ParseV2000CTAB (std::istream *inStream, unsigned int &line, RWMol *mol, Conformer *&conf, bool &chiralityPossible, unsigned int &nAtoms, unsigned int &nBonds, bool strictParsing=true)
RDKIT_FILEPARSERS_EXPORT void | finishMolProcessing (RWMol *res, bool chiralityPossible, const v2::FileParsers::MolFileParserParams &ps)
void | finishMolProcessing (RWMol *res, bool chiralityPossible, bool sanitize, bool removeHs)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
RDKIT_FILEPARSERS_EXPORT Atom * | replaceAtomWithQueryAtom (RWMol *mol, Atom *atom)
| Deprecated, please use QueryOps::replaceAtomWithQueryAtom instead.
template<typename T, typename U>
void | applyMolListProp (ROMol &mol, const std::string &pn, const std::string &prefix, const std::string &missingValueMarker, size_t nItems, U getter)
| applies a particular property to the atoms as an atom property list
template<typename T>
void | applyMolListPropToAtoms (ROMol &mol, const std::string &pn, const std::string &prefix, const std::string &missingValueMarker="n/a")
| applies a particular property to the atoms as an atom property list
template<typename T, typename U>
void | applyMolListProps (ROMol &mol, const std::string &prefix, size_t nItems, U getter, const std::string missingValueMarker="n/a")
template<typename T>
void | applyMolListPropsToAtoms (ROMol &mol, const std::string &prefix, const std::string missingValueMarker="n/a")
void | processMolPropertyList (ROMol &mol, const std::string &pn, const std::string &missingValueMarker="n/a")
void | processMolPropertyLists (ROMol &mol, const std::string &missingValueMarker="n/a")
template<typename T, typename U>
std::string | getPropertyList (U getter, const std::string &propName, std::string missingValueMarker="", unsigned int lineSize=DEFAULT_LINESIZE)
template<typename T>
std::string | getAtomPropertyList (ROMol &mol, const std::string &atomPropName, std::string missingValueMarker="", unsigned int lineSize=DEFAULT_LINESIZE)
template<typename T, typename U>
void | createPropertyList (ROMol &mol, U getter, const std::string &prefix, const std::string &typeMarker, const std::string &propName, const std::string &missingValueMarker="", unsigned int lineSize=DEFAULT_LINESIZE)
void | createAtomIntPropertyList (ROMol &mol, const std::string &atomPropName, const std::string &missingValueMarker="", unsigned int lineSize=DEFAULT_LINESIZE)
void | createAtomDoublePropertyList (ROMol &mol, const std::string &atomPropName, const std::string &missingValueMarker="", unsigned int lineSize=DEFAULT_LINESIZE)
void | createAtomBoolPropertyList (ROMol &mol, const std::string &atomPropName, const std::string &missingValueMarker="", unsigned int lineSize=DEFAULT_LINESIZE)
void | createAtomStringPropertyList (ROMol &mol, const std::string &atomPropName, const std::string &missingValueMarker="", unsigned int lineSize=DEFAULT_LINESIZE)
void | createBondIntPropertyList (ROMol &mol, const std::string &bondPropName, const std::string &missingValueMarker="", unsigned int lineSize=DEFAULT_LINESIZE)
void | createBondDoublePropertyList (ROMol &mol, const std::string &bondPropName, const std::string &missingValueMarker="", unsigned int lineSize=DEFAULT_LINESIZE)
void | createBondBoolPropertyList (ROMol &mol, const std::string &bondPropName, const std::string &missingValueMarker="", unsigned int lineSize=DEFAULT_LINESIZE)
void | createBondStringPropertyList (ROMol &mol, const std::string &bondPropName, const std::string &missingValueMarker="", unsigned int lineSize=DEFAULT_LINESIZE)
RDKIT_FILEPARSERS_EXPORT void | moveAdditionalPropertiesToSGroups (RWMol &mol)

## Variables
static constexpr std::string_view | atomPropPrefixView = "atom."
static constexpr size_t | atomPropPrefixLength = atomPropPrefixView.length()
static const std::string | atomPropPrefix = std::string(atomPropPrefixView)
static constexpr std::string_view | bondPropPrefixView = "bond."
static constexpr size_t | bondPropPrefixLength = bondPropPrefixView.length()
static const std::string | bondPropPrefix = std::string(bondPropPrefixView)
static constexpr unsigned int | DEFAULT_LINESIZE = 190

## Function Documentation

## ◆ applyMolListProp()

template<typename T, typename U>

void RDKit::FileParserUtils::applyMolListProp | ( | ROMol & | mol,
|  | const std::string & | pn,
|  | const std::string & | prefix,
|  | const std::string & | missingValueMarker,
|  | size_t | nItems,
|  | U | getter )

applies a particular property to the atoms as an atom property list

Definition at line 114 of file FileParserUtils.h.

References BOOST_LOG, RDKit::RDProps::getProp(), and rdWarningLog.

Referenced by applyMolListProps(), applyMolListPropsToAtoms(), applyMolListPropToAtoms(), and processMolPropertyList().

## ◆ applyMolListProps()

template<typename T, typename U>

void RDKit::FileParserUtils::applyMolListProps | ( | ROMol & | mol,
|  | const std::string & | prefix,
|  | size_t | nItems,
|  | U | getter,
|  | const std::string | missingValueMarker = "n/a" )

Definition at line 167 of file FileParserUtils.h.

References applyMolListProp(), and RDKit::RDProps::getPropList().

## ◆ applyMolListPropsToAtoms()

template<typename T>

void RDKit::FileParserUtils::applyMolListPropsToAtoms | ( | ROMol & | mol,
|  | const std::string & | prefix,
|  | const std::string | missingValueMarker = "n/a" )

applies all properties matching a particular prefix as an atom property list

Definition at line 180 of file FileParserUtils.h.

References applyMolListProp(), RDKit::ROMol::getAtomWithIdx(), RDKit::ROMol::getNumAtoms(), and RDKit::RDProps::getPropList().

## ◆ applyMolListPropToAtoms()

template<typename T>

void RDKit::FileParserUtils::applyMolListPropToAtoms | ( | ROMol & | mol,
|  | const std::string & | pn,
|  | const std::string & | prefix,
|  | const std::string & | missingValueMarker = "n/a" )

applies a particular property to the atoms as an atom property list

Definition at line 158 of file FileParserUtils.h.

References applyMolListProp(), RDKit::ROMol::getAtomWithIdx(), and RDKit::ROMol::getNumAtoms().

## ◆ createAtomBoolPropertyList()

void RDKit::FileParserUtils::createAtomBoolPropertyList | ( | ROMol & | mol,
|  | const std::string & | atomPropName,
|  | const std::string & | missingValueMarker = "",
|  | unsigned int | lineSize = DEFAULT_LINESIZE )
| inline

Definition at line 323 of file FileParserUtils.h.

References RDKit::ROMol::atoms(), createPropertyList(), and DEFAULT_LINESIZE.

## ◆ createAtomDoublePropertyList()

void RDKit::FileParserUtils::createAtomDoublePropertyList | ( | ROMol & | mol,
|  | const std::string & | atomPropName,
|  | const std::string & | missingValueMarker = "",
|  | unsigned int | lineSize = DEFAULT_LINESIZE )
| inline

Definition at line 315 of file FileParserUtils.h.

References RDKit::ROMol::atoms(), createPropertyList(), and DEFAULT_LINESIZE.

## ◆ createAtomIntPropertyList()

void RDKit::FileParserUtils::createAtomIntPropertyList | ( | ROMol & | mol,
|  | const std::string & | atomPropName,
|  | const std::string & | missingValueMarker = "",
|  | unsigned int | lineSize = DEFAULT_LINESIZE )
| inline

Definition at line 307 of file FileParserUtils.h.

References RDKit::ROMol::atoms(), createPropertyList(), and DEFAULT_LINESIZE.

## ◆ createAtomStringPropertyList()

void RDKit::FileParserUtils::createAtomStringPropertyList | ( | ROMol & | mol,
|  | const std::string & | atomPropName,
|  | const std::string & | missingValueMarker = "",
|  | unsigned int | lineSize = DEFAULT_LINESIZE )
| inline

Definition at line 331 of file FileParserUtils.h.

References RDKit::ROMol::atoms(), createPropertyList(), and DEFAULT_LINESIZE.

## ◆ createBondBoolPropertyList()

void RDKit::FileParserUtils::createBondBoolPropertyList | ( | ROMol & | mol,
|  | const std::string & | bondPropName,
|  | const std::string & | missingValueMarker = "",
|  | unsigned int | lineSize = DEFAULT_LINESIZE )
| inline

Definition at line 356 of file FileParserUtils.h.

References RDKit::ROMol::bonds(), createPropertyList(), and DEFAULT_LINESIZE.

## ◆ createBondDoublePropertyList()

void RDKit::FileParserUtils::createBondDoublePropertyList | ( | ROMol & | mol,
|  | const std::string & | bondPropName,
|  | const std::string & | missingValueMarker = "",
|  | unsigned int | lineSize = DEFAULT_LINESIZE )
| inline

Definition at line 348 of file FileParserUtils.h.

References RDKit::ROMol::bonds(), createPropertyList(), and DEFAULT_LINESIZE.

## ◆ createBondIntPropertyList()

void RDKit::FileParserUtils::createBondIntPropertyList | ( | ROMol & | mol,
|  | const std::string & | bondPropName,
|  | const std::string & | missingValueMarker = "",
|  | unsigned int | lineSize = DEFAULT_LINESIZE )
| inline

Definition at line 340 of file FileParserUtils.h.

References RDKit::ROMol::bonds(), createPropertyList(), and DEFAULT_LINESIZE.

## ◆ createBondStringPropertyList()

void RDKit::FileParserUtils::createBondStringPropertyList | ( | ROMol & | mol,
|  | const std::string & | bondPropName,
|  | const std::string & | missingValueMarker = "",
|  | unsigned int | lineSize = DEFAULT_LINESIZE )
| inline

Definition at line 364 of file FileParserUtils.h.

References RDKit::ROMol::bonds(), createPropertyList(), and DEFAULT_LINESIZE.

## ◆ createPropertyList()

template<typename T, typename U>

void RDKit::FileParserUtils::createPropertyList | ( | ROMol & | mol,
|  | U | getter,
|  | const std::string & | prefix,
|  | const std::string & | typeMarker,
|  | const std::string & | propName,
|  | const std::string & | missingValueMarker = "",
|  | unsigned int | lineSize = DEFAULT_LINESIZE )

Definition at line 297 of file FileParserUtils.h.

References DEFAULT_LINESIZE, getPropertyList(), and RDKit::RDProps::setProp().

Referenced by createAtomBoolPropertyList(), createAtomDoublePropertyList(), createAtomIntPropertyList(), createAtomStringPropertyList(), createBondBoolPropertyList(), createBondDoublePropertyList(), createBondIntPropertyList(), and createBondStringPropertyList().

## ◆ finishMolProcessing() [1/2]

void RDKit::FileParserUtils::finishMolProcessing | ( | RWMol * | res,
|  | bool | chiralityPossible,
|  | bool | sanitize,
|  | bool | removeHs )
| inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 101 of file FileParserUtils.h.

References finishMolProcessing(), RDKit::v2::FileParsers::MolFileParserParams::removeHs, and RDKit::v2::FileParsers::MolFileParserParams::sanitize.

## ◆ finishMolProcessing() [2/2]

RDKIT_FILEPARSERS_EXPORT void RDKit::FileParserUtils::finishMolProcessing | ( | RWMol * | res,
|  | bool | chiralityPossible,
|  | const v2::FileParsers::MolFileParserParams & | ps )

finishes up the processing (sanitization, etc.) of a molecule read from CTAB

References RDKIT_FILEPARSERS_EXPORT.

Referenced by finishMolProcessing().

## ◆ getAtomPropertyList()

template<typename T>

std::string RDKit::FileParserUtils::getAtomPropertyList | ( | ROMol & | mol,
|  | const std::string & | atomPropName,
|  | std::string | missingValueMarker = "",
|  | unsigned int | lineSize = DEFAULT_LINESIZE )

Definition at line 289 of file FileParserUtils.h.

References RDKit::ROMol::atoms(), DEFAULT_LINESIZE, and getPropertyList().

## ◆ getPropertyList()

template<typename T, typename U>

std::string RDKit::FileParserUtils::getPropertyList | ( | U | getter,
|  | const std::string & | propName,
|  | std::string | missingValueMarker = "",
|  | unsigned int | lineSize = DEFAULT_LINESIZE )

Definition at line 255 of file FileParserUtils.h.

References DEFAULT_LINESIZE.

Referenced by createPropertyList(), and getAtomPropertyList().

## ◆ getV3000CTAB() [1/2]

RDKIT_FILEPARSERS_EXPORT std::string RDKit::FileParserUtils::getV3000CTAB | ( | const ROMol & | tmol,
|  | const boost::dynamic_bitset<> & | wasAromatic,
|  | int | confId = -1,
|  | unsigned int | precision = 6 )

References RDKIT_FILEPARSERS_EXPORT.

Referenced by getV3000CTAB().

## ◆ getV3000CTAB() [2/2]

std::string RDKit::FileParserUtils::getV3000CTAB | ( | const ROMol & | tmol,
|  | int | confId = -1,
|  | unsigned int | precision = 6 )
| inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 73 of file FileParserUtils.h.

References RDKit::ROMol::getNumBonds(), and getV3000CTAB().

## ◆ getV3000Line()

RDKIT_FILEPARSERS_EXPORT std::string RDKit::FileParserUtils::getV3000Line | ( | std::istream * | inStream,
|  | unsigned int & | line )

References RDKIT_FILEPARSERS_EXPORT.

## ◆ moveAdditionalPropertiesToSGroups()

RDKIT_FILEPARSERS_EXPORT void RDKit::FileParserUtils::moveAdditionalPropertiesToSGroups | ( | RWMol & | mol | ) |

References RDKIT_FILEPARSERS_EXPORT.

## ◆ ParseV2000CTAB()

RDKIT_FILEPARSERS_EXPORT bool RDKit::FileParserUtils::ParseV2000CTAB | ( | std::istream * | inStream,
|  | unsigned int & | line,
|  | RWMol * | mol,
|  | Conformer *& | conf,
|  | bool & | chiralityPossible,
|  | unsigned int & | nAtoms,
|  | unsigned int & | nBonds,
|  | bool | strictParsing = true )

References RDKIT_FILEPARSERS_EXPORT.

## ◆ ParseV3000CTAB()

RDKIT_FILEPARSERS_EXPORT bool RDKit::FileParserUtils::ParseV3000CTAB | ( | std::istream * | inStream,
|  | unsigned int & | line,
|  | RWMol * | mol,
|  | Conformer *& | conf,
|  | bool & | chiralityPossible,
|  | unsigned int & | nAtoms,
|  | unsigned int & | nBonds,
|  | bool | strictParsing = true,
|  | bool | expectMEND = true,
|  | bool | expectMacroAtoms = false )

References RDKIT_FILEPARSERS_EXPORT.

## ◆ processMolPropertyList()

void RDKit::FileParserUtils::processMolPropertyList | ( | ROMol & | mol,
|  | const std::string & | pn,
|  | const std::string & | missingValueMarker = "n/a" )
| inline

if the property name matches our rules for atom property lists, we'll apply it to the atoms

Definition at line 200 of file FileParserUtils.h.

References applyMolListProp(), atomPropPrefix, atomPropPrefixLength, bondPropPrefix, bondPropPrefixLength, RDKit::ROMol::getAtomWithIdx(), RDKit::ROMol::getBondWithIdx(), RDKit::ROMol::getNumAtoms(), and RDKit::ROMol::getNumBonds().

Referenced by processMolPropertyLists().

## ◆ processMolPropertyLists()

void RDKit::FileParserUtils::processMolPropertyLists | ( | ROMol & | mol,
|  | const std::string & | missingValueMarker = "n/a" )
| inline

loops over all properties and applies the ones that match the rules for atom property lists to the atoms and bonds

Definition at line 245 of file FileParserUtils.h.

References RDKit::RDProps::getPropList(), and processMolPropertyList().

## ◆ replaceAtomWithQueryAtom()

RDKIT_FILEPARSERS_EXPORT Atom * RDKit::FileParserUtils::replaceAtomWithQueryAtom | ( | RWMol * | mol,
|  | Atom * | atom )

Deprecated, please use QueryOps::replaceAtomWithQueryAtom instead.

References RDKIT_FILEPARSERS_EXPORT.

## ◆ strip()

RDKIT_FILEPARSERS_EXPORT std::string_view RDKit::FileParserUtils::strip | ( | std::string_view | orig,
|  | std::string | stripChars = " \t\r\n" )
| inline

Definition at line 29 of file FileParserUtils.h.

References RDKIT_FILEPARSERS_EXPORT.

Referenced by stripSpacesAndCast().

## ◆ stripSpacesAndCast() [1/2]

template<typename T>

T RDKit::FileParserUtils::stripSpacesAndCast | ( | const std::string & | input,
|  | bool | acceptSpaces = false )

Definition at line 52 of file FileParserUtils.h.

References stripSpacesAndCast().

## ◆ stripSpacesAndCast() [2/2]

template<typename T>

T RDKit::FileParserUtils::stripSpacesAndCast | ( | std::string_view | input,
|  | bool | acceptSpaces = false )

Definition at line 43 of file FileParserUtils.h.

References strip().

Referenced by stripSpacesAndCast().

## ◆ toDouble() [1/2]

RDKIT_FILEPARSERS_EXPORT double RDKit::FileParserUtils::toDouble | ( | const std::string & | input,
|  | bool | acceptSpaces = true )

References RDKIT_FILEPARSERS_EXPORT.

## ◆ toDouble() [2/2]

RDKIT_FILEPARSERS_EXPORT double RDKit::FileParserUtils::toDouble | ( | const std::string_view | input,
|  | bool | acceptSpaces = true )

References RDKIT_FILEPARSERS_EXPORT.

## ◆ toInt() [1/2]

RDKIT_FILEPARSERS_EXPORT int RDKit::FileParserUtils::toInt | ( | const std::string & | input,
|  | bool | acceptSpaces = true )

References RDKIT_FILEPARSERS_EXPORT.

## ◆ toInt() [2/2]

RDKIT_FILEPARSERS_EXPORT int RDKit::FileParserUtils::toInt | ( | const std::string_view | input,
|  | bool | acceptSpaces = true )

References RDKIT_FILEPARSERS_EXPORT.

## ◆ toUnsigned() [1/2]

RDKIT_FILEPARSERS_EXPORT unsigned int RDKit::FileParserUtils::toUnsigned | ( | const std::string & | input,
|  | bool | acceptSpaces = true )

References RDKIT_FILEPARSERS_EXPORT.

## ◆ toUnsigned() [2/2]

RDKIT_FILEPARSERS_EXPORT unsigned int RDKit::FileParserUtils::toUnsigned | ( | std::string_view | input,
|  | bool | acceptSpaces = true )

References RDKIT_FILEPARSERS_EXPORT.

## Variable Documentation

## ◆ atomPropPrefix

const std::string RDKit::FileParserUtils::atomPropPrefix = std::string(atomPropPrefixView)
| static

Definition at line 193 of file FileParserUtils.h.

Referenced by processMolPropertyList().

## ◆ atomPropPrefixLength

size_t RDKit::FileParserUtils::atomPropPrefixLength = atomPropPrefixView.length()
| staticconstexpr

Definition at line 192 of file FileParserUtils.h.

Referenced by processMolPropertyList().

## ◆ atomPropPrefixView

std::string_view RDKit::FileParserUtils::atomPropPrefixView = "atom."
| staticconstexpr

Definition at line 191 of file FileParserUtils.h.

## ◆ bondPropPrefix

const std::string RDKit::FileParserUtils::bondPropPrefix = std::string(bondPropPrefixView)
| static

Definition at line 196 of file FileParserUtils.h.

Referenced by processMolPropertyList().

## ◆ bondPropPrefixLength

size_t RDKit::FileParserUtils::bondPropPrefixLength = bondPropPrefixView.length()
| staticconstexpr

Definition at line 195 of file FileParserUtils.h.

Referenced by processMolPropertyList().

## ◆ bondPropPrefixView

std::string_view RDKit::FileParserUtils::bondPropPrefixView = "bond."
| staticconstexpr

Definition at line 194 of file FileParserUtils.h.

## ◆ DEFAULT_LINESIZE

unsigned int RDKit::FileParserUtils::DEFAULT_LINESIZE = 190
| staticconstexpr

Definition at line 252 of file FileParserUtils.h.

Referenced by createAtomBoolPropertyList(), createAtomDoublePropertyList(), createAtomIntPropertyList(), createAtomStringPropertyList(), createBondBoolPropertyList(), createBondDoublePropertyList(), createBondIntPropertyList(), createBondStringPropertyList(), createPropertyList(), getAtomPropertyList(), and getPropertyList().