本文整理汇总了C++中OBMol::GetResidue方法的典型用法代码示例。如果您正苦于以下问题:C++ OBMol::GetResidue方法的具体用法?C++ OBMol::GetResidue怎么用?C++ OBMol::GetResidue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBMol
的用法示例。
在下文中一共展示了OBMol::GetResidue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckValidDipeptide
void CheckValidDipeptide(OBConversion &conv,
const string &test,
unsigned int testCount)
{
OBMol mol;
OBResidue *res;
ostringstream os;
mol.Clear();
conv.ReadString(&mol, test);
chainsparser.PerceiveChains(mol);
if (mol.NumResidues() != 2) {
os << "not ok " << testCount << " # expected 2 residues, but found "
<< mol.NumResidues() << '\n';
os << "# ";
FOR_RESIDUES_OF_MOL(res, mol)
os << res->GetName() << " ";
os << endl;
BOOST_CHECK_MESSAGE( 0, os.str().c_str() );
} else {
res = mol.GetResidue(0);
BOOST_CHECK_MESSAGE( res, "Get first AA from dipeptide" );
res = mol.GetResidue(1);
BOOST_CHECK_MESSAGE( res, "Get second AA from dipeptide" );
}
}
示例2: CheckValidDipeptide
void CheckValidDipeptide(OBConversion &conv,
const string &test,
unsigned int testCount)
{
OBMol mol;
mol.Clear();
conv.ReadString(&mol, test);
chainsparser.PerceiveChains(mol);
if (mol.NumResidues() != 2) {
cout << "not ok " << testCount << " # expected 2 residues, but found "
<< mol.NumResidues() << '\n';
cout << "# ";
FOR_RESIDUES_OF_MOL(res, mol)
cout << res->GetName() << " ";
cout << endl;
} else {
OBResidue *res;
res = mol.GetResidue(0);
cout << "ok " << testCount << " # " << res->GetName();
res = mol.GetResidue(1);
cout << " " << res->GetName() << '\n';
}
}
示例3: CheckInvalidResidue
void CheckInvalidResidue(OBConversion &conv,
const string &test,
unsigned int testCount)
{
OBMol mol;
mol.Clear();
conv.ReadString(&mol, test);
chainsparser.PerceiveChains(mol);
if (mol.NumResidues() != 0) {
OBResidue *res = mol.GetResidue(0);
if (res->GetName() == "LIG") { // ligand, not residue
cout << "ok " << testCount << " # found ligand, not residue "
<< test << '\n';
} else {
cout << "not ok " << testCount << " # expected 0 residues, found "
<< mol.NumResidues() << '\n';
cout << "# " << res->GetName() << endl;
}
} else
cout << "ok " << testCount << " # correctly rejected " << test << '\n';
}
示例4: CheckInvalidResidue
void CheckInvalidResidue(OBConversion &conv,
const string &test,
unsigned int testCount)
{
OBMol mol;
ostringstream os;
mol.Clear();
conv.ReadString(&mol, test);
chainsparser.PerceiveChains(mol);
if (mol.NumResidues() != 0) {
OBResidue *res = mol.GetResidue(0);
if (res->GetName() == "LIG") { // ligand, not residue
BOOST_CHECK( 1 );
} else {
os << "not ok " << testCount << " # expected 0 residues, found "
<< mol.NumResidues() << '\n';
os << "# " << res->GetName() << endl;
BOOST_CHECK_MESSAGE( 0, os.str().c_str() );
}
} else
BOOST_CHECK( 1 );
}
示例5: parseAtomRecord
//.........这里部分代码省略.........
resname == "GPG" || resname == "NAD" || resname == "NAL" ||
resname == "NDP" || resname == "ABA") {
if (type.size() > 1)
type = type.substr(0,1);
//type.erase(1,type.size()-1);
} else // other residues
if (isdigit(type[0])){
type = type.substr(1,1);
}
else
if (type.size() > 1 && isdigit(type[1]))
type = type.substr(0,1);
else
if (type.size() > 1 && isalpha(type[1])) {
if (type[0] == 'O' && type[1] == 'H')
type = type.substr(0,1); // no "Oh" element (e.g. 1MBN)
else if(isupper(type[1])) {
type[1] = tolower(type[1]);
}
}
}
} // HETATM records
} // no element column to use
OBAtom atom;
/* X, Y, Z */
string xstr = sbuf.substr(24,8);
string ystr = sbuf.substr(32,8);
string zstr = sbuf.substr(40,8);
vector3 v(atof(xstr.c_str()),atof(ystr.c_str()),atof(zstr.c_str()));
atom.SetVector(v);
atom.ForceImplH();
// useful for debugging unknown atom types (e.g., PR#1577238)
// cout << mol.NumAtoms() + 1 << " : '" << element << "'" << " " << etab.GetAtomicNum(element.c_str()) << endl;
if (elementFound)
atom.SetAtomicNum(etab.GetAtomicNum(element.c_str()));
else // use our old-style guess from athe atom type
atom.SetAtomicNum(etab.GetAtomicNum(type.c_str()));
if ( (! scharge.empty()) && " " != scharge )
{
if ( isdigit(scharge[0]) && ('+' == scharge[1] || '-' == scharge[1]) )
{
const char reorderCharge[3] = { scharge[1], scharge[0], '\0' };
const int charge = atoi(reorderCharge);
atom.SetFormalCharge(charge);
}
else
{
stringstream errorMsg;
errorMsg << "WARNING: Problems reading a PDB file\n"
<< " Problems reading a HETATM or ATOM record.\n"
<< " According to the PDB specification,\n"
<< " columns 79-80 should contain charge of the atom\n"
<< " but OpenBabel found '" << scharge << "' (atom " << mol.NumAtoms()+1 << ").";
obErrorLog.ThrowError(__FUNCTION__, errorMsg.str(), obWarning);
}
}
else {
atom.SetFormalCharge(0);
}
/* residue sequence number */
string resnum = sbuf.substr(16,4);
OBResidue *res = (mol.NumResidues() > 0) ? mol.GetResidue(mol.NumResidues()-1) : NULL;
if (res == NULL
|| res->GetName() != resname
|| res->GetNumString() != resnum
|| res->GetChain() != chain)
{
vector<OBResidue*>::iterator ri;
for (res = mol.BeginResidue(ri) ; res ; res = mol.NextResidue(ri))
if (res->GetName() == resname
&& res->GetNumString() == resnum
&& static_cast<int>(res->GetChain()) == chain)
break;
if (res == NULL) {
res = mol.NewResidue();
res->SetChain(chain);
res->SetName(resname);
res->SetNum(resnum);
}
}
if (!mol.AddAtom(atom))
return(false);
else {
OBAtom *atom = mol.GetAtom(mol.NumAtoms());
res->AddAtom(atom);
res->SetSerialNum(atom, atoi(serno.c_str()));
res->SetAtomID(atom, sbuf.substr(6,4));
res->SetHetAtom(atom, hetatm);
return(true);
}
} // end reading atom records