|
| 1 | +#!/usr/bin/env nextflow |
| 2 | + |
| 3 | +// splitter params |
| 4 | +params.chunk_size_expand = 200 |
| 5 | +params.limit = 0 |
| 6 | +params.digits = 4 |
| 7 | + |
| 8 | +// tether params |
| 9 | +params.smiles = '*.smi' |
| 10 | +params.molfiles = '*.mol' |
| 11 | +params.ph_min = null |
| 12 | +params.ph_max = null |
| 13 | +params.timeout_embed = null |
| 14 | +params.chunk_size_tether = null |
| 15 | + |
| 16 | +// docking params |
| 17 | +params.protein = 'data/mpro/Mpro-x0387_0.mol2' |
| 18 | +params.prmfile = 'data/mpro/docking-tethered.prm' |
| 19 | +params.asfile = 'data/mpro/docking-tethered.as' |
| 20 | +params.num_dockings = 5 |
| 21 | + |
| 22 | +// featurestein |
| 23 | +params.fragments = 'data/mpro/hits-23.sdf.gz' |
| 24 | + |
| 25 | +// files |
| 26 | +smiles = file(params.smiles) |
| 27 | +molfiles = file(params.molfiles) |
| 28 | +protein = file(params.protein) |
| 29 | +prmfile = file(params.prmfile) |
| 30 | +asfile = file(params.asfile) |
| 31 | +fragments = file(params.fragments) |
| 32 | + |
| 33 | + |
| 34 | +process splitter { |
| 35 | + |
| 36 | + container 'informaticsmatters/rdkit_pipelines:latest' |
| 37 | + |
| 38 | + input: |
| 39 | + file smiles from smiles.flatten() |
| 40 | + file mol from molfiles.flatten() |
| 41 | + |
| 42 | + output: |
| 43 | + file '*.mol' into split_mols |
| 44 | + file '*.smi' into split_smiles |
| 45 | + |
| 46 | + """ |
| 47 | + stem=${smiles.name[0..-5]} |
| 48 | + split -l $params.chunk_size_expand -d -a 3 --additional-suffix .smi $smiles \${stem}_ |
| 49 | + mv $smiles ${smiles}.orig |
| 50 | + for f in *.smi |
| 51 | + do |
| 52 | + cp $mol \${f:0:-4}.mol |
| 53 | + done |
| 54 | + mv $mol ${mol}.orig |
| 55 | + """ |
| 56 | +} |
| 57 | + |
| 58 | + |
| 59 | +process tether { |
| 60 | + |
| 61 | + container 'informaticsmatters/rdkit_pipelines:latest' |
| 62 | + |
| 63 | + input: |
| 64 | + file mol from split_mols.flatten() |
| 65 | + file smiles from split_smiles.flatten() |
| 66 | + |
| 67 | + output: |
| 68 | + file 'Tethered_*.sdf' into tethered_parts |
| 69 | + |
| 70 | + """ |
| 71 | + python -m pipelines.xchem.prepare_tether --smi '$smiles' --mol '$mol'\ |
| 72 | + ${params.ph_min != null ? '--min-ph ' + params.ph_min : ''}\ |
| 73 | + ${params.ph_max != null ? '--max-ph ' + params.ph_max : ''}\ |
| 74 | + ${params.timeout_embed != null ? '--timeout-embed ' + params.timeout_embed : ''}\ |
| 75 | + -o 'Tethered_${smiles.name[0..-5]}' |
| 76 | + """ |
| 77 | +} |
| 78 | + |
| 79 | +process rdock { |
| 80 | + |
| 81 | + container 'informaticsmatters/rdock-mini:latest' |
| 82 | + errorStrategy 'retry' |
| 83 | + maxRetries 3 |
| 84 | + |
| 85 | + input: |
| 86 | + file part from tethered_parts.flatten() |
| 87 | + file 'receptor.mol2' from protein |
| 88 | + file 'docking.prm' from prmfile |
| 89 | + file 'docking.as' from asfile |
| 90 | + |
| 91 | + output: |
| 92 | + file 'Docked_*.sd' into docked_parts |
| 93 | + |
| 94 | + """ |
| 95 | + rbdock -r $prmfile -p dock.prm -n $params.num_dockings -i $part -o ${part.name.replace('Tethered', 'Docked')[0..-5]} > docked_out.log |
| 96 | + """ |
| 97 | +} |
| 98 | + |
| 99 | +process gen_feat_maps { |
| 100 | + |
| 101 | + container 'informaticsmatters/rdkit_pipelines:latest' |
| 102 | + |
| 103 | + input: |
| 104 | + file fragments |
| 105 | + |
| 106 | + output: |
| 107 | + file 'featurestein.p' into fmaps |
| 108 | + |
| 109 | + """ |
| 110 | + python -m pipelines.xchem.featurestein_generate -i '$fragments' -f featurestein.p |
| 111 | + """ |
| 112 | +} |
| 113 | + |
| 114 | +process featurestein { |
| 115 | + |
| 116 | + container 'informaticsmatters/rdkit_pipelines:latest' |
| 117 | + |
| 118 | + input: |
| 119 | + file part from docked_parts |
| 120 | + file fmaps |
| 121 | + |
| 122 | + output: |
| 123 | + file 'FS_*.sdf' into featurestein_parts |
| 124 | + |
| 125 | + """ |
| 126 | + python -m pipelines.xchem.featurestein_score -i '$part' -if sdf -f '$fmaps' -o 'FS_${part.name[0..-4]}' -of sdf --no-gzip |
| 127 | + """ |
| 128 | +} |
| 129 | + |
| 130 | +process xcos { |
| 131 | + |
| 132 | + container 'informaticsmatters/rdkit_pipelines:latest' |
| 133 | + |
| 134 | + publishDir ".", mode: 'move' |
| 135 | + |
| 136 | + input: |
| 137 | + file part from featurestein_parts |
| 138 | + file fragments |
| 139 | + |
| 140 | + output: |
| 141 | + file 'XC_*.sdf' |
| 142 | + |
| 143 | + """ |
| 144 | + python -m pipelines.xchem.xcos -i '$part' -if sdf -f '$hits' -o 'XC_${part.name[0..-5]}' -of sdf --no-gzip |
| 145 | + """ |
| 146 | +} |
0 commit comments