File: TautomerQueryTests.java

package info (click to toggle)
rdkit 202503.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 220,160 kB
  • sloc: cpp: 399,240; python: 77,453; ansic: 25,517; java: 8,173; javascript: 4,005; sql: 2,389; yacc: 1,565; lex: 1,263; cs: 1,081; makefile: 580; xml: 229; fortran: 183; sh: 105
file content (59 lines) | stat: -rw-r--r-- 2,099 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

//
// Created by Gareth Jones on 6/1/2020.
//
// Copyright 2020 Schrodinger, Inc
//  @@ All Rights Reserved @@
//  This file is part of the RDKit.
//  The contents are covered by the terms of the BSD license
//  which is included in the file license.txt, found at the root
//  of the RDKit source tree.


package org.RDKit;

import static org.junit.Assert.*;
import org.junit.Test;

public class TautomerQueryTests extends  GraphMolTest {

    @Test
    public void basicOperations() {
        RWMol mol = RWMol.MolFromSmiles("O=C1CCCCC1");
        TautomerQuery tautomerQuery = TautomerQuery.fromMol(mol);
        assertEquals(2, tautomerQuery.getTautomers().size());
        Sizet_Vect modifiedAtoms = tautomerQuery.getModifiedAtoms();
        assertEquals(3, modifiedAtoms.size());


        RWMol target = RWMol.MolFromSmiles("OC1=CCCC(CC)C1");
        boolean match = tautomerQuery.isSubstructOf(target);
        assertTrue(match);
        Match_Vect_Vect allMatches = tautomerQuery.substructOf(target);
        assertEquals(1, allMatches.size());
        Match_Vect atomMatches = allMatches.get(0);
        assertEquals(7, atomMatches.size());

        SubstructMatchParameters params = new SubstructMatchParameters();
        ROMol_Vect matchingTautomers = new ROMol_Vect();
        allMatches = tautomerQuery.substructOf(target, params, matchingTautomers);
        assertEquals(1, allMatches.size());
        assertEquals(1, matchingTautomers.size());

        match = target.hasSubstructMatch(matchingTautomers.get(0));
        assertTrue(match);

        ExplicitBitVect tautomerFingerprint = tautomerQuery.patternFingerprintTemplate();
        ExplicitBitVect targetFingerprint = TautomerQuery.patternFingerprintTarget(target);
        boolean matchingFingerprints =  RDKFuncs.AllProbeBitsMatch(tautomerFingerprint, targetFingerprint);
        assertTrue(matchingFingerprints);

        tautomerFingerprint.delete();
        targetFingerprint.delete();
    }

    public static void main(String args[]) {
        org.junit.runner.JUnitCore.main("org.RDKit.TautomerQueryTests");
    }

}