Пример #1
0
  protected synchronized void prepareKeySequences(List<String> keys, int nKeys) {
    smartsKeys = keys;
    IQueryAtomContainer query;
    sequences.clear();
    smartsQueries.clear();
    SmartsParser parser = new SmartsParser();
    for (int i = 0; i < nKeys; i++) {
      query = parser.parse(smartsKeys.get(i));

      // parser.setNeededDataFlags();       --> This should not be needed for the key smarts queries
      isoTester.setQuery(query);
      List<QuerySequenceElement> sequence = isoTester.transferSequenceToOwner();
      sequences.add(sequence);
      smartsQueries.add(query);
    }
  }
Пример #2
0
  public void match(String smarts, String smiles) throws Exception {
    // Testing the algorithm via SmartsManager
    IMolecule mol = SmartsHelper.getMoleculeFromSmiles(smiles);
    man.setUseCDKIsomorphismTester(false);
    man.setQuery(smarts);
    boolResult = man.searchIn(mol);

    // Direct test of class IsomorphismTester
    IQueryAtomContainer query = sp.parse(smarts);
    sp.setNeededDataFlags();
    String errorMsg = sp.getErrorMessages();
    if (!errorMsg.equals("")) {
      System.out.println("Smarts Parser errors:\n" + errorMsg);
      return;
    }

    isoTester.setQuery(query);
    sp.setSMARTSData(mol);
    List<Integer> pos = isoTester.getIsomorphismPositions(mol);
    mappingPosCount = pos.size();
  }