Chemical Data Processing Library Python API - Version 1.4.0
Public Member Functions | Static Public Member Functions | Properties | List of all members
CDPL.ConfGen.FragmentLibrary Class Reference

A library of pre-generated conformations for rigid molecular fragments, indexed by canonical-fragment hash code. More...

+ Inheritance diagram for CDPL.ConfGen.FragmentLibrary:

Public Member Functions

None __init__ ()
 Constructs an empty FragmentLibrary instance.
 
None __init__ (FragmentLibrary lib)
 Constructs a copy of the FragmentLibrary instance lib. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
None addEntries (FragmentLibrary lib)
 Adds all entries from lib to this library. More...
 
bool addEntry (FragmentLibraryEntry entry)
 Adds the given entry to the library. More...
 
bool removeEntry (int hash_code)
 Removes the entry with the specified hash code. More...
 
FragmentLibraryEntry getEntry (int hash_code)
 Returns the entry with the specified hash code. More...
 
bool containsEntry (int hash_code)
 Tells whether the library contains an entry with the specified hash code. More...
 
None clear ()
 Removes all entries from the library.
 
int getNumEntries ()
 Returns the number of entries stored in the library. More...
 
list getEntries ()
 
None load (Base.IStream is)
 Loads the contents of the library from the input stream is. More...
 
None loadDefaults ()
 Loads the default fragment library bundled with CDPKit.
 
None save (Base.OStream os)
 Writes the contents of the library to the output stream os. More...
 
FragmentLibrary assign (FragmentLibrary lib)
 Replaces the contents of this library with a copy of the contents of lib. More...
 

Static Public Member Functions

None set (FragmentLibrary lib)
 Sets the process-wide default fragment library used by ConfGen routines. More...
 
FragmentLibrary get ()
 Returns the process-wide default fragment library. More...
 

Properties

 objectID = property(getObjectID)
 
 numEntries = property(getNumEntries)
 
 entries = property(getEntries)
 

Detailed Description

A library of pre-generated conformations for rigid molecular fragments, indexed by canonical-fragment hash code.

Entries are FragmentLibraryEntry instances keyed by the hash code of the associated ConfGen.CanonicalFragment. The library is iterable, supports lookup/insertion/removal, can be serialized to and from a stream, and provides a process-wide default instance via the static set() / get() accessors. A built-in mutex is exposed via getMutex() to allow callers to coordinate concurrent access.

Constructor & Destructor Documentation

◆ __init__()

None CDPL.ConfGen.FragmentLibrary.__init__ ( FragmentLibrary  lib)

Constructs a copy of the FragmentLibrary instance lib.

Parameters
libThe FragmentLibrary to copy.

Member Function Documentation

◆ getObjectID()

int CDPL.ConfGen.FragmentLibrary.getObjectID ( )

Returns the numeric identifier (ID) of the wrapped C++ class instance.

Different Python FragmentLibrary instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two FragmentLibrary instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().

Returns
The numeric ID of the internally referenced C++ class instance.

◆ addEntries()

None CDPL.ConfGen.FragmentLibrary.addEntries ( FragmentLibrary  lib)

Adds all entries from lib to this library.

Parameters
libThe source FragmentLibrary.

◆ addEntry()

bool CDPL.ConfGen.FragmentLibrary.addEntry ( FragmentLibraryEntry  entry)

Adds the given entry to the library.

Parameters
entryThe entry to add.
Returns
True if the entry was added, and False if an entry with the same hash code was already present.

◆ removeEntry()

bool CDPL.ConfGen.FragmentLibrary.removeEntry ( int  hash_code)

Removes the entry with the specified hash code.

Parameters
hash_codeThe hash code of the entry to remove.
Returns
True if the entry was removed, and False if no matching entry existed.

◆ getEntry()

FragmentLibraryEntry CDPL.ConfGen.FragmentLibrary.getEntry ( int  hash_code)

Returns the entry with the specified hash code.

Parameters
hash_codeThe hash code of the queried entry.
Returns
A reference to the matching entry's smart reference, or to an empty smart reference if no entry with hash_code exists.

◆ containsEntry()

bool CDPL.ConfGen.FragmentLibrary.containsEntry ( int  hash_code)

Tells whether the library contains an entry with the specified hash code.

Parameters
hash_codeThe hash code of the queried entry.
Returns
True if the entry exists, and False otherwise.

◆ getNumEntries()

int CDPL.ConfGen.FragmentLibrary.getNumEntries ( )

Returns the number of entries stored in the library.

Returns
The number of entries.

◆ getEntries()

list CDPL.ConfGen.FragmentLibrary.getEntries ( )
Returns

◆ load()

None CDPL.ConfGen.FragmentLibrary.load ( Base.IStream  is)

Loads the contents of the library from the input stream is.

Parameters
isThe input stream to read from.

◆ save()

None CDPL.ConfGen.FragmentLibrary.save ( Base.OStream  os)

Writes the contents of the library to the output stream os.

Parameters
osThe output stream to write to.

◆ assign()

FragmentLibrary CDPL.ConfGen.FragmentLibrary.assign ( FragmentLibrary  lib)

Replaces the contents of this library with a copy of the contents of lib.

Parameters
libThe source FragmentLibrary.
Returns
self

◆ set()

None CDPL.ConfGen.FragmentLibrary.set ( FragmentLibrary  lib)
static

Sets the process-wide default fragment library used by ConfGen routines.

Parameters
libThe new default fragment library.

◆ get()

FragmentLibrary CDPL.ConfGen.FragmentLibrary.get ( )
static

Returns the process-wide default fragment library.

Returns
The current default fragment library.