OECIFData

struct OECIFData

This class represents OECIFData that holds CIF header data and acts as an interface to interact with this header data. This object reflects what is contained in the CIF data_ section.

The goal for the OECIFData class is to allow a user to freely interact with CIF data and be confident the data will be written in proper format that can be easily be read again. This object allows structural data stored on the molecule to be synchronized and updated with its CIF header data to reflect changes in the molecule. No change in OECIFData will affect the molecule that stores it.

The overall structure of OECIFData reflects CIF formatting. The OECIFData object stores all the data in a data_ block. Values from each CIF category are stored on the OECIFCategory object. Thus, OECIFData is a collection of OECIFCategory objects mapped to the category name.

Access to the data using OECIFData utilizes the CIF category and attribute names. These functions allow a user to get, set or add any value in the CIF header.

Note

Category names must begin with an underscore and end with a period. Example: "_entity."

The CIF File Format section explains the CIF data structure in more detail.

Constructors

OECIFData() -> OECIFData
OECIFData(cifDataBlockAsString: str) -> OECIFData
OECIFData(cifData: OECIFData) -> OECIFData
OECIFData(mol: Union[OEGraphMol,OEMol,OEQMol]) -> OECIFData

Create an OECIFData object from a header data string, or header data stored on a mol accessed using OEGetMMCIFData.

AddCategory

AddCategory(category: OECIFCategory) -> bool
AddCategory(categoryName: str, attributes: OEStringVector,
            newValues: OEStringVector) -> bool
AddCategory(categoryName: str, attributes: OEStringVector) -> bool
AddCategory(categoryName: str) -> bool

Adds a new category to the OECIFData object.

AddRow

AddRow(categoryName: str, newValues: OEStringVector) -> bool

Adds a row of values to the indicated CIF item prefix. If no values are input, by default, it will add a question mark “?” to every attribute in the category.

AddData

AddData(categoryName: str, attribute: str,
        newValuess: OEStringVector) -> bool

Adds a new attribute and a column of its values to the indicated CIF item tag. The number of new data input must match the number of rows currently in the OECIFCategory it is being added to.

ChemCompToMol

ChemCompToMol(cifMol: Union[OEGraphMol,OEMol,OEQMol], resName: str) -> bool

Creates a molecule from CIF _chem_comp data in the OECIFData object. The following CIF categories must be present for proper function:

  • _chem_comp_atom. defines the atom name and element

  • _chem_comp_bond. defines the bonding network

The input cifMol molecule is cleared before parsing, so the resulting molecule object only contains atoms and bonds from the _chem_comp header data.

DeleteCategory

DeleteCategory(categoryName: str) -> bool

Deletes a category based on the category name.

DeleteRow

DeleteRow(categoryName: str, row: int) -> bool

Deletes a category’s indicated row values based on the category name.

DeleteAttribute

DeleteAttribute(categoryName: str, attribute: str) -> bool

Deletes a category’s attribute and associated values.

GenerateHeader

GenerateHeader() -> str

Using all the categories saved on this object, this will output the CIF header.

GeneratePolySeqScheme

GeneratePolySeqScheme(mol: Union[OEGraphMol,OEMol,OEQMol],
                      maxMismatch: int = 10) -> bool

Will generate the _pdbx_poly_seq_scheme header section using header and molecule data. The following categories need to be present and properly populated for this function:

  • _struct_asym.

  • _entity.

  • _entity_poly_seq.

The molecule object must contain at least one residue. Any existing _pdbx_poly_seq_scheme data will be cleared before generation.

GetAttributes

GetAttributes(categoryName: str) -> OEStringVector

Gets a list of all the attributes in this object.

GetAttributeValue

GetAttributeValue(categoryName: str, attribute: str,
                  raw: bool = False) -> str
GetAttributeValue(categoryName: str, attribute: str, row: int,
                  raw: bool = False) -> str

Gets the saved value on the indicated category’s attribute. If multiple values exist for a given attribute, then a row number must be identified.

GetAttributeValues

GetAttributeValues(categoryName: str, attribute: str,
                   raw: bool = False) -> OEStringVector

Gets all the saved values on the indicated category’s attribute.

GetAttributeIndex

GetAttributeIndex(categoryName: str, attribute: str) -> int

Returns the attribute’s base-0 index. For any given row of data associated with the category, this index correlates with the attribute’s value in that row. For example, if GetAttributeIndex(“entity.”, “type”)=1, for every row generated by GetRows(“_entity.”), the _category.type data would be the [1] value in that row.

GetCategory

GetCategory(categoryName: str) -> OECIFCategory

Gets the OECIFCategory object by its category name.

GetCategoryNames

GetCategoryNames() -> OEStringVector

Returns all the CIF category names present in this object.

GetDataItems

GetDataItems(categoryName: str) -> OEStringVector

Returns a list of all the CIF data items in this object.

GetName

GetName() -> str

Returns the name of the header data. Value is defined using the molecule’s title.

GetNumCategories

GetNumCategories() -> int

Number of CIF categories saved in this object.

GetNumCategoryRows

GetNumCategoryRows(categoryName: str) -> int

Number of CIF rows in a category.

GetNumCategoryAttributes

GetNumCategoryAttributes(categoryName: str) -> int

Number of CIF attributes in a category.

