Skip to content

Commit bde7a0f

Browse files
committed
#35 initial rdock enhancements
1 parent 41d5487 commit bde7a0f

File tree

7 files changed

+3366
-0
lines changed

7 files changed

+3366
-0
lines changed

data/nudt7/ligand.mol

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
OpenBabel06051719483D
3+
4+
18 19 0 0 0 0 2 V2000
5+
29.0700 -43.2240 73.7660 C 0 0 0 0 0
6+
36.2650 -44.8070 74.9140 C 0 0 0 0 0
7+
37.1260 -44.6280 73.8270 C 0 0 0 0 0
8+
38.5050 -44.6030 73.9960 C 0 0 0 0 0
9+
39.0530 -44.7650 75.2580 C 0 0 0 0 0
10+
38.2200 -44.9420 76.3450 C 0 0 0 0 0
11+
36.8400 -44.9680 76.1790 C 0 0 0 0 0
12+
30.0630 -44.1750 73.1160 C 0 0 0 0 0
13+
29.4310 -45.1480 72.1250 C 0 0 0 0 0
14+
32.0050 -44.9160 74.3360 C 0 0 0 0 0
15+
32.8370 -45.6680 73.5100 C 0 0 0 0 0
16+
34.2080 -45.6230 73.7110 C 0 0 0 0 0
17+
34.7860 -44.8390 74.7200 C 0 0 0 0 0
18+
33.9230 -44.0930 75.5330 C 0 0 0 0 0
19+
32.5490 -44.1280 75.3490 C 0 0 0 0 0
20+
30.2050 -45.7640 71.3670 O 0 0 0 0 0
21+
28.1910 -45.2760 72.1490 O 0 0 0 0 0
22+
30.6380 -44.9430 74.1670 O 0 0 0 0 0
23+
1 8 1 0 0 0
24+
2 3 2 0 0 0
25+
2 7 1 0 0 0
26+
2 13 1 0 0 0
27+
3 4 1 0 0 0
28+
4 5 2 0 0 0
29+
5 6 1 0 0 0
30+
6 7 2 0 0 0
31+
8 9 1 0 0 0
32+
8 18 1 0 0 0
33+
9 16 2 0 0 0
34+
9 17 1 0 0 0
35+
10 11 2 0 0 0
36+
10 15 1 0 0 0
37+
10 18 1 0 0 0
38+
11 12 1 0 0 0
39+
12 13 2 0 0 0
40+
13 14 1 0 0 0
41+
14 15 2 0 0 0
42+
M CHG 1 17 -1
43+
M END

data/nudt7/ligands.data.gz

1.51 KB
Binary file not shown.

data/nudt7/receptor.mol2

Lines changed: 3137 additions & 0 deletions
Large diffs are not rendered by default.

