Ejemplo n.º 1
0
bool MangoTautomer::matchBinary (Scanner &scanner)
{
   CmfLoader loader(_context.cmf_dict, scanner);
   
   loader.loadMolecule(_target);
   _initTarget(true);
   TautomerMethod m = RSMARTS;

   MoleculeTautomerMatcher matcher(_target, _params.substructure);

   matcher.setRulesList(&_context.tautomer_rules);
   matcher.setRules(_params.conditions, _params.force_hydrogens, _params.ring_chain, m);
   matcher.setQuery(_query.ref());

   profTimerStart(temb, "match.embedding");
   bool res = matcher.find();
   profTimerStop(temb);

   if (res)
   {
      profIncTimer("match.embedding_found", profTimerGetTime(temb));
   }
   else
   {
      profIncTimer("match.embedding_not_found", profTimerGetTime(temb));
   }
   return res;
}
Ejemplo n.º 2
0
void RingoFastIndex::_match (OracleEnv &env, int idx)
{
   _last_id = idx;

   BingoStorage &storage = this->_context.context().context().storage;
   QS_DEF(Array<char>, stored);
   
   storage.get(idx, stored);

   if (stored[0] != 0)
      return; // reaction was removed from index

   BufferScanner scanner(stored);

   scanner.skip(1); // skip the deletion mark
   scanner.skip(scanner.readByte()); // skip the compessed rowid
   
   profTimerStart(tall, "match");
   bool res = _context.substructure.matchBinary(scanner);
   profTimerStop(tall);
   
   if (res)
   {
      OraRowidText & rid = matched.at(matched.add());

      _decompressRowid(stored, rid);
      profIncTimer("match.found", profTimerGetTime(tall));
      _matched++;
   }
   else
   {
      profIncTimer("match.not_found", profTimerGetTime(tall));
      _unmatched++;
   }
}
Ejemplo n.º 3
0
bool MangoSubstructure::matchLoadedTarget ()
{
    MoleculeSubstructureMatcher matcher(_target);

    matcher.match_3d = match_3d;
    matcher.rms_threshold = rms_threshold;
    matcher.highlight = true;
    matcher.use_pi_systems_matcher = _use_pi_systems_matcher;
    matcher.setNeiCounters(&_nei_query_counters, &_nei_target_counters);
    matcher.fmcache = &_fmcache;

    _fmcache.clear();

    matcher.setQuery(_query);

    profTimerStart(temb, "match.embedding");
    bool res = matcher.find();
    profTimerStop(temb);

    if (res)
    {
        profIncTimer("match.embedding_found", profTimerGetTime(temb));
    }
    else
    {
        profIncTimer("match.embedding_not_found", profTimerGetTime(temb));
    }
    return res;
}
Ejemplo n.º 4
0
void MangoFastIndex::_match (OracleEnv &env, int idx)
{
   _last_id = idx;

   BingoStorage &storage = this->_context.context().context().storage;
   QS_DEF(Array<char>, stored);
   
   storage.get(idx, stored);

   if (stored[0] != 0)
      return; // molecule was removed from index

   BufferScanner scanner(stored);

   scanner.skip(1); // skip the deletion mark
   scanner.skip(scanner.readByte()); // skip the compessed rowid
   scanner.skip(2); // skip 'ord' bits count
   
   bool res = false;

   profTimerStart(tall, "match");
   if (_fetch_type == _SUBSTRUCTURE)
   {
      QS_DEF(Array<char>, xyz_buf);
      
      if (_context.substructure.needCoords())
      {
         OraRowidText rid;

         _decompressRowid(stored, rid);
         if (_loadCoords(env, rid.ptr(), xyz_buf))
         {
            BufferScanner xyz_scanner(xyz_buf);

            res = _context.substructure.matchBinary(scanner, &xyz_scanner);
         }
         else
            // no XYZ --> skip the molecule
            res = false;
      }
      else
         res = _context.substructure.matchBinary(scanner, 0);
   }
   else if (_fetch_type == _TAUTOMER_SUBSTRUCTURE)
      res = _context.tautomer.matchBinary(scanner);
   else // _fetch_type == _SIMILARITY
      res = _context.similarity.matchBinary(scanner);

   profTimerStop(tall);
   
   if (res)
   {
      OraRowidText & rid = matched.at(matched.add());

      _decompressRowid(stored, rid);

      profIncTimer("match.found", profTimerGetTime(tall));
      _matched++;
   }
   else
   {
      profIncTimer("match.not_found", profTimerGetTime(tall));
      _unmatched++;
   }
}