GetNumericAttributeValue

Gets the saved value on the indicated category’s attribute and converts to a numeric value. If multiple values exist for a given item attribute, then a row number must be identified. If a value cannot be easily converted to a numeric value, it will default to 0.

GetNumericAttributeValues

GetNumericAttributeValues(categoryName: str, attribute: str,
                          vals: OEFloatVector) -> bool
GetNumericAttributeValues(categoryName: str, attribute: str,
                          vals: OEIntVector) -> bool

Gets all the saved values on the indicated category’s attribute and converts to a numeric value. If a value cannot be easily converted to a numeric value, it will default to 0.

GetRow

GetRow(categoryName: str, row: int, raw: bool = False) -> OEStringVector

Returns a specific row from the indicated category. Rows values are base-0. Raw values are formatted as they will appear in the header. This is most noticeable with values that contain space characters as CIF formatting requires single or double quotes around such a string value.

GetRows

GetRows(categoryName: str, beginRow: int, endRow: int,
        raw: bool = False) -> OEStringVectorVector
GetRows(categoryName: str, raw: bool = False) -> OEStringVectorVector

Returns rows from the indicated category. Rows values are base-0. Raw values are formatted as they will appear in the header. This is most noticeable with values that contain space characters as CIF formatting requires single or double quotes around such a string value.

GetRowIndices

GetRowIndices(categoryName: str, attribute: str, matchValue: str) -> OEUIntVector

Returns the base-0 row indices whose values string-match with input match value.

HasAttribute

HasAttribute(categoryName: str, attribute: str) -> bool

Returns if an attribute is present in this object.

HasCategoryName

HasCategoryName(categoryName: str) -> bool

Returns if a category name is present in this object.

SetCategory

SetCategory(category: OECIFCategory) -> bool
SetCategory(categoryName: str, attributes: OEStringVector,
            vals: OEStringVector) -> bool

Sets OECIFCategory information in this object.

SetData

SetData(categoryName: str, attribute: str,
        newValues: OEStringVector) -> bool
SetData(categoryName: str, attribute: str, row: int, newValue: str,
        init: str = "?") -> bool
SetData(categoryName: str, row: int, newValues: OEStringVector,
        init: str = "?") -> bool

Sets attribute and row data on the indicated category.

SetMMCIFChemCompData

SetMMCIFChemCompData(mol: Union[OEGraphMol,OEMol,OEQMol],
                     chemCompMol: Union[OEGraphMol,OEMol,OEQMol],
                     strict: bool = False) -> bool

Updates _chem_comp sections in the mmCIF header metadata with information from the input chemCompMol molecule. First, a single-residue chemCompMol is checked to name match with a residue in the molecule. The chemCompMol atom and bond data is then used to replace the _chem_comp header data for a similarly named residue in the mol. If strict is used, an additional check for atom name matching is made between the matched residue in the molecule and the chemCompMol.

The following categories need to be present and properly populated in the input molecules header for this function. If any attributes are missing, running OEUpdateMMCIFData with ChemComp perception should populate any missing attributes:

  • _chem_comp.

  • _chem_comp_atom.

  • _chem_comp_bond.

If the molecule already exists, it will replace all chemical component reference of that molecule with the new molecule. By default, residue atom name matching is enforced. If strict is turned off, an OESubSearch is used to identify structural similarity with the new molecule. If a match is found, the matching structure atom names will be used in the _chem_comp atom naming scheme.

Update

Update(mol: Union[OEGraphMol,OEMol,OEQMol], opts: OECIFOptions) -> bool

Coordinates the molecule’s structural and residue data with related information found in the header. Where there are disagreements, the molecule’s data overrides the header data. Because updating can affect many parts of the header, to control what parts are and are not updated, the OECIFOptions class indicates which parts of the header will be perceived during the update.

This function can be used to convert PDB header data into CIF header data. Create an OECIFData object using the PDB molecule and run Update(). Only perceivable fields in the molecule’s structure data will be populated.

ValidateMMCIFHeader

ValidateMMCIFHeader(allowErrors: bool = False, strict: bool = False) -> bool

Validates self-consistency within a mmCIF header. Many items will reference each other and this function runs checks to see if some of these are consistent with each other. Item entries that are checked include:

  • _entity.

  • _entity_poly.

  • _entity_poly_seq.

  • _chem_comp.

  • _struct_asym.

The strict flag will explore more parts of the header and enforce a wider range of requirements:

  • Any ‘entry_id’ value reference must match an already defined ‘_entry.id’

  • Any ‘entity_id’ value reference must match an already defined ‘_entity.id’

  • An expression system has been identified (_entity_src_gen., _entity_src_nat., _entity_src_syn.)

  • _chem_comp_atom.

  • _chem_comp_bond.

  • _struct_ref.

  • _struct_ref_seq.

ValidateMMCIFMol

ValidateMMCIFMol(mol: Union[OEGraphMol,OEMol,OEQMol],
                 allowErrors: bool = False, strict: bool = False) -> bool

Validates self-consistency between the header and mol reference. Item entries that are checked against the input molecule include:

  • _entity.

  • _chem_comp.

  • _struct_asym.

The strict flag will explore more parts of the header and enforce a wider range of requirements against the input molecule:

  • strict _entity. header validation

  • _pdbx_poly_seq_scheme.