Loading...
Searching...
No Matches
RGroupFingerprintScore.h
Go to the documentation of this file.
//
// Copyright (C) 2020 Gareth Jones, Glysade LLC
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
#ifndef RDKIT_RGROUPFINGERPRINTSCORE_H
#define RDKIT_RGROUPFINGERPRINTSCORE_H
#include "RGroupMatch.h"
#include <vector>
namespace RDKit {
// class to hold the bitcounts for an attachment point/rgroup label
struct VarianceDataForLabel {
// rgroup label
const int label;
// number of structures attached here
int numberFingerprints;
// bitcounts - size fingerprint size, each position is the count of bits set
// over the fingerprints for all the structures
std::vector<int> bitCounts;
VarianceDataForLabel(const int &label, int numberFingerprints,
std::vector<int> bitCounts);
VarianceDataForLabel(const int &label);
VarianceDataForLabel(const VarianceDataForLabel &other) = default;
VarianceDataForLabel &operator=(const VarianceDataForLabel &other) = delete;
// add an rgroup structure to a bit counts array
void addRgroupData(RGroupData *rgroupData);
// remove an rgroup structure to a bit counts array
void removeRgroupData(RGroupData *rgroupData);
// calculate the mean variance for a bit counts array
double variance() const;
};
struct FingerprintVarianceScoreData {
size_t numberOfMissingUserRGroups = 0;
size_t numberOfMolecules = 0;
std::map<int, std::shared_ptr<VarianceDataForLabel>> labelsToVarianceData;
// calculates fingerprint variance score from rgroup bit counts
double fingerprintVarianceGroupScore();
// Adds a molecule match to the rgroup fingerprint bit counts
// vectors
void addVarianceData(int matchNumber, int permutationNumber,
const std::vector<std::vector<RGroupMatch>> &matches,
const std::set<int> &labels);
// Subtracts a molecule match from the rgroup fingerprint bit counts
// vectors
void removeVarianceData(int matchNumber, int permutationNumber,
const std::vector<std::vector<RGroupMatch>> &matches,
const std::set<int> &labels);
void clear();
private:
void modifyVarianceData(int matchNumber, int permutationNumber,
const std::vector<std::vector<RGroupMatch>> &matches,
const std::set<int> &labels, bool add);
};
// The arithmetic mean of the mean fingerprint bit variances for the
// fingerprints at each rgroup position.
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);
} // namespace RDKit
#endif // RDKIT_RGROUPFINGERPRINTSCORE_H
RGroupMatch.h
RDKIT_RGROUPDECOMPOSITION_EXPORT
#define RDKIT_RGROUPDECOMPOSITION_EXPORT
Definition export.h:441
RDKit
Std stuff.
Definition Abbreviations.h:19
RDKit::rdvalue_is
bool rdvalue_is(const RDValue_cast_t)
Definition RDValue-doublemagic.h:372
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
Definition RGroupFingerprintScore.h:20
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)