📄 parsertest.java
字号:
assertEquals(5, m); } public void testPropertyr5() throws Exception { int m = match("[r5]", "C1C(C)=C(C=CC(C)=CC=CC(C)=CCO)C(C)(C)C1"); assertEquals(5, m); } public void testPropertyValence1() throws Exception { int m = match("[v4]", "C"); assertEquals(1, m); } public void testPropertyValence2() throws Exception { int m = match("[v4]", "CCO"); assertEquals(2, m); } public void testPropertyValence3() throws Exception { int m = match("[v4]", "[NH4+]"); assertEquals(1, m); } public void testPropertyValence4() throws Exception { int m = match("[v4]", "CC1(C)SC2C(NC(=O)Cc3ccccc3)C(=O)N2C1C(=O)O"); assertEquals(16, m); } public void testPropertyValence5() throws Exception { int m = match("[v4]", "[Cl-].[Cl-].NC(=O)c2cc[n+](COC[n+]1ccccc1C=NO)cc2"); assertEquals(16, m); } public void testPropertyX1() throws Exception { int m = match("[X2]", "CCO"); assertEquals(1, m); } public void testPropertyX2() throws Exception { int m = match("[X2]", "O"); assertEquals(1, m); } public void testPropertyX3() throws Exception { int m = match("[X2]", "CCC(=O)CC"); assertEquals(0, m); } public void testPropertyX4() throws Exception { int m = match("[X2]", "FC(Cl)=C=C(Cl)F"); assertEquals(1, m); } public void testPropertyX5() throws Exception { int m = match("[X2]", "COc1cc2c(ccnc2cc1)C(O)C4CC(CC3)C(C=C)CN34"); assertEquals(3, m); } public void testPropertyX6() throws Exception { int m = match("[X2]", "C123C5C(O)C=CC2C(N(C)CC1)Cc(ccc4O)c3c4O5"); assertEquals(3, m); } public void testPropertyHAtom1() throws Exception { int m = match("[H]", "[H+].[Cl-]"); assertEquals(1, m); } public void testPropertyHAtom2() throws Exception { int m = match("[H]", "[2H]"); assertEquals(1, m); } public void testPropertyHAtom3() throws Exception { int m = match("[H]", "[H][H]"); assertEquals(2, m); } public void testPropertyHAtom4() throws Exception { int m = match("[H]", "[CH4]"); assertEquals(0, m); } public void testPropertyHAtom5() throws Exception { int m = match("[H]", "[H]C([H])([H])[H]"); assertEquals(0, m); } public void testPropertyHTotal1() throws Exception { int m = match("[H1]", "CCO"); assertEquals(1, m); } public void testPropertyHTotal2() throws Exception { int m = match("[H1]", "[2H]C#C"); assertEquals(2, m); } public void testPropertyHTotal3() throws Exception { int m = match("[H1]", "[H]C(C)(C)C"); assertEquals(1, m); } public void testPropertyHTotal4() throws Exception { int m = match("[H1]", "COc1cc2c(ccnc2cc1)C(O)C4CC(CC3)C(C=C)CN34"); assertEquals(11, m); } public void testPropertyHTotal5() throws Exception { int m = match("[H1]", "C123C5C(O)C=CC2C(N(C)CC1)Cc(ccc4O)c3c4O5"); assertEquals(10, m); } public void testPropertyHTotal6() throws Exception { int m = match("[H1]", "[H][H]"); 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); } public void testBondStereo1() throws Exception { //TODO: Stereo bond not implemented in smiles parser? 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 testRing7() throws Exception { int m = match("c1ccccc1", "c1ccccc1"); assertEquals(12, m); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -