本文整理汇总了C++中BaseMolecule::isQueryMolecule方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseMolecule::isQueryMolecule方法的具体用法?C++ BaseMolecule::isQueryMolecule怎么用?C++ BaseMolecule::isQueryMolecule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseMolecule
的用法示例。
在下文中一共展示了BaseMolecule::isQueryMolecule方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getHCount
int MoleculeSavers::getHCount (BaseMolecule &mol, int index, int atom_number, int atom_charge)
{
int hydrogens_count = -1;
if (!mol.isRSite(index) && !mol.isPseudoAtom(index) && !mol.isTemplateAtom(index))
{
if (!mol.isQueryMolecule())
{
if (mol.getAtomAromaticity(index) == ATOM_AROMATIC &&
((atom_number != ELEM_C && atom_number != ELEM_O) || atom_charge != 0))
hydrogens_count = mol.asMolecule().getImplicitH_NoThrow(index, -1);
}
else
{
QueryMolecule::Atom &atom = mol.asQueryMolecule().getAtom(index);
if (!atom.sureValue(QueryMolecule::ATOM_TOTAL_H, hydrogens_count))
{
// Try to check if there are only one constraint
QueryMolecule::Atom *constraint = atom.sureConstraint(QueryMolecule::ATOM_TOTAL_H);
if (constraint != NULL)
hydrogens_count = constraint->value_min;
else
hydrogens_count = -1;
}
}
}
return hydrogens_count;
}
示例2: collect
void GrossFormula::collect (BaseMolecule &mol, Array<int> &gross)
{
int i;
gross.clear_resize(ELEM_MAX);
gross.zerofill();
for (i = mol.vertexBegin(); i < mol.vertexEnd(); i = mol.vertexNext(i))
{
if (mol.isPseudoAtom(i) || mol.isRSite(i))
continue;
int number = mol.getAtomNumber(i);
if (number > 0)
gross[number]++;
if (!mol.isQueryMolecule())
{
int implicit_h = mol.asMolecule().getImplicitH(i);
if (implicit_h >= 0)
gross[ELEM_H] += implicit_h;
}
}
}
示例3: markIgnoredHydrogens
void MoleculeSubstructureMatcher::markIgnoredHydrogens (BaseMolecule &mol, int *arr, int value_keep, int value_ignore)
{
int i;
for (i = mol.vertexBegin(); i != mol.vertexEnd(); i = mol.vertexNext(i))
arr[i] = value_keep;
for (i = mol.vertexBegin(); i != mol.vertexEnd(); i = mol.vertexNext(i))
{
if (mol.getAtomNumber(i) != ELEM_H)
continue;
if (!mol.possibleAtomIsotope(i, 0))
continue;
if (mol.isQueryMolecule())
{
// Check if atom has fragment constraint.
// For example [$([#1][N])] should be ignored
if (mol.asQueryMolecule().getAtom(i).hasConstraint(QueryMolecule::ATOM_FRAGMENT))
continue;
}
const Vertex &vertex = mol.getVertex(i);
if (vertex.degree() == 1)
{
int nei_idx = vertex.neiVertex(vertex.neiBegin());
if (mol.getAtomNumber(nei_idx) == ELEM_H && mol.possibleAtomIsotope(nei_idx, 0))
continue; // do not ignore rare H-H fragment
// Check if hydrogen forms a cis-trans bond or stereocenter
int nei_vertex_idx = vertex.neiVertex(vertex.neiBegin());
if (mol.stereocenters.exists(nei_vertex_idx))
continue;
// For example for this query hydrogens should be unfolded: [H]\\C=C/C
const Vertex &nei_vertex = mol.getVertex(nei_vertex_idx);
bool not_ignore = false;
for (int nei = nei_vertex.neiBegin(); nei != nei_vertex.neiEnd(); nei = nei_vertex.neiNext(nei))
{
int edge = nei_vertex.neiEdge(nei);
if (mol.cis_trans.getParity(edge) != 0)
{
not_ignore = true;
break;
}
}
if (not_ignore)
continue;
arr[i] = value_ignore;
}
}
}
示例4: sortSubstituents
bool MoleculeCisTrans::sortSubstituents (BaseMolecule &mol, int *substituents, bool *parity_changed)
{
bool e0 = substituents[0] < 0;
bool e1 = substituents[1] < 0;
bool e2 = substituents[2] < 0;
bool e3 = substituents[3] < 0;
if (e0 && e1)
return false;
if (e2 && e3)
return false;
bool h0 = !e0 && _pureH(mol, substituents[0]);
bool h1 = !e1 && _pureH(mol, substituents[1]);
bool h2 = !e2 && _pureH(mol, substituents[2]);
bool h3 = !e3 && _pureH(mol, substituents[3]);
// Query molecules [H]/C=C/C and [H]\C=C/C are different
// But normal molecules are the same.
if (!mol.isQueryMolecule())
{
// Handle [H]/N=C\C and [H]/N=C/C
if (!_commonHasLonePair(mol, substituents[0], substituents[1]))
{
h0 |= e0;
h1 |= e1;
}
if (!_commonHasLonePair(mol, substituents[2], substituents[3]))
{
h2 |= e2;
h3 |= e3;
}
}
if (h0 && h1)
return false;
if (h2 && h3)
return false;
int tmp;
// If hydrogens are explicit then keep them
// And do not place explicit hydrogens to the end, because all static methods
// should be converted into non-static with checking whether atom is hydrogen
// or not.
// For example, molecule [H]\C(O)=C/C can get invalid parity because static
// functions getMappingParitySign, applyMapping doesn't know about
bool swapped = false;
if (!e1)
if (e0 || substituents[0] > substituents[1])
{
__swap(substituents[0], substituents[1], tmp);
swapped = !swapped;
}
if (!e3)
if (e2 || substituents[2] > substituents[3])
{
__swap(substituents[2], substituents[3], tmp);
swapped = !swapped;
}
if (parity_changed != 0)
*parity_changed = swapped;
return true;
}
示例5: matchAtoms
bool MoleculeExactMatcher::matchAtoms (BaseMolecule& query, BaseMolecule& target, int sub_idx, int super_idx, int flags)
{
if (query.isRSite(sub_idx) && target.isRSite(super_idx))
return query.getRSiteBits(sub_idx) == target.getRSiteBits(super_idx);
if (query.isRSite(sub_idx) || target.isRSite(super_idx))
return false;
if (query.isPseudoAtom(sub_idx) && target.isPseudoAtom(super_idx))
{
if (strcmp(query.getPseudoAtom(sub_idx), target.getPseudoAtom(super_idx)) != 0)
return false;
}
else if (query.isTemplateAtom(sub_idx) && target.isTemplateAtom(super_idx))
{
if (strcmp(query.getTemplateAtom(sub_idx), target.getTemplateAtom(super_idx)) != 0)
return false;
}
else if (!query.isPseudoAtom(sub_idx) && !target.isPseudoAtom(super_idx) &&
!query.isTemplateAtom(sub_idx) && !target.isTemplateAtom(super_idx))
{
if (query.getAtomNumber(sub_idx) != target.getAtomNumber(super_idx))
return false;
}
else
return false;
if (flags & CONDITION_ISOTOPE)
if (query.getAtomIsotope(sub_idx) != target.getAtomIsotope(super_idx))
return false;
if (flags & CONDITION_ELECTRONS)
{
int qcharge = query.getAtomCharge(sub_idx);
int tcharge = target.getAtomCharge(super_idx);
if (qcharge == CHARGE_UNKNOWN)
qcharge = 0;
if (tcharge == CHARGE_UNKNOWN)
tcharge = 0;
if (qcharge != tcharge)
return false;
if (!query.isPseudoAtom(sub_idx) && !query.isTemplateAtom(sub_idx))
{
if (!query.isQueryMolecule() && !target.isQueryMolecule())
{
if (query.getAtomValence(sub_idx) != target.getAtomValence(super_idx))
return false;
}
int qrad = query.getAtomRadical(sub_idx);
int trad = target.getAtomRadical(super_idx);
if (qrad == -1)
qrad = 0;
if (trad == -1)
trad = 0;
if (qrad != trad)
return false;
if (query.isQueryMolecule())
{
int qarom = query.getAtomAromaticity(sub_idx);
int tarom = target.getAtomAromaticity(super_idx);
if (qarom != -1 && tarom != -1)
if (qarom != tarom)
return false;
}
}
}
if (flags & CONDITION_STEREO)
{
int qtype = query.stereocenters.getType(sub_idx);
if (qtype != target.stereocenters.getType(super_idx))
return false;
}
return true;
}