RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
MolInterchange.h
Go to the documentation of this file.
1//
2// Copyright (C) 2018-2022 Greg Landrum
3//
4// @@ All Rights Reserved @@
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_MOLINTERCHANGE_H_JAN2018
12#define RD_MOLINTERCHANGE_H_JAN2018
13
14/*! \file MolInterchange.h
15
16\brief Contains the public API for the convertors to/from the commonchem
17interchange format
18
19\b Note that this should be considered beta and that the format and API
20will very likely change in future releases.
21
22More information about CommonChem is available here:
23https://github.com/mcs07/CommonChem
24*/
25
26#include <string>
27#include <iostream>
28#include <vector>
29
30#include <boost/shared_ptr.hpp>
31
32namespace RDKit {
33
34class RWMol;
35
36namespace MolInterchange {
37
38// \brief parameters controlling parsing of MolJSON
40 bool setAromaticBonds =
41 true; /*!< toggles setting the BondType of aromatic bonds to Aromatic */
42 bool strictValenceCheck =
43 false; /*!< toggles doing reasonable valence checks */
44 bool parseProperties =
45 true; /*!< toggles extracting molecular properties from the JSON block */
46 bool parseConformers =
47 true; /*!< toggles extracting conformers from the JSON block */
48 bool useHCounts =
49 true; /*!< toggles using the implicit H counts for atoms from the JSON
50 block. You may want to set this to false when parsing queries. */
51};
53
54// \brief construct molecules from MolJSON data in a stream
55/*!
56 * \param inStream - stream containing the data
57 * \param params - parsing options
58 */
59RDKIT_MOLINTERCHANGE_EXPORT std::vector<boost::shared_ptr<ROMol>>
62
63// \brief construct molecules from MolJSON data
64/*!
65 * \param jsonBlock - string containing the mol block
66 * \param params - parsing options
67 */
68RDKIT_MOLINTERCHANGE_EXPORT std::vector<boost::shared_ptr<ROMol>>
69JSONDataToMols(const std::string &jsonBlock,
71
72// \brief parameters controlling generating of MolJSON
74 bool useRDKitExtensions =
75 true; /*!< toggles using RDKit extensions to commmonchem */
76};
78
79// \brief returns MolJSON for a set of molecules
80/*!
81 * \param mols - the molecules to work with
82 */
83template <typename T>
85 const std::vector<T> &mols,
87
88// \brief returns MolJSON for a molecule
89/*!
90 * \param mol - the molecule to work with
91 */
92template <typename T>
93std::string MolToJSONData(const T &mol, const JSONWriteParameters &params =
95 std::vector<const T *> ms{&mol};
96 return MolsToJSONData(ms, params);
97};
98
99} // end of namespace MolInterchange
100} // end of namespace RDKit
101
102#endif
#define RDKIT_MOLINTERCHANGE_EXPORT
Definition export.h:329
RDKIT_MOLINTERCHANGE_EXPORT std::string MolsToJSONData(const std::vector< T > &mols, const JSONWriteParameters &params=defaultJSONWriteParameters)
RDKIT_MOLINTERCHANGE_EXPORT std::vector< boost::shared_ptr< ROMol > > JSONDataToMols(const std::string &jsonBlock, const JSONParseParameters &params=defaultJSONParseParameters)
std::string MolToJSONData(const T &mol, const JSONWriteParameters &params=defaultJSONWriteParameters)
static JSONWriteParameters defaultJSONWriteParameters
static JSONParseParameters defaultJSONParseParameters
RDKIT_MOLINTERCHANGE_EXPORT std::vector< boost::shared_ptr< ROMol > > JSONDataStreamToMols(std::istream *inStream, const JSONParseParameters &params=defaultJSONParseParameters)
Std stuff.
bool rdvalue_is(const RDValue_cast_t)