RDKit
Open-source cheminformatics and machine learning.
MolInterchange.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2018 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
17
interchange format
18
19
\b Note that this should be considered beta and that the format and API
20
will very likely change in future releases.
21
22
More information about CommonChem is available here:
23
https://github.com/mcs07/CommonChem
24
*/
25
26
#include <string>
27
#include <iostream>
28
#include <vector>
29
30
#include <boost/shared_ptr.hpp>
31
32
namespace
RDKit
{
33
34
class
RWMol;
35
36
namespace
MolInterchange {
37
38
// \brief parameters controlling parsing of MolJSON
39
struct
RDKIT_MOLINTERCHANGE_EXPORT
JSONParseParameters
{
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
};
49
static
JSONParseParameters
defaultJSONParseParameters
;
50
51
// \brief construct molecules from MolJSON data in a stream
52
/*!
53
* \param inStream - stream containing the data
54
* \param params - parsing options
55
*/
56
RDKIT_MOLINTERCHANGE_EXPORT
std::vector<boost::shared_ptr<ROMol>>
57
JSONDataStreamToMols
(std::istream *inStream,
const
JSONParseParameters
¶ms =
58
defaultJSONParseParameters
);
59
60
// \brief construct molecules from MolJSON data
61
/*!
62
* \param jsonBlock - string containing the mol block
63
* \param params - parsing options
64
*/
65
RDKIT_MOLINTERCHANGE_EXPORT
std::vector<boost::shared_ptr<ROMol>>
66
JSONDataToMols
(
const
std::string &jsonBlock,
67
const
JSONParseParameters
¶ms =
defaultJSONParseParameters
);
68
69
// \brief returns MolJSON for a set of molecules
70
/*!
71
* \param mols - the molecules to work with
72
*/
73
template
<
typename
T>
74
RDKIT_MOLINTERCHANGE_EXPORT
std::string
MolsToJSONData
(
75
const
std::vector<T> &mols);
76
77
// \brief returns MolJSON for a molecule
78
/*!
79
* \param mol - the molecule to work with
80
*/
81
template
<
typename
T>
82
std::string
MolToJSONData
(
const
T &mol) {
83
std::vector<const T *> ms{&mol};
84
return
MolsToJSONData
(ms);
85
};
86
87
}
// end of namespace MolInterchange
88
}
// end of namespace RDKit
89
90
#endif
RDKit::MolInterchange::MolToJSONData
std::string MolToJSONData(const T &mol)
Definition:
MolInterchange.h:82
RDKit::MolInterchange::JSONDataToMols
RDKIT_MOLINTERCHANGE_EXPORT std::vector< boost::shared_ptr< ROMol > > JSONDataToMols(const std::string &jsonBlock, const JSONParseParameters ¶ms=defaultJSONParseParameters)
RDKit::MolInterchange::JSONParseParameters
Definition:
MolInterchange.h:39
RDKIT_MOLINTERCHANGE_EXPORT
#define RDKIT_MOLINTERCHANGE_EXPORT
Definition:
export.h:424
RDKit
Std stuff.
Definition:
Atom.h:30
RDKit::MolInterchange::MolsToJSONData
RDKIT_MOLINTERCHANGE_EXPORT std::string MolsToJSONData(const std::vector< T > &mols)
RDKit::MolInterchange::JSONDataStreamToMols
RDKIT_MOLINTERCHANGE_EXPORT std::vector< boost::shared_ptr< ROMol > > JSONDataStreamToMols(std::istream *inStream, const JSONParseParameters ¶ms=defaultJSONParseParameters)
RDKit::MolInterchange::defaultJSONParseParameters
static JSONParseParameters defaultJSONParseParameters
Definition:
MolInterchange.h:49
export.h
GraphMol
MolInterchange
MolInterchange.h
Generated on Fri Jun 12 2020 19:04:45 for RDKit by
1.8.17