RDKit: RDKit::MolBundle Class Reference

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
RDKit::MolBundle Class Reference

MolBundle contains a collection of related ROMols. More...

`#include <MolBundle.h>`

Inheritance diagram for RDKit::MolBundle:

## Public Member Functions
| MolBundle ()
| MolBundle (const MolBundle &other)
| copy constructor
| MolBundle (const std::string &pkl)
virtual | ~MolBundle ()
MolBundle & | operator= (const MolBundle &other)=default
virtual const std::vector< boost::shared_ptr< ROMol > > & | getMols () const
| returns our molecules
virtual size_t | addMol (boost::shared_ptr< ROMol > nmol)
| adds a new molecule and returns the total number of molecules
virtual size_t | size () const
| returns the number of molecules from the bundle
virtual bool | empty () const
| returns whether or not the bundle is empty
virtual const boost::shared_ptr< ROMol > | getMol (size_t idx) const
| returns a particular molecule in the bundle
virtual const boost::shared_ptr< ROMol > | operator[] (size_t idx) const
| returns a particular molecule from the bundle
void | toStream (std::ostream &ss) const
| serializes (pickles) to a stream
std::string | serialize () const
| returns a string with a serialized (pickled) representation
void | initFromStream (std::istream &ss)
| initializes from a stream pickle
void | initFromString (const std::string &text)
| initializes from a string pickle
Public Member Functions inherited from RDKit::RDProps
| RDProps ()
| RDProps (const RDProps &rhs)
RDProps & | operator= (const RDProps &rhs)
| RDProps (RDProps &&o) noexcept=default
RDProps & | operator= (RDProps &&rhs) noexcept=default
void | clear ()
const Dict & | getDict () const
| gets the underlying Dictionary
Dict & | getDict ()
STR_VECT | getPropList (bool includePrivate=true, bool includeComputed=true) const
| returns a list with the names of our `properties`
template<typename T>
void | setProp (const std::string &key, T val, bool computed=false) const
| sets a `property` value
template<typename T>
void | getProp (const std::string &key, T &res) const
| allows retrieval of a particular property value
template<typename T>
T | getProp (const std::string &key) const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename T>
bool | getPropIfPresent (const std::string &key, T &res) const
bool | hasProp (const std::string &key) const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void | clearProp (const std::string &key) const
| clears the value of a `property`
void | clearComputedProps () const
| clears all of our `computed` `properties`
void | updateProps (const RDProps &source, bool preserveExisting=false)
| update the properties from another

## Protected Attributes
std::vector< boost::shared_ptr< ROMol > > | d_mols
Protected Attributes inherited from RDKit::RDProps
Dict | d_props

## Detailed Description

MolBundle contains a collection of related ROMols.

This is designed to allow handling things like enumerating link nodes, polymers, etc.

Definition at line 59 of file MolBundle.h.

## Constructor & Destructor Documentation

## ◆ MolBundle() [1/3]

RDKit::MolBundle::MolBundle | ( |  | ) |
| inline

Definition at line 61 of file MolBundle.h.

References RDKit::RDProps::RDProps().

Referenced by RDKit::FixedMolSizeMolBundle::FixedMolSizeMolBundle(), RDKit::FixedMolSizeMolBundle::FixedMolSizeMolBundle(), MolBundle(), and operator=().

## ◆ MolBundle() [2/3]

RDKit::MolBundle::MolBundle | ( | const MolBundle & | other | ) |
| inline

copy constructor

Definition at line 64 of file MolBundle.h.

References d_mols, MolBundle(), and RDKit::RDProps::RDProps().

## ◆ MolBundle() [3/3]

RDKit::MolBundle::MolBundle | ( | const std::string & | pkl | ) |
| inline

Definition at line 65 of file MolBundle.h.

References initFromString().

## ◆ ~MolBundle()

virtual RDKit::MolBundle::~MolBundle | ( |  | ) |
| inlinevirtual

Definition at line 66 of file MolBundle.h.

## Member Function Documentation

## ◆ addMol()

virtual size_t RDKit::MolBundle::addMol | ( | boost::shared_ptr< ROMol > | nmol | ) |
| inlinevirtual

adds a new molecule and returns the total number of molecules

Reimplemented in RDKit::FixedMolSizeMolBundle.

Definition at line 76 of file MolBundle.h.

References d_mols, and PRECONDITION.

## ◆ empty()

virtual bool RDKit::MolBundle::empty | ( |  | ) | const
| inlinevirtual

returns whether or not the bundle is empty

Definition at line 84 of file MolBundle.h.

References d_mols.

## ◆ getMol()

virtual const boost::shared_ptr< ROMol > RDKit::MolBundle::getMol | ( | size_t | idx | ) | const
| inlinevirtual

returns a particular molecule in the bundle

Definition at line 87 of file MolBundle.h.

References d_mols.

Referenced by operator[]().

## ◆ getMols()

virtual const std::vector< boost::shared_ptr< ROMol > > & RDKit::MolBundle::getMols | ( |  | ) | const
| inlinevirtual

returns our molecules

Definition at line 71 of file MolBundle.h.

References d_mols.

## ◆ initFromStream()

void RDKit::MolBundle::initFromStream | ( | std::istream & | ss | ) |
| inline

initializes from a stream pickle

Definition at line 115 of file MolBundle.h.

References PRECONDITION, and RDUNUSED_PARAM.

Referenced by initFromString().

## ◆ initFromString()

void RDKit::MolBundle::initFromString | ( | const std::string & | text | ) |
| inline

initializes from a string pickle

Definition at line 125 of file MolBundle.h.

References initFromStream().

Referenced by MolBundle().

## ◆ operator=()

MolBundle & RDKit::MolBundle::operator= | ( | const MolBundle & | other | ) |
| default

References MolBundle().

## ◆ operator[]()

virtual const boost::shared_ptr< ROMol > RDKit::MolBundle::operator[] | ( | size_t | idx | ) | const
| inlinevirtual

returns a particular molecule from the bundle

Definition at line 94 of file MolBundle.h.

References getMol().

## ◆ serialize()

std::string RDKit::MolBundle::serialize | ( |  | ) | const
| inline

returns a string with a serialized (pickled) representation

Definition at line 109 of file MolBundle.h.

References toStream().

## ◆ size()

virtual size_t RDKit::MolBundle::size | ( |  | ) | const
| inlinevirtual

returns the number of molecules from the bundle

Definition at line 82 of file MolBundle.h.

References d_mols.

## ◆ toStream()

void RDKit::MolBundle::toStream | ( | std::ostream & | ss | ) | const
| inline

serializes (pickles) to a stream

Definition at line 99 of file MolBundle.h.

References PRECONDITION, and RDUNUSED_PARAM.

Referenced by serialize().

## Member Data Documentation

## ◆ d_mols

std::vector<boost::shared_ptr<ROMol> > RDKit::MolBundle::d_mols
| protected

Definition at line 159 of file MolBundle.h.

Referenced by RDKit::FixedMolSizeMolBundle::addMol(), addMol(), empty(), getMol(), getMols(), MolBundle(), and size().

The documentation for this class was generated from the following file:

- MolBundle.h