📄 smartsqueryvisitortest.java
字号:
assertEquals(2, m); } public void testPropertyAnyAtom1() throws Exception { int m = match("[*]", "C"); assertEquals(1, m); } public void testPropertyAnyAtom2() throws Exception { int m = match("[*]", "[2H]C"); assertEquals(2, m); } public void testPropertyAnyAtom3() throws Exception { int m = match("[*]", "[H][H]"); assertEquals(2, m); } public void testPropertyAnyAtom4() throws Exception { int m = match("[*]", "[1H]C([1H])([1H])[1H]"); assertEquals(5, m); } public void testBondSingle1() throws Exception { int m = match("CC", "C=C"); assertEquals(0, m); } public void testBondSingle2() throws Exception { int m = match("CC", "C#C"); assertEquals(0, m); } public void testBondSingle3() throws Exception { int m = match("CC", "CCO"); assertEquals(1, m); } public void testBondSingle4() throws Exception { int m = match("CC", "C1C(C)=C(C=CC(C)=CC=CC(C)=CCO)C(C)(C)C1"); assertEquals(14, m); } public void testBondSingle5() throws Exception { int m = match("CC", "CC1(C)SC2C(NC(=O)Cc3ccccc3)C(=O)N2C1C(=O)O"); assertEquals(7, m); } public void testBondAny1() throws Exception { int m = match("C~C", "C=C"); assertEquals(1, m); } public void testBondAny2() throws Exception { int m = match("C~C", "C#C"); assertEquals(1, m); } public void testBondAny3() throws Exception { int m = match("C~C", "CCO"); assertEquals(1, m); } public void testBondAny4() throws Exception { int m = match("C~C", "C1C(C)=C(C=CC(C)=CC=CC(C)=CCO)C(C)(C)C1"); assertEquals(19, m); } public void testBondAny5() throws Exception { int m = match("[C,c]~[C,c]", "CC1(C)SC2C(NC(=O)Cc3ccccc3)C(=O)N2C1C(=O)O"); assertEquals(14, m); } public void testBondRing1() throws Exception { int m = match("C@C", "C=C"); assertEquals(0, m); } public void testBondRing2() throws Exception { int m = match("C@C", "C#C"); assertEquals(0, m); } public void testBondRing3() throws Exception { int m = match("C@C", "C1CCCCC1"); assertEquals(6, m); } public void testBondRing4() throws Exception { int m = match("[C,c]@[C,c]", "c1ccccc1Cc1ccccc1"); assertEquals(12, m); } public void testBondRing5() throws Exception { int m = match("[C,c]@[C,c]", "CCN(CC)C(=O)C1CN(C)C2CC3=CNc(ccc4)c3c4C2=C1"); assertEquals(15, m); } public void testBondRing6() throws Exception { int m = match("[C,c]@[C,c]", "N12CCC36C1CC(C(C2)=CCOC4CC5=O)C4C3N5c7ccccc76"); assertEquals(22, m); } //TODO: Stereo bond not implemented in smiles parser? public void testBondStereo1() throws Exception { int m = match("F/?C=C/Cl", "F/C=C/Cl"); assertEquals(1, m); } public void testBondStereo2() throws Exception { int m = match("F/?C=C/Cl", "FC=C/Cl"); assertEquals(1, m); } public void testBondStereo3() throws Exception { int m = match("F/?C=C/Cl", "FC=CCl"); assertEquals(1, m); } public void testBondStereo4() throws Exception { int m = match("F/?C=C/Cl", "F\\C=C/Cl"); assertEquals(0, m); } public void testLogicalNot1() throws Exception { int m = match("[!c]", "c1cc(C)c(N)cc1"); assertEquals(2, m); } public void testLogicalNot2() throws Exception { int m = match("[!c]", "c1c(C)c(N)cnc1"); assertEquals(3, m); } public void testLogicalNot3() throws Exception { int m = match("[!c]", "c1(C)c(N)cco1"); assertEquals(3, m); } public void testLogicalNot4() throws Exception { int m = match("[!c]", "c1c(C)c(N)c[nH]1"); assertEquals(3, m); } public void testLogicalNot5() throws Exception { int m = match("[!c]", "O=n1ccccc1"); assertEquals(2, m); } public void testLogicalNot6() throws Exception { int m = match("[!c]", "[O-][n+]1ccccc1"); assertEquals(2, m); } public void testLogicalNot7() throws Exception { int m = match("[!c]", "c1ncccc1C1CCCN1C"); assertEquals(7, m); } public void testLogicalNot8() throws Exception { int m = match("[!c]", "c1ccccc1C(=O)OC2CC(N3C)CCC3C2C(=O)OC"); assertEquals(16, m); } public void testLogicalOr1() throws Exception { int m = match("[N,O,o]", "c1cc(C)c(N)cc1"); assertEquals(1, m); } public void testLogicalOr2() throws Exception { int m = match("[N,O,o]", "c1c(C)c(N)cnc1"); assertEquals(1, m); } public void testLogicalOr3() throws Exception { int m = match("[N,O,o]", "c1(C)c(N)cco1"); assertEquals(2, m); } public void testLogicalOr4() throws Exception { int m = match("[N,O,o]", "c1c(C)c(N)c[nH]1"); assertEquals(1, m); } public void testLogicalOr5() throws Exception { int m = match("[N,O,o]", "O=n1ccccc1"); assertEquals(1, m); } public void testLogicalOr6() throws Exception { int m = match("[N,O,o]", "[O-][n+]1ccccc1"); assertEquals(1, m); } public void testLogicalOr7() throws Exception { int m = match("[N,O,o]", "c1ncccc1C1CCCN1C"); assertEquals(1, m); } public void testLogicalOr8() throws Exception { int m = match("[N,O,o]", "c1ccccc1C(=O)OC2CC(N3C)CCC3C2C(=O)OC"); assertEquals(5, m); } public void testLogicalOrHighAnd1() throws Exception { int m = match("[N,#6&+1,+0]", "CCN(CC)C(=O)C1CN(C)C2CC3=CNc(ccc4)c3c4C2=C1"); assertEquals(24, m); } public void testLogicalOrHighAnd2() throws Exception { int m = match("[N,#6&+1,+0]", "N12CCC36C1CC(C(C2)=CCOC4CC5=O)C4C3N5c7ccccc76"); assertEquals(25, m); } public void testLogicalOrHighAnd3() throws Exception { int m = match("[N,#6&+1,+0]", "COc1cc2c(ccnc2cc1)C(O)C4CC(CC3)C(C=C)CN34"); assertEquals(24, m); } public void testLogicalOrHighAnd4() throws Exception { int m = match("[N,#6&+1,+0]", "C123C5C(O)C=CC2C(N(C)CC1)Cc(ccc4O)c3c4O5"); assertEquals(21, m); } public void testLogicalOrHighAnd5() throws Exception { int m = match("[N,#6&+1,+0]", "N1N([Hg-][O+]=C1N=Nc2ccccc2)c3ccccc3"); assertEquals(17, m); } /* public void testLogicalOrHighAnd6() throws Exception { //TODO: This takes a long time to match long start = Calendar.getInstance().getTimeInMillis(); //int m = match("[N,#6&+1,+0]", "[Na+].[Na+].[O-]C(=O)c1ccccc1c2c3ccc([O-])cc3oc4cc(=O)ccc24"); new SmilesParser(DefaultChemObjectBuilder.getInstance()); SMARTSParser.parse("[N,#6&+1,+0]"); long end = Calendar.getInstance().getTimeInMillis(); System.out.println( (end - start) ); //assertEquals(23, m); } */ public void testLogicalOrHighAnd7() throws Exception { int m = match("[N,#6&+1,+0]", "[Cl-].Clc1ccc([I+]c2cccs2)cc1"); assertEquals(12, m); } public void testLogicalOrLowAnd1() throws Exception { int m = match("[#7,C;+0,+1]", "CCN(CC)C(=O)C1CN(C)C2CC3=CNc(ccc4)c3c4C2=C1"); assertEquals(15, m); } public void testLogicalOrLowAnd2() throws Exception { int m = match("[#7,C;+0,+1]", "N12CCC36C1CC(C(C2)=CCOC4CC5=O)C4C3N5c7ccccc76"); assertEquals(17, m); } public void testLogicalOrLowAnd3() throws Exception { int m = match("[#7,C;+0,+1]", "COc1cc2c(ccnc2cc1)C(O)C4CC(CC3)C(C=C)CN34"); assertEquals(13, m); } public void testLogicalOrLowAnd4() throws Exception { int m = match("[#7,C;+0,+1]", "C123C5C(O)C=CC2C(N(C)CC1)Cc(ccc4O)c3c4O5"); assertEquals(12, m); } public void testLogicalOrLowAnd5() throws Exception { int m = match("[#7,C;+0,+1]", "N1N([Hg-][O+]=C1N=Nc2ccccc2)c3ccccc3"); assertEquals(5, m); } /* public void testLogicalOrLowAnd6() throws Exception { //TODO: this takes very long int m = match("[#7,C;+0,+1]", "[Na+].[Na+].[O-]C(=O)c1ccccc1c2c3ccc([O-])cc3oc4cc(=O)ccc24"); assertEquals(1, m); } */ public void testLogicalOrLowAnd7() throws Exception { int m = match("[#7,C;+0,+1]", "[Cl-].Clc1ccc([I+]c2cccs2)cc1"); assertEquals(0, m); } public void testRing1() throws Exception { int m = match("C1CCCCC1", "C1CCCCC1CCCC"); assertEquals(12, m); } public void testRing2() throws Exception { int m = match("C1CCCCC1", "C1CCCCC1C1CCCCC1"); assertEquals(24, m); } public void testRing3() throws Exception { int m = match("C1CCCCC1", "C1CCCC12CCCCC2"); assertEquals(12, m); } public void testRing4() throws Exception { int m = match("C1CCCCC1", "c1ccccc1O"); assertEquals(0, m); } public void testRing5() throws Exception { int m = match("C1CCCCC1", "c1ccccc1CCCCCC"); assertEquals(0, m); } public void testRing6() throws Exception { int m = match("C1CCCCC1", "CCCCCC"); assertEquals(0, m); } public void testAromaticRing1() throws Exception { int m = match("c1ccccc1", "c1ccccc1"); assertEquals(12, m); } public void testAromaticRing2() throws Exception { int m = match("c1ccccc1", "c1cccc2c1cccc2"); assertEquals(24, m); } public void testAromaticRing3() throws Exception { int m = match("c1ccccn1", "c1cccc2c1cccc2"); assertEquals(0, m); } public void testAromaticRing4() throws Exception { int m = match("c1ccccn1", "c1cccc2c1cccn2"); assertEquals(2, m); } /* * Testing amino acides matching. AA smarts from Daylight smarts example page */ public void testAminoAcid1() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(C)C(O)=O"); assertEquals(1, m); } public void testAminoAcid2() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CCCNC(N)=N)C(O)=O"); assertEquals(1, m); } public void testAminoAcid3() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CC(N)=O)C(O)=O"); assertEquals(1, m); } public void testAminoAcid4() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CC(O)=O)C(O)=O"); assertEquals(1, m); } public void testAminoAcid5() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CS)C(O)=O"); assertEquals(1, m); } public void testAminoAcid6() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CCC(N)=O)C(O)=O"); assertEquals(1, m); } public void testAminoAcid7() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CCC(O)=O)C(O)=O"); assertEquals(1, m); } public void testAminoAcid8() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC([H])C(O)=O"); assertEquals(0, m); } public void testAminoAcid9() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CC1=CNC=N1)C(O)=O"); assertEquals(1, m); } public void testAminoAcid10() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(C(CC)C)C(O)=O"); assertEquals(1, m); } public void testAminoAcid11() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CC(C)C)C(O)=O"); assertEquals(1, m); } public void testAminoAcid12() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CCCCN)C(O)=O"); assertEquals(1, m); } public void testAminoAcid13() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CCSC)C(O)=O"); assertEquals(1, m); } public void testAminoAcid14() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CC1=CC=CC=C1)C(O)=O"); assertEquals(1, m); } public void testAminoAcid15() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "OC(C1CCCN1)=O"); assertEquals(1, m); } public void testAminoAcid16() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CO)C(O)=O"); assertEquals(1, m); } public void testAminoAcid17() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(C(C)O)C(O)=O"); assertEquals(1, m); } public void testAminoAcid18() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CC1=CNC2=C1C=CC=C2)C(O)=O"); assertEquals(1, m); } public void testAminoAcid19() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(CC1=CC=C(O)C=C1)C(O)=O"); assertEquals(1, m); } public void testAminoAcid20() throws Exception { int m = match("[NX3,NX4+][CX4H]([*])[CX3](=[OX1])[O,N]", "NC(C(C)C)C(O)=O"); assertEquals(1, m); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -