File: RGroupData.h

package info (click to toggle)
rdkit 202503.1-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 220,160 kB
  • sloc: cpp: 399,240; python: 77,453; ansic: 25,517; java: 8,173; javascript: 4,005; sql: 2,389; yacc: 1,565; lex: 1,263; cs: 1,081; makefile: 578; xml: 229; fortran: 183; sh: 105
file content (64 lines) | stat: -rw-r--r-- 1,987 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
//  Copyright (C) 2017 Novartis Institutes for BioMedical Research
//
//   @@ 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 RGROUP_DATA
#define RGROUP_DATA

#include "../RDKitBase.h"
#include "RGroupUtils.h"
#include <DataStructs/ExplicitBitVect.h>
#include <set>
#include <vector>

namespace RDKit {

//! A single rgroup attached to a given core.
struct RDKIT_RGROUPDECOMPOSITION_EXPORT RGroupData {
  RWMOL_SPTR combinedMol;
  std::vector<ROMOL_SPTR> mols;         // All the mols in the rgroup
  std::vector<std::string> smilesVect;  // used for rgroup equivalence
  std::string
      smiles;  // smiles for all the mols in the rgroup (with attachments)
  std::set<int> attachments;  // core attachment points
  std::unique_ptr<ExplicitBitVect>
      fingerprint;  // fingerprint for score calculations
  std::vector<int> fingerprintOnBits;
  bool is_hydrogen = false;
  bool single_fragment = true;
  bool is_linker = false;
  bool labelled = false;

 public:
  RGroupData() {}

  void add(const ROMOL_SPTR &newMol,
           const std::vector<int> &rlabel_attachments);

  std::map<int, int> getNumBondsToRlabels() const;

  std::string toString() const;
  static std::string getRGroupLabel(int rlabel);
  static const std::string &getCoreLabel();
  static const std::string &getMolLabel();
  static bool isMolHydrogen(const ROMol &mol);

 private:
  void computeIsHydrogen();

  //! compute the canonical smiles for the attachments (bug: removes dupes since
  //! we are using a set...)
  std::string getSmiles() const;
  //! merge mol into combinedMol, including atom and bond highlights if present
  void mergeIntoCombinedMol(const ROMOL_SPTR &mol);
  std::map<int, std::vector<int>> rlabelAtomIndicesMap;
  std::map<int, std::vector<int>> rlabelBondIndicesMap;
};
}  // namespace RDKit

#endif