File size: 5,490 Bytes
fc0d038
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
=== [BBBP] Verification started at 2026-01-06 12:41:09 ===
========================= Preprocessing BBBP =========================
  1. Download dataset from DeepChem
  2. Trim columns - keep only SMILES, label, and raw_ID
  3. Add embedding - ECFP or MolT5-{small, base, large}
  4. Split dataset - stratified for classification, random for regression
======================================================================

==================== Morgan Fingerprint Embedding ====================
Load `df_raw` from `raw_path`: ../MoleculeNetICL_SD-SPL/BBBP/raw.csv
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2050 entries, 0 to 2049
Data columns (total 4 columns):
 #   Column  Non-Null Count  Dtype 
---  ------  --------------  ----- 
 0   num     2050 non-null   int64 
 1   name    2050 non-null   object
 2   p_np    2050 non-null   int64 
 3   smiles  2050 non-null   object
dtypes: int64(2), object(2)
memory usage: 64.2+ KB
======================================================================
Load `df` from `trimmed_path`: ../MoleculeNetICL_SD-SPL/BBBP/trimmed.csv
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2040 entries, 0 to 2039
Data columns (total 4 columns):
 #   Column           Non-Null Count  Dtype 
---  ------           --------------  ----- 
 0   raw_ID           2040 non-null   int64 
 1   smiles           2040 non-null   object
 2   label            2040 non-null   int64 
 3   scaffold_smiles  1941 non-null   object
dtypes: int64(2), object(2)
memory usage: 63.9+ KB
======================================================================
Remove 10 rows due to empty SMILES, label or Scaffold SMILES
  >> 2040/2050 rows remaining after trimming
======================================================================
Load `embed` column (2040) from `embed_path`: ../MoleculeNetICL_SD-SPL/BBBP/embed_fp_r=2_b=1024.pk
======================================================================
Remove 0 rows due to empty embedding
2040/2040 rows remaining after trimming
======================================================================
Load split dfs from ../MoleculeNetICL_SD-SPL/BBBP
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1632 entries, 0 to 1631
Data columns (total 3 columns):
 #   Column  Non-Null Count  Dtype 
---  ------  --------------  ----- 
 0   raw_ID  1632 non-null   int64 
 1   smiles  1632 non-null   object
 2   label   1632 non-null   int64 
dtypes: int64(2), object(1)
memory usage: 38.4+ KB
======================================================================
# train = 1632
sample: {
  raw_ID: 1392
  smiles: C3=C(C2(C(N(CN1CCOCC1)C(C2)=O)=O)C)C=CC=C3
  label: 1
fp <class 'numpy.ndarray'>
  embed: (1024,) 
}

# valid = 204
sample: {
  raw_ID: 1979
  smiles: C1=CC=CC2=C1N(C3=C(S2)C=CC=C3)CC(C)N(C)C
  label: 1
  embed: (1024,) 
}

# test  = 204
sample: {
  raw_ID: 1450
  smiles: CC1OC(C)OC(O1)C
  label: 1
  embed: (1024,) 
}

======================================================================

======================= MolT5-small Embedding ========================
Load `df_raw` from `raw_path`: ../MoleculeNetICL_SD-SPL/BBBP/raw.csv
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2050 entries, 0 to 2049
Data columns (total 4 columns):
 #   Column  Non-Null Count  Dtype 
---  ------  --------------  ----- 
 0   num     2050 non-null   int64 
 1   name    2050 non-null   object
 2   p_np    2050 non-null   int64 
 3   smiles  2050 non-null   object
dtypes: int64(2), object(2)
memory usage: 64.2+ KB
======================================================================
Load `df` from `trimmed_path`: ../MoleculeNetICL_SD-SPL/BBBP/trimmed.csv
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2040 entries, 0 to 2039
Data columns (total 4 columns):
 #   Column           Non-Null Count  Dtype 
---  ------           --------------  ----- 
 0   raw_ID           2040 non-null   int64 
 1   smiles           2040 non-null   object
 2   label            2040 non-null   int64 
 3   scaffold_smiles  1941 non-null   object
dtypes: int64(2), object(2)
memory usage: 63.9+ KB
======================================================================
Remove 10 rows due to empty SMILES, label or Scaffold SMILES
  >> 2040/2050 rows remaining after trimming
======================================================================
Load `embed` column (2040) from `embed_path`: ../MoleculeNetICL_SD-SPL/BBBP/embed_molt5_small_d512.pt
Remove 0 rows due to empty embedding
2040/2040 rows remaining after trimming
======================================================================
Load split dfs from ../MoleculeNetICL_SD-SPL/BBBP
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1632 entries, 0 to 1631
Data columns (total 3 columns):
 #   Column  Non-Null Count  Dtype 
---  ------  --------------  ----- 
 0   raw_ID  1632 non-null   int64 
 1   smiles  1632 non-null   object
 2   label   1632 non-null   int64 
dtypes: int64(2), object(1)
memory usage: 38.4+ KB
======================================================================
# train = 1632
sample: {
  raw_ID: 1392
  smiles: C3=C(C2(C(N(CN1CCOCC1)C(C2)=O)=O)C)C=CC=C3
  label: 1
small <class 'torch.Tensor'>
  embed: torch.Size([512]) 
}

# valid = 204
sample: {
  raw_ID: 1979
  smiles: C1=CC=CC2=C1N(C3=C(S2)C=CC=C3)CC(C)N(C)C
  label: 1
  embed: torch.Size([512]) 
}

# test  = 204
sample: {
  raw_ID: 1450
  smiles: CC1OC(C)OC(O1)C
  label: 1
  embed: torch.Size([512]) 
}

======================================================================