File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,10 @@ type unfold_count_fp = { name: string;
124
124
feat_counts : int APM .t }
125
125
126
126
let fp_string_output writes mode out dict fp =
127
+ if APM. is_empty fp.feat_counts then
128
+ () (* skip molecules which failed encoding *)
129
+ else
130
+ begin
127
131
fprintf out " %s,0.0,[" fp.name;
128
132
let feat_counts = match mode with
129
133
| Output -> (* writable dict *)
@@ -159,11 +163,12 @@ let fp_string_output writes mode out dict fp =
159
163
) feat_counts;
160
164
fprintf out " ]\n " ;
161
165
incr writes
166
+ end
162
167
163
168
(* unfolded counted atom pairs fingerprint encoding *)
164
169
let encode_smiles_line max_dist simple_types line =
170
+ let smi, name = BatString. split ~by: " \t " line in
165
171
try
166
- let smi, name = BatString. split ~by: " \t " line in
167
172
let mol = Rdkit. __init__ ~smi () in
168
173
let n = Rdkit. get_num_atoms mol () in
169
174
let typer, type2int =
@@ -191,8 +196,8 @@ let encode_smiles_line max_dist simple_types line =
191
196
done ;
192
197
{ name; feat_counts = ! fp }
193
198
with Improper_atom ->
194
- let () = Log. fatal " Molenc_AP.encode_smiles_line: cannot encode: %s" line in
195
- exit 1
199
+ let () = Log. error " Molenc_AP.encode_smiles_line: cannot encode: %s" line in
200
+ { name; feat_counts = APM. empty }
196
201
197
202
let verbose = ref false
198
203
You can’t perform that action at this time.
0 commit comments