RDKit
Open-source cheminformatics and machine learning.
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
21  // rgroup label
22  const int label;
23  // number of structures attached here
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 
30  std::vector<int> bitCounts);
32  VarianceDataForLabel(const VarianceDataForLabel &other) = default;
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 
44  size_t numberOfMolecules = 0;
45  std::map<int, std::shared_ptr<VarianceDataForLabel>> labelsToVarianceData;
46 
47  // calculates fingerprint variance score from rgroup bit counts
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.
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
#define RDKIT_RGROUPDECOMPOSITION_EXPORT
Definition: export.h:401
Std stuff.
Definition: Abbreviations.h:19
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)
std::map< int, std::shared_ptr< VarianceDataForLabel > > labelsToVarianceData
void addVarianceData(int matchNumber, int permutationNumber, const std::vector< std::vector< RGroupMatch >> &matches, const std::set< int > &labels)
void removeVarianceData(int matchNumber, int permutationNumber, const std::vector< std::vector< RGroupMatch >> &matches, const std::set< int > &labels)
A single rgroup attached to a given core.
Definition: RGroupData.h:27
VarianceDataForLabel(const VarianceDataForLabel &other)=default
VarianceDataForLabel(const int &label, int numberFingerprints, std::vector< int > bitCounts)
void addRgroupData(RGroupData *rgroupData)
VarianceDataForLabel & operator=(const VarianceDataForLabel &other)=delete
VarianceDataForLabel(const int &label)
void removeRgroupData(RGroupData *rgroupData)