RDKit: RascalDetails.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
RascalDetails.h
Go to the documentation of this file.
1//
2// Copyright (C) David Cosgrove 2023
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
11#include <RDGeneral/export.h>
12#ifndef RDKIT_RASCAL_DETAILS_H
13#define RDKIT_RASCAL_DETAILS_H
14
15#include <map>
16
17#include <GraphMol/RascalMCES/RascalOptions.h>
18#include <GraphMol/RascalMCES/RascalResult.h>
19namespace RDKit {
20class ROMol;
21
22namespace RascalMCES {
23
24struct RascalClusterOptions;
25
26 namespace details {
27
28 struct ClusNode {
29 std::shared_ptr<RascalResult> d_res;
30 double d_sim;
31 unsigned int d_mol1Num, d_mol2Num;
32};
33
34 RDKIT_RASCALMCES_EXPORT double tier1Sim(
35 const RDKit::ROMol &mol1, const RDKit::ROMol &mol2,
36 std::map<int, std::vector<std::pair<int, int>>> &degSeqs1,
37 std::map<int, std::vector<std::pair<int, int>>> &degSeqs2);
38
39 RDKIT_RASCALMCES_EXPORT double tier2Sim(
40 const ROMol &mol1, const ROMol &mol2,
41 const std::map<int, std::vector<std::pair<int, int>>> &degSeqs1,
42 const std::map<int, std::vector<std::pair<int, int>>> &degSeqs2,
43 const std::vector<unsigned int> &bondLabels1,
44 const std::vector<unsigned int> &bondLabels2);
45
46 RDKIT_RASCALMCES_EXPORT void getBondLabels(
47 const RDKit::ROMol &mol1, const RDKit::ROMol &mol2,
48 const RascalOptions &opts, std::vector<unsigned int> &bondLabels1,
49 std::vector<unsigned int> &bondLabels2);
50
51std::vector<std::vector<ClusNode>> buildProximityGraph(
52 const std::vector<std::shared_ptr<ROMol>> &mols,
53 const RascalClusterOptions &clusOpts);
54
55 RDKIT_RASCALMCES_EXPORT bool resultCompare(const RascalResult &res1,
56 const RascalResult &res2);
57
58 RDKIT_RASCALMCES_EXPORT void extractClique(
59 const std::vector<unsigned int> &clique,
60 const std::vector<std::pair<int, int>> &vtxPairs, bool swapped,
61 std::vector<std::pair<int, int>> &bondMatches);
62
63// do some simple cleaning of the SMARTS, to make it more user-friendly.
64 RDKIT_RASCALMCES_EXPORT void cleanSmarts(std::string &smarts,
65 const std::string &equivalentAtoms);
66
67// Primarily for debugging, these write out the corresponding bonds/atoms
68// in Python list format, for ease of cut/paste into a highlighted image
69// creation.
70 RDKIT_RASCALMCES_EXPORT void printBondMatches(const RascalResult &res,
71 std::ostream &os);
72
73 RDKIT_RASCALMCES_EXPORT void printAtomMatches(const RascalResult &res,
74 std::ostream &os);
75
76// This prints out the scores in the order they are used in resultCompare.
77 RDKIT_RASCALMCES_EXPORT void printScores(const RascalResult &res,
78 std::ostream &os);
79
80// Calculate the Johnson similarity between the two molecules using the given
81// bondMatches. It's the fraction of the 2 molecules that are in common,
82// somewhat akin to the tanimoto - the square of the number of atoms plus
83// number of bonds in the MCES divided by the product of the sums of the number
84// of atoms and bonds in the 2 molecules.
85// It has nothing to do with lying UK politicians.
86 RDKIT_RASCALMCES_EXPORT double johnsonSimilarity(
87 const std::vector<std::pair<int, int>> &bondMatches,
88 const std::vector<std::pair<int, int>> &atomMatches,
89 const RDKit::ROMol &mol1, const RDKit::ROMol &mol2);
90
91} // namespace details
92
93} // namespace RascalMCES
94} // namespace RDKit
95#endif // RDKIT_RASCAL_MCES_H
RascalOptions.h
RascalResult.h
RDKit::ROMol
Definition ROMol.h:199
RDKit::RascalMCES::RascalResult
Definition RascalResult.h:28
export.h
RDKIT_RASCALMCES_EXPORT
#define RDKIT_RASCALMCES_EXPORT
Definition export.h:481
RDKit::RascalMCES::details
Definition RascalDetails.h:26
RDKit::RascalMCES::details::resultCompare
RDKIT_RASCALMCES_EXPORT bool resultCompare(const RascalResult &res1, const RascalResult &res2)
RDKit::RascalMCES::details::extractClique
RDKIT_RASCALMCES_EXPORT void extractClique(const std::vector< unsigned int > &clique, const std::vector< std::pair< int, int > > &vtxPairs, bool swapped, std::vector< std::pair< int, int > > &bondMatches)
RDKit::RascalMCES::details::getBondLabels
RDKIT_RASCALMCES_EXPORT void getBondLabels(const RDKit::ROMol &mol1, const RDKit::ROMol &mol2, const RascalOptions &opts, std::vector< unsigned int > &bondLabels1, std::vector< unsigned int > &bondLabels2)
RDKit::RascalMCES::details::johnsonSimilarity
RDKIT_RASCALMCES_EXPORT double johnsonSimilarity(const std::vector< std::pair< int, int > > &bondMatches, const std::vector< std::pair< int, int > > &atomMatches, const RDKit::ROMol &mol1, const RDKit::ROMol &mol2)
RDKit::RascalMCES::details::printScores
RDKIT_RASCALMCES_EXPORT void printScores(const RascalResult &res, std::ostream &os)
RDKit::RascalMCES::details::printAtomMatches
RDKIT_RASCALMCES_EXPORT void printAtomMatches(const RascalResult &res, std::ostream &os)
RDKit::RascalMCES::details::tier1Sim
RDKIT_RASCALMCES_EXPORT double tier1Sim(const RDKit::ROMol &mol1, const RDKit::ROMol &mol2, std::map< int, std::vector< std::pair< int, int > > > &degSeqs1, std::map< int, std::vector< std::pair< int, int > > > &degSeqs2)
RDKit::RascalMCES::details::cleanSmarts
RDKIT_RASCALMCES_EXPORT void cleanSmarts(std::string &smarts, const std::string &equivalentAtoms)
RDKit::RascalMCES::details::tier2Sim
RDKIT_RASCALMCES_EXPORT double tier2Sim(const ROMol &mol1, const ROMol &mol2, const std::map< int, std::vector< std::pair< int, int > > > &degSeqs1, const std::map< int, std::vector< std::pair< int, int > > > &degSeqs2, const std::vector< unsigned int > &bondLabels1, const std::vector< unsigned int > &bondLabels2)
RDKit::RascalMCES::details::buildProximityGraph
std::vector< std::vector< ClusNode > > buildProximityGraph(const std::vector< std::shared_ptr< ROMol > > &mols, const RascalClusterOptions &clusOpts)
RDKit::RascalMCES::details::printBondMatches
RDKIT_RASCALMCES_EXPORT void printBondMatches(const RascalResult &res, std::ostream &os)
RDKit::RascalMCES
Definition PartitionSet.h:23
RDKit
Std stuff.
Definition Abbreviations.h:19
RDKit::RascalMCES::RascalClusterOptions
Definition RascalClusterOptions.h:25
RDKit::RascalMCES::RascalOptions
Definition RascalOptions.h:20
RDKit::RascalMCES::details::ClusNode
Definition RascalDetails.h:28
RDKit::RascalMCES::details::ClusNode::d_sim
double d_sim
Definition RascalDetails.h:30
RDKit::RascalMCES::details::ClusNode::d_mol2Num
unsigned int d_mol2Num
Definition RascalDetails.h:31
RDKit::RascalMCES::details::ClusNode::d_res
std::shared_ptr< RascalResult > d_res
Definition RascalDetails.h:29
RDKit::RascalMCES::details::ClusNode::d_mol1Num
unsigned int d_mol1Num
Definition RascalDetails.h:31