Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
c-feldmann committed Oct 17, 2023
0 parents commit 92b7e14
Show file tree
Hide file tree
Showing 23 changed files with 88 additions and 0 deletions.
20 changes: 20 additions & 0 deletions data/pattern_penalties.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name,penalty
3_valent_halogen,100
3_valent_iodine,100
4_valent_sulphur_2_connections,100
6_membered_aromatic_sulfur,50
8_aminoquinoline,100
8_hydroxyquinoline,100
9_aminoacridine,100
acetal_1_in_ring,30
acetal_acyclic,100
acetal_both_in_ring,30
acetate_ester,100
acetylene,50
acetylene_heteroatom,100
acid_halide,100
activated_ester,100
activated_phthalimide,100
acyl_amide_acyclic,40
acyl_amide_cyclic,60
acyl_aromatic_nn,100
2 changes: 2 additions & 0 deletions data/queries/3_valent_halogen.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"[#9,#17,#35,#53;X3]"
2 changes: 2 additions & 0 deletions data/queries/3_valent_iodine.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"[#53;X3]"
2 changes: 2 additions & 0 deletions data/queries/4_valent_sulphur_2_connections.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"[SD2v4]"
2 changes: 2 additions & 0 deletions data/queries/6_membered_aromatic_sulfur.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"s1aaaaa1"
2 changes: 2 additions & 0 deletions data/queries/8_aminoquinoline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"[nD2H0]1c2c(-[ND2H])cccc2ccc1"
2 changes: 2 additions & 0 deletions data/queries/8_hydroxyquinoline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"[OD1]c1cccc2cccnc12"
2 changes: 2 additions & 0 deletions data/queries/9_aminoacridine
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"N-c1c2c([nH0]c3c1cccc3)cccc2"
2 changes: 2 additions & 0 deletions data/queries/acetal_1_in_ring.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"C[O,S;R1]C[O,S;R0]C"
2 changes: 2 additions & 0 deletions data/queries/acetal_acyclic.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"[#7,#8,#16;X2;!R]-[C;!R;X4]-[#7,#8,#16;X2;!R]"
2 changes: 2 additions & 0 deletions data/queries/acetal_both_in_ring.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
C[O,S;R1]C[O,S;R1]C
2 changes: 2 additions & 0 deletions data/queries/acetate_ester.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS min_hits_needed
"[#6]-[#8]-[#6;X3](-[#6;H3])=[#8]" 3
2 changes: 2 additions & 0 deletions data/queries/acetylene.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"C#C"
2 changes: 2 additions & 0 deletions data/queries/acetylene_heteroatom.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"[!#6]-C#C"
2 changes: 2 additions & 0 deletions data/queries/acid_halide.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"[#9,#17,#35,#53]-[C;X3]=O"
2 changes: 2 additions & 0 deletions data/queries/activated_ester.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"O=[#6,#15,#16;!R;X3,X4]-O-[#6,#15,#16]"
3 changes: 3 additions & 0 deletions data/queries/activated_phthalimide.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SMARTS
"O=C2c1ccc([F,Cl,Br,I,$(N(~[O;X1])-[O;X1]),$(C=O)])cc1C(=O)N2"
"O=C2c1cccc([F,Cl,Br,I,$(N(~[O;X1])-[O;X1]),$(C=O)])c1C(=O)N2"
2 changes: 2 additions & 0 deletions data/queries/acyl_amide_acyclic.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"[#8,#16;X1]=[C;!R]-[#7]-[C;!R]=[#8,#16;X1]"
2 changes: 2 additions & 0 deletions data/queries/acyl_amide_cyclic.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"[#8,#16;X1]=[C;R]-[#7]-[C;!R]=[#8,#16;X1]"
2 changes: 2 additions & 0 deletions data/queries/acyl_aromatic_nn.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SMARTS
"[O,S;X1]=[C;!R]-[n;r5;R1;X3]~[n;r5;R1;X2]"
Empty file.
Empty file added tests/__init__.py
Empty file.
29 changes: 29 additions & 0 deletions tests/test_smarts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import os
from pathlib import Path
import unittest

import pandas as pd
from rdkit import Chem


class CheckedSmarts(unittest.TestCase):
def test_validity(self):
data_path = Path(__file__).parents[1] / "data"
query_path = data_path / "queries"
checked_smarts = 0
for file in os.listdir(query_path):
smarts_df = pd.read_csv(query_path / file, sep="\t")
try:
smarts_list = smarts_df["SMARTS"].tolist()
except Exception as e:
print(file)
raise e
for smarts_str in smarts_list:
smarts_obj = Chem.MolFromSmarts(smarts_str)
self.assertIsNotNone(smarts_obj, file)
checked_smarts += 1
print(checked_smarts)


if __name__ == '__main__':
unittest.main()

0 comments on commit 92b7e14

Please sign in to comment.