本文整理汇总了C++中openbabel::OBMol::DeleteData方法的典型用法代码示例。如果您正苦于以下问题:C++ OBMol::DeleteData方法的具体用法?C++ OBMol::DeleteData怎么用?C++ OBMol::DeleteData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openbabel::OBMol
的用法示例。
在下文中一共展示了OBMol::DeleteData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Counter
Calculator::Calculate(Options* o, const std::vector<Scaffold*>& scaffolds)
{
Counter counter;
Scaffold* s;
// Print title line
if (o->OutFilename().empty())
{
std::cout << "NAME\tMOLECULE";
}
else
{
*(o->OutStream()) << "NAME\tMOLECULE";
}
for (unsigned int i(0); i < scaffolds.size(); ++i)
{
s = dynamic_cast<Scaffold*>(scaffolds[i]);
if (o->OutFilename().empty())
{
std::cout << "\t" << s->PrintName();
}
else
{
*(o->OutStream()) << "\t" << s->PrintName();
}
}
if (o->OutFilename().empty())
{
std::cout << std::endl;
}
else
{
*(o->OutStream()) << std::endl;
}
// Process molecules
OpenBabel::OBMol mol;
std::string title;
OpenBabel::OBConversion mol2can;
mol2can.SetOutFormat("can");
mol2can.AddOption("n", OpenBabel::OBConversion::OUTOPTIONS);
// first set the stream (needed in case of a zip stream)
o->InputConverter()->SetInStream(o->InputStream());
while (o->InputConverter()->Read(&mol))
{
// Drop stereo information
mol.DeleteData(OpenBabel::OBGenericDataType::StereoData);
// Extract a suitable title from molecule
counter.NewMolecule();
title.clear();
title = mol.GetTitle();
if (title == "")
{
mol.SetTitle(mol2can.WriteString(&mol, true).c_str());
}
if (o->OutFilename().empty())
{
std::cout << mol.GetTitle();
}
else
{
*(o->OutStream()) << mol.GetTitle();
}
// Print smiles
if (o->OutFilename().empty())
{
std::cout << "\t" << mol2can.WriteString(&mol, true);
}
else
{
*(o->OutStream()) << "\t" << mol2can.WriteString(&mol, true);
}
// Extract scaffolds
for (unsigned int i(0); i < scaffolds.size(); ++i)
{
s = dynamic_cast<Scaffold*>(scaffolds[i]);
if (s->CalculateScaffold(mol, o))
{
counter.NewScaffold();
}
else
{
counter.FailedScaffold();
}
if (o->OutFilename().empty())
{
std::cout << "\t" << s->PrintScaffold();
}
else
{
*(o->OutStream()) << "\t" << s->PrintScaffold();
}
}
if (o->OutFilename().empty())
{
//.........这里部分代码省略.........