RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
CDXMLParser.h
Go to the documentation of this file.
1//
2// Copyright (c) 2022 Brian P Kelley
3// All rights reserved.
4//
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10#include <RDGeneral/export.h>
11#ifndef RD_CDXML_FILEPARSERS_H
12#define RD_CDXML_FILEPARSERS_H
13
14#include <RDGeneral/types.h>
15#include <string>
16#include <iostream>
17#include <vector>
18
19namespace RDKit {
20class RWMol;
21
22namespace v2 {
23namespace CDXMLParser {
25 bool sanitize = true;
26 bool removeHs = true;
27};
28//! \brief construct molecules from a CDXML file
29//! Note that the CDXML format is large and complex, the RDKit doesn't
30//! support
31//! full functionality, just the base ones required for molecule and
32//! reaction parsing.
33/*!
34 * \param inStream - string containing the mol block
35 * \param params - parameters controlling the parsing and post-processing
36 */
37RDKIT_FILEPARSERS_EXPORT std::vector<std::unique_ptr<RWMol>>
39 const CDXMLParserParams &params = CDXMLParserParams());
40//! \brief construct molecules from a CDXML file
41//! Note that the CDXML format is large and complex, the RDKit doesn't
42//! support
43//! full functionality, just the base ones required for molecule and
44//! reaction parsing.
45/*!
46 * \param fileName - cdxml fileName
47 * \param params - parameters controlling the parsing and post-processing
48 */
49RDKIT_FILEPARSERS_EXPORT std::vector<std::unique_ptr<RWMol>> MolsFromCDXMLFile(
50 const std::string &filename,
51 const CDXMLParserParams &params = CDXMLParserParams());
52
53//! \brief construct molecules from a CDXML file
54//! Note that the CDXML format is large and complex, the RDKit doesn't
55//! support
56//! full functionality, just the base ones required for molecule and
57//! reaction parsing.
58/*!
59 * \param cdxml - string containing the mol block
60 * \param params - parameters controlling the parsing and post-processing
61 */
62RDKIT_FILEPARSERS_EXPORT std::vector<std::unique_ptr<RWMol>> MolsFromCDXML(
63 const std::string &cdxml,
64 const CDXMLParserParams &params = CDXMLParserParams());
65} // namespace CDXMLParser
66} // namespace v2
67
68inline namespace v1 {
69
70//! \brief construct molecules from a CDXML file
71//! Note that the CDXML format is large and complex, the RDKit doesn't support
72//! full functionality, just the base ones required for molecule and
73//! reaction parsing.
74/*!
75 * \param inStream - string containing the mol block
76 * \param sanitize - toggles sanitization and stereochemistry
77 * perception of the molecule
78 * \param removeHs - toggles removal of Hs from the molecule. H removal
79 * is only done if the molecule is sanitized
80 * correctness of the contents.
81 */
82inline std::vector<std::unique_ptr<RWMol>> CDXMLDataStreamToMols(
83 std::istream &inStream, bool sanitize = true, bool removeHs = true) {
85 params.sanitize = sanitize;
86 params.removeHs = removeHs;
88}
89
90//! \brief construct molecules from a CDXML file
91//! Note that the CDXML format is large and complex, the RDKit doesn't support
92//! full functionality, just the base ones required for molecule and
93//! reaction parsing.
94/*!
95 * \param fileName - cdxml fileName
96 * \param sanitize - toggles sanitization and stereochemistry
97 * perception of the molecule
98 * \param removeHs - toggles removal of Hs from the molecule. H removal
99 * is only done if the molecule is sanitized
100 * correctness of the contents.
101 */
102inline std::vector<std::unique_ptr<RWMol>> CDXMLFileToMols(
103 const std::string &filename, bool sanitize = true, bool removeHs = true) {
105 params.sanitize = sanitize;
106 params.removeHs = removeHs;
108}
109
110//! \brief construct molecules from a CDXML file
111//! Note that the CDXML format is large and complex, the RDKit doesn't support
112//! full functionality, just the base ones required for molecule and
113//! reaction parsing.
114/*!
115 * \param cdxml - string containing the mol block
116 * \param sanitize - toggles sanitization and stereochemistry
117 * perception of the molecule
118 * \param removeHs - toggles removal of Hs from the molecule. H removal
119 * is only done if the molecule is sanitized
120 * correctness of the contents.
121 */
122inline std::vector<std::unique_ptr<RWMol>> CDXMLToMols(const std::string &cdxml,
123 bool sanitize = true,
124 bool removeHs = true) {
126 params.sanitize = sanitize;
127 params.removeHs = removeHs;
129}
130} // namespace v1
131} // namespace RDKit
132#endif // ␓ _RD_CDXML_FILEPARSERS_H
#define RDKIT_FILEPARSERS_EXPORT
Definition export.h:161
std::vector< std::unique_ptr< RWMol > > CDXMLToMols(const std::string &cdxml, bool sanitize=true, bool removeHs=true)
construct molecules from a CDXML file Note that the CDXML format is large and complex,...
std::vector< std::unique_ptr< RWMol > > CDXMLFileToMols(const std::string &filename, bool sanitize=true, bool removeHs=true)
construct molecules from a CDXML file Note that the CDXML format is large and complex,...
std::vector< std::unique_ptr< RWMol > > CDXMLDataStreamToMols(std::istream &inStream, bool sanitize=true, bool removeHs=true)
construct molecules from a CDXML file Note that the CDXML format is large and complex,...
Definition CDXMLParser.h:82
RDKIT_FILEPARSERS_EXPORT std::vector< std::unique_ptr< RWMol > > MolsFromCDXMLFile(const std::string &filename, const CDXMLParserParams &params=CDXMLParserParams())
construct molecules from a CDXML file Note that the CDXML format is large and complex,...
RDKIT_FILEPARSERS_EXPORT std::vector< std::unique_ptr< RWMol > > MolsFromCDXML(const std::string &cdxml, const CDXMLParserParams &params=CDXMLParserParams())
construct molecules from a CDXML file Note that the CDXML format is large and complex,...
RDKIT_FILEPARSERS_EXPORT std::vector< std::unique_ptr< RWMol > > MolsFromCDXMLDataStream(std::istream &inStream, const CDXMLParserParams &params=CDXMLParserParams())
construct molecules from a CDXML file Note that the CDXML format is large and complex,...
Std stuff.
bool rdvalue_is(const RDValue_cast_t)