RDKit
Open-source cheminformatics and machine learning.
Toggle main menu visibility
Loading...
Searching...
No Matches
RGroupFingerprintScore.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2020 Gareth Jones, Glysade LLC
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
#ifndef RDKIT_RGROUPFINGERPRINTSCORE_H
12
#define RDKIT_RGROUPFINGERPRINTSCORE_H
13
14
#include "
RGroupMatch.h
"
15
#include <vector>
16
17
namespace
RDKit
{
18
19
// class to hold the bitcounts for an attachment point/rgroup label
20
struct
VarianceDataForLabel
{
21
// rgroup label
22
const
int
label
;
23
// number of structures attached here
24
int
numberFingerprints
;
25
// bitcounts - size fingerprint size, each position is the count of bits set
26
// over the fingerprints for all the structures
27
std::vector<int>
bitCounts
;
28
29
VarianceDataForLabel
(
const
int
&
label
,
int
numberFingerprints
,
30
std::vector<int>
bitCounts
);
31
VarianceDataForLabel
(
const
int
&
label
);
32
VarianceDataForLabel
(
const
VarianceDataForLabel
&other) =
default
;
33
VarianceDataForLabel
&
operator=
(
const
VarianceDataForLabel
&other) =
delete
;
34
// add an rgroup structure to a bit counts array
35
void
addRgroupData
(
RGroupData
*rgroupData);
36
// remove an rgroup structure to a bit counts array
37
void
removeRgroupData
(
RGroupData
*rgroupData);
38
// calculate the mean variance for a bit counts array
39
double
variance
()
const
;
40
};
41
42
struct
FingerprintVarianceScoreData
{
43
size_t
numberOfMissingUserRGroups
= 0;
44
size_t
numberOfMolecules
= 0;
45
std::map<int, std::shared_ptr<VarianceDataForLabel>>
labelsToVarianceData
;
46
47
// calculates fingerprint variance score from rgroup bit counts
48
double
fingerprintVarianceGroupScore
();
49
50
// Adds a molecule match to the rgroup fingerprint bit counts
51
// vectors
52
void
addVarianceData
(
int
matchNumber,
int
permutationNumber,
53
const
std::vector<std::vector<RGroupMatch>> &matches,
54
const
std::set<int> &labels);
55
56
// Subtracts a molecule match from the rgroup fingerprint bit counts
57
// vectors
58
void
removeVarianceData
(
int
matchNumber,
int
permutationNumber,
59
const
std::vector<std::vector<RGroupMatch>> &matches,
60
const
std::set<int> &labels);
61
62
void
clear
();
63
64
private
:
65
void
modifyVarianceData(
int
matchNumber,
int
permutationNumber,
66
const
std::vector<std::vector<RGroupMatch>> &matches,
67
const
std::set<int> &labels,
bool
add);
68
};
69
70
// The arithmetic mean of the mean fingerprint bit variances for the
71
// fingerprints at each rgroup position.
72
RDKIT_RGROUPDECOMPOSITION_EXPORT
double
fingerprintVarianceScore
(
73
const
std::vector<size_t> &permutation,
74
const
std::vector<std::vector<RGroupMatch>> &matches,
75
const
std::set<int> &labels,
76
FingerprintVarianceScoreData
*fingerprintVarianceScoreData =
nullptr
);
77
78
}
// namespace RDKit
79
80
#endif
// RDKIT_RGROUPFINGERPRINTSCORE_H
RGroupMatch.h
RDKIT_RGROUPDECOMPOSITION_EXPORT
#define RDKIT_RGROUPDECOMPOSITION_EXPORT
Definition
export.h:601
RDKit
Std stuff.
Definition
Abbreviations.h:19
RDKit::fingerprintVarianceScore
RDKIT_RGROUPDECOMPOSITION_EXPORT double fingerprintVarianceScore(const std::vector< size_t > &permutation, const std::vector< std::vector< RGroupMatch > > &matches, const std::set< int > &labels, FingerprintVarianceScoreData *fingerprintVarianceScoreData=nullptr)
RDKit::FingerprintVarianceScoreData
Definition
RGroupFingerprintScore.h:42
RDKit::FingerprintVarianceScoreData::fingerprintVarianceGroupScore
double fingerprintVarianceGroupScore()
RDKit::FingerprintVarianceScoreData::numberOfMissingUserRGroups
size_t numberOfMissingUserRGroups
Definition
RGroupFingerprintScore.h:43
RDKit::FingerprintVarianceScoreData::labelsToVarianceData
std::map< int, std::shared_ptr< VarianceDataForLabel > > labelsToVarianceData
Definition
RGroupFingerprintScore.h:45
RDKit::FingerprintVarianceScoreData::addVarianceData
void addVarianceData(int matchNumber, int permutationNumber, const std::vector< std::vector< RGroupMatch > > &matches, const std::set< int > &labels)
RDKit::FingerprintVarianceScoreData::clear
void clear()
RDKit::FingerprintVarianceScoreData::removeVarianceData
void removeVarianceData(int matchNumber, int permutationNumber, const std::vector< std::vector< RGroupMatch > > &matches, const std::set< int > &labels)
RDKit::FingerprintVarianceScoreData::numberOfMolecules
size_t numberOfMolecules
Definition
RGroupFingerprintScore.h:44
RDKit::RGroupData
A single rgroup attached to a given core.
Definition
RGroupData.h:22
RDKit::VarianceDataForLabel::variance
double variance() const
RDKit::VarianceDataForLabel::bitCounts
std::vector< int > bitCounts
Definition
RGroupFingerprintScore.h:27
RDKit::VarianceDataForLabel::VarianceDataForLabel
VarianceDataForLabel(const VarianceDataForLabel &other)=default
RDKit::VarianceDataForLabel::VarianceDataForLabel
VarianceDataForLabel(const int &label, int numberFingerprints, std::vector< int > bitCounts)
RDKit::VarianceDataForLabel::operator=
VarianceDataForLabel & operator=(const VarianceDataForLabel &other)=delete
RDKit::VarianceDataForLabel::numberFingerprints
int numberFingerprints
Definition
RGroupFingerprintScore.h:24
RDKit::VarianceDataForLabel::addRgroupData
void addRgroupData(RGroupData *rgroupData)
RDKit::VarianceDataForLabel::label
const int label
Definition
RGroupFingerprintScore.h:22
RDKit::VarianceDataForLabel::VarianceDataForLabel
VarianceDataForLabel(const int &label)
RDKit::VarianceDataForLabel::removeRgroupData
void removeRgroupData(RGroupData *rgroupData)
GraphMol
RGroupDecomposition
RGroupFingerprintScore.h
Generated on
for RDKit by
1.17.0