|
An Information Portal to Biological Macromolecular Structures |
||
|
PDB Home |
Contact Us |
Software Tools Home | Dictionary Home | PDBML Home | DICT-OBJ-FILE Home | |
----------------CIF Loader/Builder Usage Examples-------------
1. Reading the content of a dictionary file and converting to dictionary object file.
2. Reading the dictionary object file and accessing its data
#include "CifLoadReorganizer.h"
/*
** Example 1: How to read the content of a dictionary file and
** convert it to dictionary object file.
*/
// The (absolute or relative) name of the dictionary file should be
// stored in dictFileName
string dictFileName;
// The (absolute or relative) name of the DDL file should be
// stored in ddlFileName
string ddlFileName;
// The (absolute or relative) name of the dictionary object file should be
// stored in dictObjFileName
string dictObjFileName;
// Create dictionary object
DictFileCont dictFileCont(dictObjFileName, dictFileName, ddlFileName);
// Initialize dictionary object (this will also parse and process the
// dictionary)
dictFileCont.Init();
// Write out the dictionary object file (with the name dictObjFileName)
dictFileCont.Write();
/*
** Example 2: How to read the content of a dictionary object file and
** access its data.
*/
// The (absolute or relative) name of the dictionary object file should be
// stored in dictObjFileName
string dictObjFileName;
// The name of the dictionary (block)
string dictName;
// Item name
string itemName;
// Create dictionary object file object
DictFileCont dictFileCont(dictObjFileName);
// Read the dictonary object file
dictFileCont.Read();
// Indicate that dictName dictionary is to be used from the file.
dictFileCont.SetCurrentDictionary(dictName);
// Get access to the above dictionary
DdlDictCont* ddlDictContP = dictFileCont.GetCurrDictCont();
// Get and print dictionary title
vector<string> title;
ddlDictContP->GetDdlItem(title, DdlContInfo::CIF_DDL_CATEGORY_DICTIONARY,
DdlContInfo::CIF_DDL_ITEM_TITLE);
cout << "Dictionary " << dictName << "\'s title: " << title << endl;
// Get access to an item
DdlCont* itemContP = ddlDictContP->GetDdlCont(itemName, RcsbDdlItem);
// Get and print item's construct
vector<string> construct;
itemContP->GetDdlItem(construct,
DdlContInfo::CIF_DDL_CATEGORY_ITEM_TYPE_LIST,
DdlContInfo::CIF_DDL_ITEM_CONSTRUCT);
cout << "Item: " << itemName << "\'s construct: " << construct << endl;