Chemical Data Processing Library Python API - Version 1.4.0
Classes | Public Member Functions | Properties | List of all members
CDPL.Biomol.MMCIFData Class Reference

Data structure for the storage of imported MMCIF data (see [MMCIF]). More...

+ Inheritance diagram for CDPL.Biomol.MMCIFData:

Classes

class  Category
 A single mmCIF data category, holding an ordered list of data items (columns). More...
 
class  Item
 A single data item (column) of an mmCIF category, holding an ordered list of string values. More...
 

Public Member Functions

None __init__ ()
 Constructs an empty MMCIFData instance with an empty data-block ID.
 
None __init__ (MMCIFData data)
 Initializes a copy of the MMCIFData instance data. More...
 
None __init__ (str id)
 Constructs an empty MMCIFData instance with the data-block ID id. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
str getID ()
 Returns the mmCIF data-block ID. More...
 
None setID (str id)
 Sets the mmCIF data-block ID to id. More...
 
int getNumCategories ()
 Returns the number of categories in the data record. More...
 
MMCIFData assign (MMCIFData data)
 Replaces the current state of self with a copy of the state of the MMCIFData instance data. More...
 
None swap (MMCIFData data)
 Swaps the contents of this data record with those of data. More...
 
None clear ()
 Removes all categories from the data record (without changing the data-block ID).
 
Category findCategory (str name)
 Returns a mutable reference to the category with name name, or nullptr if no matching category exists. More...
 
Category addCategory (str name, bool front=False)
 Adds a new (empty) category with name name to the data record. More...
 
Category getCategory (str name)
 Returns a reference to the category with name name. More...
 
Category getCategory (int index)
 Returns a reference to the category at the zero-based index index. More...
 
Category lastCategory ()
 Returns a mutable reference to the last category of the data record. More...
 
bool removeCategory (str name)
 Removes the category with name name. More...
 
None removeCategory (int index)
 Removes the category at the zero-based index index. More...
 
int __len__ ()
 
Category __getitem__ (str name)
 
Category __getitem__ (int index)
 
bool __delitem__ (str name)
 
None __delitem__ (int index)
 
bool __contains__ (str name)
 Returns the result of the membership test operation name in self. More...
 
object __str__ ()
 Returns a string representation of the MMCIFData instance. More...
 

Properties

 objectID = property(getObjectID)
 
 numCategories = property(getNumCategories)
 
 id = property(getID, setID)
 

Detailed Description

Data structure for the storage of imported MMCIF data (see [MMCIF]).

Since
1.2

Constructor & Destructor Documentation

◆ __init__() [1/2]

None CDPL.Biomol.MMCIFData.__init__ ( MMCIFData  data)

Initializes a copy of the MMCIFData instance data.

Parameters
dataThe MMCIFData instance to copy.

◆ __init__() [2/2]

None CDPL.Biomol.MMCIFData.__init__ ( str  id)

Constructs an empty MMCIFData instance with the data-block ID id.

Parameters
idThe mmCIF data-block ID.

Member Function Documentation

◆ getObjectID()

int CDPL.Biomol.MMCIFData.getObjectID ( )

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

Different Python MMCIFData 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 MMCIFData 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.

◆ getID()

str CDPL.Biomol.MMCIFData.getID ( )

Returns the mmCIF data-block ID.

Returns
A reference to the data-block ID.

◆ setID()

None CDPL.Biomol.MMCIFData.setID ( str  id)

Sets the mmCIF data-block ID to id.

Parameters
idThe new data-block ID.

◆ getNumCategories()

int CDPL.Biomol.MMCIFData.getNumCategories ( )

Returns the number of categories in the data record.

Returns
The category count.

◆ assign()

MMCIFData CDPL.Biomol.MMCIFData.assign ( MMCIFData  data)

Replaces the current state of self with a copy of the state of the MMCIFData instance data.

Parameters
dataThe MMCIFData instance to copy.
Returns
self

◆ swap()

None CDPL.Biomol.MMCIFData.swap ( MMCIFData  data)

Swaps the contents of this data record with those of data.

Parameters
dataThe other data record to swap with.

◆ findCategory()

Category CDPL.Biomol.MMCIFData.findCategory ( str  name)

Returns a mutable reference to the category with name name, or nullptr if no matching category exists.

Parameters
nameThe mmCIF category name (without the leading underscore).
Returns
A mutable reference to the matching category, or nullptr.

◆ addCategory()

Category CDPL.Biomol.MMCIFData.addCategory ( str  name,
bool   front = False 
)

Adds a new (empty) category with name name to the data record.

If a category with the given name already exists, no new category is added and a reference to the existing category is returned.

Parameters
nameThe mmCIF category name (without the leading underscore).
frontIf True, the new category is inserted at the front of the category list. If False, it is appended.
Returns
A mutable reference to the added (or pre-existing) category.

◆ getCategory() [1/2]

Category CDPL.Biomol.MMCIFData.getCategory ( str  name)

Returns a reference to the category with name name.

Parameters
nameThe mmCIF category name (without the leading underscore).
Returns
A reference to the matching category.
Exceptions
Base.ItemNotFoundif no matching category exists.

◆ getCategory() [2/2]

Category CDPL.Biomol.MMCIFData.getCategory ( int  index)

Returns a reference to the category at the zero-based index index.

Parameters
indexThe zero-based category index.
Returns
A reference to the category.
Exceptions
Base.IndexErrorif the number of categories is zero or index is not in the range [0, getNumCategories() - 1].

◆ lastCategory()

Category CDPL.Biomol.MMCIFData.lastCategory ( )

Returns a mutable reference to the last category of the data record.

Returns
A mutable reference to the last category.
Exceptions
Base.OperationFailedif the data record is empty.

◆ removeCategory() [1/2]

bool CDPL.Biomol.MMCIFData.removeCategory ( str  name)

Removes the category with name name.

Parameters
nameThe mmCIF category name (without the leading underscore).
Returns
True if a matching category was removed, and False if no such category existed.

◆ removeCategory() [2/2]

None CDPL.Biomol.MMCIFData.removeCategory ( int  index)

Removes the category at the zero-based index index.

Parameters
indexThe zero-based category index.
Exceptions
Base.IndexErrorif the number of categories is zero or index is not in the range [0, getNumCategories() - 1].

◆ __len__()

int CDPL.Biomol.MMCIFData.__len__ ( )
Returns

◆ __getitem__() [1/2]

Category CDPL.Biomol.MMCIFData.__getitem__ ( str  name)
Parameters
name
Returns

◆ __getitem__() [2/2]

Category CDPL.Biomol.MMCIFData.__getitem__ ( int  index)
Parameters
index
Returns

◆ __delitem__() [1/2]

bool CDPL.Biomol.MMCIFData.__delitem__ ( str  name)
Parameters
name
Returns

◆ __delitem__() [2/2]

None CDPL.Biomol.MMCIFData.__delitem__ ( int  index)
Parameters
index

◆ __contains__()

bool CDPL.Biomol.MMCIFData.__contains__ ( str  name)

Returns the result of the membership test operation name in self.

Parameters
nameThe value to test for membership.
Returns
The result of the membership test operation.

◆ __str__()

object CDPL.Biomol.MMCIFData.__str__ ( )

Returns a string representation of the MMCIFData instance.

Returns
The generated string representation.