当前位置: 首页>>代码示例>>C++>>正文


C++ ATOM_EQUALS_QUERY::getNegation方法代码示例

本文整理汇总了C++中ATOM_EQUALS_QUERY::getNegation方法的典型用法代码示例。如果您正苦于以下问题:C++ ATOM_EQUALS_QUERY::getNegation方法的具体用法?C++ ATOM_EQUALS_QUERY::getNegation怎么用?C++ ATOM_EQUALS_QUERY::getNegation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ATOM_EQUALS_QUERY的用法示例。


在下文中一共展示了ATOM_EQUALS_QUERY::getNegation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetAtomSmarts

std::string GetAtomSmarts(const QueryAtom *qatom) {
  PRECONDITION(qatom, "bad atom");
  std::string res;
  bool needParen = false;

  // BOOST_LOG(rdInfoLog)<<"Atom: " <<qatom->getIdx()<<std::endl;
  if (!qatom->hasQuery()) {
    res = getNonQueryAtomSmarts(qatom);
    // BOOST_LOG(rdInfoLog)<<"\tno query:" <<res;
    return res;
  }
  QueryAtom::QUERYATOM_QUERY *query = qatom->getQuery();
  // describeQuery(query);

  PRECONDITION(query, "atom has no query");
  std::string descrip = qatom->getQuery()->getDescription();
  if (descrip == "") {
    // we have simple atom - just generate the smiles and return
    res = SmilesWrite::GetAtomSmiles(qatom);
    if (res[0] == '[') {
      // chop the brackets off, we'll put them back on later:
      needParen = true;
      res = res.substr(1, res.size() - 2);
    }
  } else if ((descrip == "AtomOr") || (descrip == "AtomAnd")) {
    // we have a composite query
    needParen = true;
    res = _recurseGetSmarts(query, query->getNegation());
    if (res.length() == 1) {  // single atom symbol we don't need parens
      needParen = false;
    }
  } else if (descrip == "RecursiveStructure") {
    // it's a bare recursive structure query:
    res = getRecursiveStructureQuerySmarts(query);
    needParen = true;
  } else {  // we have a simple smarts
    ATOM_EQUALS_QUERY *tquery =
        static_cast<ATOM_EQUALS_QUERY *>(qatom->getQuery());
    res = getAtomSmartsSimple(tquery, needParen);
    if (tquery->getNegation()) {
      res = "!" + res;
    }
  }
  std::string mapNum;
  if (qatom->getPropIfPresent(common_properties::molAtomMapNumber, mapNum)) {
    needParen = true;
    res += ":" + mapNum;
  }
  if (needParen) {
    res = "[" + res + "]";
  }
  return res;
}
开发者ID:Richard-Hall,项目名称:rdkit,代码行数:53,代码来源:SmartsWrite.cpp


注:本文中的ATOM_EQUALS_QUERY::getNegation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。