@@ -59,9 +59,9 @@ def get_writer(outfile_base):
59
59
global file_count
60
60
61
61
if not writer :
62
- writer = Chem .SDWriter (outfile_base + '_' + f'{ file_count :03 } ' + '.sdf' )
62
+ writer = Chem .SDWriter (outfile_base + '_' + f'{ file_count :04 } ' + '.sdf' )
63
63
64
- if write_count <= chunk_size :
64
+ if write_count < chunk_size :
65
65
# print(' Using existing writer for', id, writer)
66
66
return writer
67
67
@@ -73,7 +73,7 @@ def get_writer(outfile_base):
73
73
writer .close ()
74
74
file_count += 1
75
75
76
- writer = Chem .SDWriter (outfile_base + '_' + f'{ file_count :03 } ' + '.sdf' )
76
+ writer = Chem .SDWriter (outfile_base + '_' + f'{ file_count :04 } ' + '.sdf' )
77
77
#print(' Using new writer for', id, writer)
78
78
return writer
79
79
@@ -366,8 +366,6 @@ def execute(smi, hit_molfile, outfile_base, min_ph=None, max_ph=None, max_inputs
366
366
367
367
global write_count
368
368
369
- GetFF = lambda x ,confId = - 1 :AllChem .MMFFGetMoleculeForceField (x ,AllChem .MMFFGetMoleculeProperties (x ),confId = confId )
370
-
371
369
hit = Chem .MolFromMolFile (hit_molfile )
372
370
373
371
num_mols = 0
@@ -397,8 +395,6 @@ def execute(smi, hit_molfile, outfile_base, min_ph=None, max_ph=None, max_inputs
397
395
num_processed += 1
398
396
num_added = 0
399
397
400
- w = get_writer (outfile_base )
401
-
402
398
print ('Processing' , num_mols , num_processed , smiles , Chem .MolToSmiles (hit ))
403
399
404
400
try :
@@ -418,7 +414,6 @@ def execute(smi, hit_molfile, outfile_base, min_ph=None, max_ph=None, max_inputs
418
414
count = 0
419
415
for ligand in enumerated_mols :
420
416
molh = Chem .AddHs (ligand )
421
- # mol_match_tuple = MultiConstrainedEmbed(molh, queryMol, getForceField=GetFF)
422
417
mol_match_tuple = multi_constrained_embed (molh , hit , mcsQuery , timout_embed_secs = timout_embed_secs )
423
418
print (' ' , len (mol_match_tuple ), 'mols tethered' )
424
419
@@ -434,8 +429,10 @@ def execute(smi, hit_molfile, outfile_base, min_ph=None, max_ph=None, max_inputs
434
429
t_mol .SetProp ('TETHERED ATOMS' , tethers )
435
430
# print(' Tethers: ', tethers)
436
431
432
+ w = get_writer (outfile_base )
437
433
w .write (t_mol )
438
434
write_count += 1
435
+ print (' Write count =' , write_count )
439
436
num_outputs += 1
440
437
num_added += 1
441
438
0 commit comments