Skip to content

Commit 8563f24

Browse files
committed
tether generates fixed size files
1 parent a28b6f3 commit 8563f24

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/nextflow/xchem/featurestein.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ process joiner {
5959

6060
container 'informaticsmatters/rdkit_pipelines:latest'
6161

62-
publishDir ".", mode: 'move'
62+
publishDir ".", mode: 'link'
6363

6464
input:
6565
file parts from scored_parts.collect()

src/python/pipelines/xchem/prepare_tether.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ def get_writer(outfile_base):
5959
global file_count
6060

6161
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')
6363

64-
if write_count <= chunk_size:
64+
if write_count < chunk_size:
6565
# print(' Using existing writer for', id, writer)
6666
return writer
6767

@@ -73,7 +73,7 @@ def get_writer(outfile_base):
7373
writer.close()
7474
file_count += 1
7575

76-
writer = Chem.SDWriter(outfile_base + '_' + f'{file_count:03}' + '.sdf')
76+
writer = Chem.SDWriter(outfile_base + '_' + f'{file_count:04}' + '.sdf')
7777
#print(' Using new writer for', id, writer)
7878
return writer
7979

@@ -366,8 +366,6 @@ def execute(smi, hit_molfile, outfile_base, min_ph=None, max_ph=None, max_inputs
366366

367367
global write_count
368368

369-
GetFF=lambda x,confId=-1:AllChem.MMFFGetMoleculeForceField(x,AllChem.MMFFGetMoleculeProperties(x),confId=confId)
370-
371369
hit = Chem.MolFromMolFile(hit_molfile)
372370

373371
num_mols = 0
@@ -397,8 +395,6 @@ def execute(smi, hit_molfile, outfile_base, min_ph=None, max_ph=None, max_inputs
397395
num_processed += 1
398396
num_added = 0
399397

400-
w = get_writer(outfile_base)
401-
402398
print('Processing', num_mols, num_processed, smiles, Chem.MolToSmiles(hit))
403399

404400
try:
@@ -418,7 +414,6 @@ def execute(smi, hit_molfile, outfile_base, min_ph=None, max_ph=None, max_inputs
418414
count = 0
419415
for ligand in enumerated_mols:
420416
molh = Chem.AddHs(ligand)
421-
# mol_match_tuple = MultiConstrainedEmbed(molh, queryMol, getForceField=GetFF)
422417
mol_match_tuple = multi_constrained_embed(molh, hit, mcsQuery, timout_embed_secs=timout_embed_secs)
423418
print(' ', len(mol_match_tuple), 'mols tethered')
424419

@@ -434,8 +429,10 @@ def execute(smi, hit_molfile, outfile_base, min_ph=None, max_ph=None, max_inputs
434429
t_mol.SetProp('TETHERED ATOMS', tethers)
435430
# print(' Tethers: ', tethers)
436431

432+
w = get_writer(outfile_base)
437433
w.write(t_mol)
438434
write_count += 1
435+
print(' Write count =', write_count)
439436
num_outputs += 1
440437
num_added += 1
441438

0 commit comments

Comments
 (0)