src/nextflow/docking/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
results
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Intentionally Empty
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
#!/usr/bin/env nextflow
2+
3+
/* Squonk Nextflow pipline that runs Docking using rDock, filtering the poses relative to the score from docking the
4+
* reference ligand.
5+
*
6+
* To test this manually run something like this:
7+
* nextflow -c src/nextflow/nextflow-docker.config run src/nextflow/docking/rdock-filter.nsd.nf --ligands data/nudt7/ligands.data.gz --ligand data/nudt7/ligand.mol --receptor data/nudt7/receptor.mol2 --num_dockings 5 -with-docker informaticsmatters/rdkit_pipelines
8+
*/
9+
10+
params.ligand = "$baseDir/ligand.mol"
11+
params.ligands = "$baseDir/ligands.data.gz"
12+
params.receptor = "$baseDir/receptor.mol2"
13+
params.chunk = 25
14+
params.num_dockings = 25
15+
params.top = 1
16+
params.score = null
17+
params.nscore = null
18+
params.limit = 0
19+
params.digits = 4
20+
params.threshold = 0.0
21+
params.field = 'SCORE.norm'
22+
23+
ligand = file(params.ligand)
24+
ligands = file(params.ligands)
25+
receptor = file(params.receptor)
26+
27+
process create_cavity {
28+
29+
container 'informaticsmatters/rdock-mini:latest'
30+
beforeScript 'chmod g+w .'
31+
32+
input:
33+
file ligand
34+
file receptor
35+
36+
output:
37+
file 'receptor.prm' into prmfile
38+
file 'receptor.as' into asfile
39+
40+
"""
41+
cat << EOF > receptor.prm
42+
RBT_PARAMETER_FILE_V1.00
43+
RECEPTOR_FILE $receptor
44+
RECEPTOR_FLEX 3.0
45+
SECTION MAPPER
46+
SITE_MAPPER RbtLigandSiteMapper
47+
REF_MOL $ligand
48+
RADIUS 3.0
49+
SMALL_SPHERE 1.0
50+
MIN_VOLUME 100
51+
MAX_CAVITIES 1
52+
VOL_INCR 0.0
53+
GRIDSTEP 0.5
54+
END_SECTION
55+
SECTION CAVITY
56+
SCORING_FUNCTION RbtCavityGridSF
57+
WEIGHT 1.0
58+
END_SECTION
59+
EOF
60+
61+
rbcavity -was -d -r receptor.prm > rbcavity.log
62+
"""
63+
}
64+
65+
/* Docks the reference ligand
66+
*/
67+
process dock_reference_ligand {
68+
69+
container 'informaticsmatters/rdock-mini:latest'
70+
beforeScript 'chmod g+w .'
71+
72+
publishDir "$baseDir/results", mode: 'copy'
73+
74+
input:
75+
file receptor
76+
file 'receptor.as' from asfile
77+
file 'receptor.prm' from prmfile
78+
file ligand
79+
80+
output:
81+
file 'best_ligand.sdf' into best_ligand
82+
83+
"""
84+
rbdock -i ligand.mol -r receptor.prm -p dock.prm -n $params.num_dockings -o docked_ligand > docked_ligand_out.log
85+
sdsort -n -s -fSCORE docked_ligand.sd | sdfilter -f'\$_COUNT <= 1' > best_ligand.sdf
86+
"""
87+
}
88+
89+
/* Splits the input into multiple files of ${params.chunk} records.
90+
*/
91+
process splitter {
92+
93+
//beforeScript 'chmod g+w .'
94+
container 'informaticsmatters/rdkit_pipelines:latest'
95+
96+
input:
97+
file ligands
98+
99+
output:
100+
file 'ligands_part*.sdf' into ligands_parts mode flatten
101+
file 'ligands_part_metrics.txt' into splitter_metrics
102+
103+
"""
104+
python -m pipelines_utils_rdkit.filter -i $ligands -c $params.chunk -l $params.limit -d $params.digits -o ligands_part -of sdf --no-gzip --meta
105+
"""
106+
}
107+
108+
/* Docks each file from the ligands_parts channel sending each resulting SD file to the results channel
109+
*/
110+
process dock_ligands {
111+
112+
container 'informaticsmatters/rdock-mini:latest'
113+
// change permissions on the work dir so that the rdock user in the container
114+
// can write to the directory that is owned by root
115+
beforeScript 'chmod g+w .'
116+
117+
input:
118+
file part from ligands_parts
119+
file receptor
120+
file 'receptor.as' from asfile
121+
file 'receptor.prm' from prmfile
122+
123+
output:
124+
file 'docked_part*.sd' into docked_parts
125+
126+
"""
127+
rbdock -i $part -r receptor.prm -p dock.prm -n $params.num_dockings -o ${part.name.replace('ligands', 'docked')[0..-5]} > docked_out.log
128+
"""
129+
}
130+
131+
/* Filter, combine and publish the results.
132+
* Poses are only included if they are within ${params.threshold} of the best score obtained from docking the
133+
* target ligand into the same receptor (output of the dock_ligand process).
134+
*/
135+
process combine_and_filter {
136+
137+
container 'informaticsmatters/rdock-mini:latest'
138+
beforeScript 'chmod g+w .'
139+
140+
input:
141+
file parts from docked_parts.collect()
142+
file best from best_ligand
143+
144+
output:
145+
file 'rdock_results.sdf' into results
146+
147+
"""
148+
FSCORE=\$(sdreport -nh -t${params.field} best_ligand.sdf | cut -f 2 | awk '{\$1=\$1};1')
149+
ASCORE=\$(awk "BEGIN {print \$FSCORE + ${params.threshold}}")
150+
echo "Processing $parts with normalised score filter of \$ASCORE"
151+
sdsort -n -s -f${params.field} docked_part*.sd | sdfilter -f"\\\$${params.field} < \$ASCORE" | sdfilter -f'\$_COUNT <= ${params.top}' > rdock_results.sdf
152+
"""
153+
}
154+
155+
process results {
156+
157+
beforeScript 'chmod g+w .'
158+
container 'informaticsmatters/rdkit_pipelines:latest'
159+
beforeScript 'chmod g+w .'
160+
161+
publishDir "$baseDir/results", mode: 'copy'
162+
163+
input:
164+
file 'results.sdf' from results
165+
file 'splitter_metrics.txt' from splitter_metrics
166+
167+
output:
168+
file 'output.data.gz'
169+
file 'output.metadata'
170+
file 'output_metrics.txt'
171+
172+
"""
173+
python -m pipelines_utils_rdkit.filter -i results.sdf -of json -o output --meta
174+
mv output_metrics.txt old_metrics.txt
175+
echo -n 'DockingRDock=' >> output_metrics.txt
176+
echo \$((`grep '__InputCount__' splitter_metrics.txt | cut -d '=' -f 2` * ${params.num_dockings})) >> output_metrics.txt
177+
grep '__InputCount__' splitter_metrics.txt >> output_metrics.txt
178+
grep '__OutputCount__' old_metrics.txt >> output_metrics.txt
179+
"""
180+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
docker.enabled = true
2+
docker.mountFlags = 'z'
3+
docker.runOptions = '-u $(id -u):$(id -g)'
4+
process.container = 'busybox'

0 commit comments

Comments
 (0)