haneulpark commited on
Commit
d68447d
1 Parent(s): a46dca5

Upload 4 files

Browse files
preprocessing scripts/Firefly Luciferase Interference_ preprocessing script.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 1. Load Modules
2
+
3
+ pip install rdkit
4
+ pip install molvs
5
+ import pandas as pd
6
+ import numpy as np
7
+ import rdkit
8
+ import molvs
9
+ from rdkit import Chem
10
+
11
+ standardizer = molvs.Standardizer()
12
+ fragment_remover = molvs.fragment.FragmentRemover()
13
+
14
+
15
+ # 2. Convert the SDF file from the original paper into data frame
16
+ # Before running the code, please download SDF files from the original paper
17
+ # https://pubs.acs.org/doi/10.1021/acs.jmedchem.3c00482
18
+
19
+ from rdkit.Chem import PandasTools
20
+ sdfFile = 'Firefly_Luciferase_counter_assay_training_set_curated.sdf'
21
+ dataframe = PandasTools.LoadSDF(sdfFile)
22
+ dataframe.to_csv('Firefly_Luciferase.csv', index=False)
23
+ df = pd.read_csv('Firefly_Luciferase.csv')
24
+
25
+ # 3. Resolve SMILES parse error
26
+ # Some of the 'Raw_SMILES' rows contain TWO SMILES separated by ';'' and, they cause SMILES parse error (which means they cannot be read)
27
+ # So we separated the SMILES and renamed the columns
28
+
29
+ df.rename(columns = {'PUBCHEM_EXT_DATASOURCE_REGID': 'REGID_1'}, inplace = True)
30
+ df.rename(columns = {'Other REGIDs': 'REGID_2'}, inplace = True)
31
+
32
+ df.insert(2, 'REGID_3', np.NaN)
33
+
34
+ df['REGID_3'] = df['REGID_2'].str.split(',').str[1]
35
+ df['REGID_2'] = df['REGID_2'].str.split(',').str[0]
36
+
37
+ df.insert(4, 'SMILES_2', np.NaN)
38
+ df.insert(5, 'SMILES_3', np.NaN)
39
+
40
+ df[['Raw_SMILES', 'SMILES_2', 'SMILES_3']] = df['Raw_SMILES'].str.split(';', expand=True)
41
+
42
+ df.rename(columns= {'Raw_SMILES' : 'SMILES_1'}, inplace = True)
43
+
44
+ # 4. Sanitize with MolVS and print problems
45
+
46
+ df['X_1'] = [ \
47
+ rdkit.Chem.MolToSmiles(
48
+ fragment_remover.remove(
49
+ standardizer.standardize(
50
+ rdkit.Chem.MolFromSmiles(
51
+ smiles))))
52
+ for smiles in df['SMILES_1']]
53
+
54
+ def process_smiles(smiles):
55
+ if pd.isna(smiles):
56
+ return None
57
+ try:
58
+ return rdkit.Chem.MolToSmiles(
59
+ fragment_remover.remove(
60
+ standardizer.standardize(
61
+ rdkit.Chem.MolFromSmiles(smiles))))
62
+ except Exception as e:
63
+ print(f"Error processing SMILES {smiles}: {e}")
64
+ return None
65
+
66
+ df['X_2'] = df['SMILES_2'].apply(process_smiles)
67
+
68
+ def process_smiles(smiles):
69
+ if pd.isna(smiles):
70
+ return None
71
+ try:
72
+ return rdkit.Chem.MolToSmiles(
73
+ fragment_remover.remove(
74
+ standardizer.standardize(
75
+ rdkit.Chem.MolFromSmiles(smiles))))
76
+ except Exception as e:
77
+ print(f"Error processing SMILES {smiles}: {e}")
78
+ return None
79
+
80
+ df['X_3'] = df['SMILES_3'].apply(process_smiles)
81
+
82
+
83
+ # 5. Rename the columns
84
+
85
+ df.rename(columns={'X_1' : 'newSMILES_1', 'X_2' : 'newSMILES_2', 'X_3' : 'newSMILES_3'}, inplace = True)
86
+
87
+ # 6. Create a file with sanitized SMILES
88
+
89
+ df[['REGID_1',
90
+ 'REGID_2',
91
+ 'REGID_3',
92
+ 'newSMILES_1',
93
+ 'newSMILES_2',
94
+ 'newSMILES_3',
95
+ 'log_AC50_M',
96
+ 'Efficacy',
97
+ 'CC-v2',
98
+ 'Outcome',
99
+ 'InChIKey',
100
+ 'ID',
101
+ 'ROMol']].to_csv('Firefly Luciferase_sanitized.csv', index = False)
102
+
preprocessing scripts/MSTI Thiol Interference_preprocessing script.py ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 1. Load Modules
2
+
3
+ pip install rdkit
4
+ pip install molvs
5
+ import pandas as pd
6
+ import numpy as np
7
+ import rdkit
8
+ import molvs
9
+ from rdkit import Chem
10
+
11
+ standardizer = molvs.Standardizer()
12
+ fragment_remover = molvs.fragment.FragmentRemover()
13
+
14
+
15
+ # 2. Convert the SDF file from the original paper into data frame
16
+ # Before running the code, please download SDF files from the original paper
17
+ # https://pubs.acs.org/doi/10.1021/acs.jmedchem.3c00482
18
+
19
+ from rdkit.Chem import PandasTools
20
+ sdfFile = 'Thiol_training_set_curated.sdf'
21
+ dataframe = PandasTools.LoadSDF(sdfFile)
22
+ dataframe.to_csv('thiol.csv', index=False)
23
+ df = pd.read_csv('thiol.csv')
24
+
25
+
26
+ # 3. Resolve SMILES parse error
27
+ # Some of the 'Raw_SMILES' rows contain TWO SMILES separated by ';'' and, they cause SMILES parse error (which means they cannot be read)
28
+ # So we separated the SMILES and renamed the columns
29
+
30
+ df.rename(columns = {'PUBCHEM_EXT_DATASOURCE_REGID': 'REGID_1'}, inplace = True)
31
+ df.rename(columns = {'Other REGIDs': 'REGID_2'}, inplace = True)
32
+
33
+ df.insert(2, 'REGID_3', np.NaN)
34
+
35
+ df['REGID_3'] = df['REGID_2'].str.split(',').str[1]
36
+ df['REGID_2'] = df['REGID_2'].str.split(',').str[0]
37
+
38
+ df.insert(4, 'SMILES_2', np.NaN)
39
+ df.insert(5, 'SMILES_3', np.NaN)
40
+
41
+ df[['Raw_SMILES', 'SMILES_2', 'SMILES_3']] = df['Raw_SMILES'].str.split(';', expand=True)
42
+
43
+ df.rename(columns= {'Raw_SMILES' : 'SMILES_1'}, inplace = True)
44
+
45
+
46
+ # 4. Sanitize with MolVS and print problems
47
+
48
+ df['X_1'] = [ \
49
+ rdkit.Chem.MolToSmiles(
50
+ fragment_remover.remove(
51
+ standardizer.standardize(
52
+ rdkit.Chem.MolFromSmiles(
53
+ smiles))))
54
+ for smiles in df['SMILES_1']]
55
+
56
+ def process_smiles(smiles):
57
+ if pd.isna(smiles):
58
+ return None
59
+ try:
60
+ return rdkit.Chem.MolToSmiles(
61
+ fragment_remover.remove(
62
+ standardizer.standardize(
63
+ rdkit.Chem.MolFromSmiles(smiles))))
64
+ except Exception as e:
65
+ print(f"Error processing SMILES {smiles}: {e}")
66
+ return None
67
+
68
+ df['X_2'] = df['SMILES_2'].apply(process_smiles)
69
+
70
+ def process_smiles(smiles):
71
+ if pd.isna(smiles):
72
+ return None
73
+ try:
74
+ return rdkit.Chem.MolToSmiles(
75
+ fragment_remover.remove(
76
+ standardizer.standardize(
77
+ rdkit.Chem.MolFromSmiles(smiles))))
78
+ except Exception as e:
79
+ print(f"Error processing SMILES {smiles}: {e}")
80
+ return None
81
+
82
+ df['X_3'] = df['SMILES_3'].apply(process_smiles)
83
+
84
+
85
+ # 5. Rename the columns
86
+
87
+ df.rename(columns={'X_1' : 'newSMILES_1', 'X_2' : 'newSMILES_2', 'X_3' : 'newSMILES_3'}, inplace = True)
88
+
89
+
90
+ # 6. Create a file with sanitized SMILES
91
+
92
+ df[['REGID_1',
93
+ 'REGID_2',
94
+ 'REGID_3',
95
+ 'newSMILES_1',
96
+ 'newSMILES_2',
97
+ 'newSMILES_3',
98
+ 'log_AC50_M',
99
+ 'Efficacy',
100
+ 'CC-v2',
101
+ 'Outcome',
102
+ 'InChIKey',
103
+ 'ID',
104
+ 'ROMol']].to_csv('thiol_sanitized.csv', index = False)
preprocessing scripts/Nano Luciferase Interference_preprocessing script.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 1. Load Modules
2
+
3
+ pip install rdkit
4
+ pip install molvs
5
+ import pandas as pd
6
+ import numpy as np
7
+ import rdkit
8
+ import molvs
9
+ from rdkit import Chem
10
+
11
+ standardizer = molvs.Standardizer()
12
+ fragment_remover = molvs.fragment.FragmentRemover()
13
+
14
+
15
+ # 2. Convert the SDF file from the original paper into data frame
16
+ # Before running the code, please download SDF files from the original paper
17
+ # https://pubs.acs.org/doi/10.1021/acs.jmedchem.3c00482
18
+
19
+ from rdkit.Chem import PandasTools
20
+ sdfFile = 'Nano_Luciferase_counter_assay_training_set_curated.sdf'
21
+ dataframe = PandasTools.LoadSDF(sdfFile)
22
+ dataframe.to_csv('Nano_Luciferase.csv', index=False)
23
+ df = pd.read_csv('Nano_Luciferase.csv')
24
+
25
+ # 3. Resolve SMILES parse error
26
+ # Some of the 'Raw_SMILES' rows contain TWO SMILES separated by ';'' and, they cause SMILES parse error (which means they cannot be read)
27
+ # So we separated the SMILES and renamed the columns
28
+
29
+ df.rename(columns = {'PUBCHEM_EXT_DATASOURCE_REGID': 'REGID_1'}, inplace = True)
30
+ df.rename(columns = {'Other REGIDs': 'REGID_2'}, inplace = True)
31
+
32
+ df.insert(2, 'REGID_3', np.NaN)
33
+
34
+ df['REGID_3'] = df['REGID_2'].str.split(',').str[1]
35
+ df['REGID_2'] = df['REGID_2'].str.split(',').str[0]
36
+
37
+ df.insert(4, 'SMILES_2', np.NaN)
38
+ df.insert(5, 'SMILES_3', np.NaN)
39
+
40
+ df[['Raw_SMILES', 'SMILES_2', 'SMILES_3']] = df['Raw_SMILES'].str.split(';', expand=True)
41
+
42
+ df.rename(columns= {'Raw_SMILES' : 'SMILES_1'}, inplace = True)
43
+
44
+ # 4. Sanitize with MolVS and print problems
45
+
46
+ df['X_1'] = [ \
47
+ rdkit.Chem.MolToSmiles(
48
+ fragment_remover.remove(
49
+ standardizer.standardize(
50
+ rdkit.Chem.MolFromSmiles(
51
+ smiles))))
52
+ for smiles in df['SMILES_1']]
53
+
54
+ def process_smiles(smiles):
55
+ if pd.isna(smiles):
56
+ return None
57
+ try:
58
+ return rdkit.Chem.MolToSmiles(
59
+ fragment_remover.remove(
60
+ standardizer.standardize(
61
+ rdkit.Chem.MolFromSmiles(smiles))))
62
+ except Exception as e:
63
+ print(f"Error processing SMILES {smiles}: {e}")
64
+ return None
65
+
66
+ df['X_2'] = df['SMILES_2'].apply(process_smiles)
67
+
68
+ def process_smiles(smiles):
69
+ if pd.isna(smiles):
70
+ return None
71
+ try:
72
+ return rdkit.Chem.MolToSmiles(
73
+ fragment_remover.remove(
74
+ standardizer.standardize(
75
+ rdkit.Chem.MolFromSmiles(smiles))))
76
+ except Exception as e:
77
+ print(f"Error processing SMILES {smiles}: {e}")
78
+ return None
79
+
80
+ df['X_3'] = df['SMILES_3'].apply(process_smiles)
81
+
82
+
83
+ # 5. Rename the columns
84
+
85
+ df.rename(columns={'X_1' : 'newSMILES_1', 'X_2' : 'newSMILES_2', 'X_3' : 'newSMILES_3'}, inplace = True)
86
+
87
+ # 6. Create a file with sanitized SMILES
88
+
89
+ df[['REGID_1',
90
+ 'REGID_2',
91
+ 'REGID_3',
92
+ 'newSMILES_1',
93
+ 'newSMILES_2',
94
+ 'newSMILES_3',
95
+ 'log_AC50_M',
96
+ 'Efficacy',
97
+ 'CC-v2',
98
+ 'Outcome',
99
+ 'InChIKey',
100
+ 'ID',
101
+ 'ROMol']].to_csv('Nano Luciferase_sanitized.csv', index = False)
102
+
preprocessing scripts/REDOX Interference_ preprocessing script.py ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #1. Import modules
2
+
3
+ pip install rdkit
4
+ pip install molvs
5
+ import pandas as pd
6
+ import numpy as np
7
+ import rdkit
8
+ import molvs
9
+ from rdkit import Chem
10
+
11
+ standardizer = molvs.Standardizer()
12
+ fragment_remover = molvs.fragment.FragmentRemover()
13
+
14
+ # 2. Convert the SDF file from the original paper into data frame
15
+ # Before running the code, please download SDF files from the original paper
16
+ # https://pubs.acs.org/doi/10.1021/acs.jmedchem.3c00482
17
+
18
+ from rdkit.Chem import PandasTools
19
+ sdfFile = 'Redox_training_set_curated.sdf'
20
+ dataframe = PandasTools.LoadSDF(sdfFile)
21
+ dataframe.to_csv('redox.csv', index=False)
22
+ df = pd.read_csv('redox.csv')
23
+
24
+ # 3. Resolve SMILES parse error
25
+ # Some of the 'Raw_SMILES' rows contain TWO SMILES separated by ';'' and, they cause SMILES parse error (which means they cannot be read)
26
+ # So we separated the SMILES and renamed the columns
27
+
28
+ df.rename(columns = {'PUBCHEM_EXT_DATASOURCE_REGID': 'REGID_1'}, inplace = True)
29
+ df.rename(columns = {'Other REGIDs': 'REGID_2'}, inplace = True)
30
+
31
+ df.insert(3, 'SMILES_2', np.NaN)
32
+ df['SMILES_2'] = df['Raw_SMILES'].str.split(';').str[1]
33
+ df['Raw_SMILES'] = df['Raw_SMILES'].str.split(';').str[0]
34
+ df.rename(columns= {'Raw_SMILES' : 'SMILES_1'}, inplace = True)
35
+
36
+ df.insert(10, 'AC50_uM_2', np.NaN)
37
+ df['AC50_uM_2'] = df['AC50_uM'].str.split(';').str[1]
38
+ df['AC50_uM'] = df['AC50_uM'].str.split(';').str[0]
39
+ df.rename(columns = {'AC50_uM': 'AC50_uM_1'}, inplace = True)
40
+
41
+ # 4. Sanitize with MolVS and print problems
42
+
43
+ df['X_1'] = [ \
44
+ rdkit.Chem.MolToSmiles(
45
+ fragment_remover.remove(
46
+ standardizer.standardize(
47
+ rdkit.Chem.MolFromSmiles(
48
+ smiles))))
49
+ for smiles in df['SMILES_1']]
50
+
51
+ def process_smiles(smiles):
52
+ if pd.isna(smiles):
53
+ return None
54
+ try:
55
+ return rdkit.Chem.MolToSmiles(
56
+ fragment_remover.remove(
57
+ standardizer.standardize(
58
+ rdkit.Chem.MolFromSmiles(smiles))))
59
+ except Exception as e:
60
+ print(f"Error processing SMILES {smiles}: {e}")
61
+ return None
62
+
63
+ df['X_2'] = df['SMILES_2'].apply(process_smiles)
64
+
65
+ # 5. Rename the columns
66
+
67
+ df.rename(columns={'X_1' : 'newSMILES_1', 'X_2' : 'newSMILES_2'}, inplace = True)
68
+
69
+ # 6. Create a file with sanitized SMILES
70
+
71
+ df[['REGID_1',
72
+ 'REGID_2',
73
+ 'newSMILES_1',
74
+ 'newSMILES_2',
75
+ 'log_AC50_M',
76
+ 'Efficacy',
77
+ 'CC-v2',
78
+ 'Outcome',
79
+ 'InChIKey',
80
+ 'AC50_uM_1',
81
+ 'AC50_uM_2',
82
+ 'ID',
83
+ 'ROMol']].to_csv('redox_sanitized.csv', index = False)