Skip to content

Commit 5394195

Browse files
author
Alan Christie
committed
Merge remote-tracking branch 'origin/master'
2 parents 410066d + ac0f8a7 commit 5394195

File tree

7 files changed

+134
-27
lines changed

7 files changed

+134
-27
lines changed

src/nextflow/README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ be found in the < project root >/src directory and images can be found on Docker
1111
Nextflow files names *.nsd.nf are destined for Squonk (and may have corresponding *.nsd.yml and *.nsd.config files).
1212
For normal use just create files like *.nf. The .nsd.yml extension is needed for it to be recognised by Squonk.
1313

14-
## RDKit examples
14+
## RDKit implementations
1515

1616
### screen - a simple example
1717

@@ -107,6 +107,23 @@ Launching `src/nextflow/docking/smog.nf` [cheesy_dijkstra] - revision: 220c72f4e
107107
[a6/06febe] Submitted process > results
108108
```
109109

110+
## rDock docking
111+
112+
```
113+
$ nextflow run src/nextflow/docking/rdock.nf -c src/nextflow/docking/rdock.config -with-docker --ligands data/hivpr_ligprep_100.sdf.gz --protein data/hivpr_rdock.mol2 --asfile data/hivpr_rdock.as --prmfile data/hivpr_rdock.prm --num_dockings 10
114+
N E X T F L O W ~ version 0.29.0
115+
Launching `src/nextflow/docking/rdock.nf` [festering_newton] - revision: e2ebfb5346
116+
[warm up] executor > local
117+
[51/31d685] Submitted process > sdsplit
118+
[db/e784c2] Submitted process > rdock (3)
119+
[aa/9927f7] Submitted process > rdock (1)
120+
[74/7b5c3b] Submitted process > rdock (2)
121+
[e1/c3301c] Submitted process > rdock (4)
122+
[bc/87e17d] Submitted process > results
123+
$
124+
```
125+
126+
110127
## Usage in Squonk
111128

112129
To be used in Squonk you must produce a `*.nsd.yml` file with the Squonk Service Descriptor. This has a corresponding Nextflow
@@ -129,7 +146,7 @@ in the service descriptor
129146
To test basic execution as it would take place in Squonk create a directory containing the input files that are needed by
130147
the pipeline (make sure they are named as expected by the pipeline) and then execute using the `execute` shell script that
131148
would be generated by squonk. This file has a very simple content, something like this:
132-
```bash
149+
```
133150
#!/bin/sh
134151
nextflow run nextflow.nf -c nextflow.config <your-parameters> -with-docker
135152
```
@@ -140,8 +157,8 @@ To explain this a bit:
140157

141158
An example of how to execute would be this:
142159

143-
```bash
160+
```
144161
docker run -it --rm -v $PWD:$PWD:z -w $PWD -v /var/run/docker.sock:/var/run/docker.sock informaticsmatters/nextflow sh -c 'nextflow run plip.nsd.nf -c plip.nsd.config --score 100.0 -with-docker'
145162
```
146163

147-
See [test-nextflow.sh](test-nextflow.sh) for some real examples.
164+
See [test-nextflow.sh](../..test-nextflow.sh) for some real examples.

src/nextflow/docking/plip.nf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,19 @@ process pli_scoring {
5151
*/
5252
process results {
5353

54-
publishDir './', mode: 'copy'
5554

5655
input:
5756
file ligands
5857
file part from scored_parts.collect()
5958

6059
output:
61-
file 'output.sdf.gz'
60+
file 'output.sdf.gz' into results
6261

6362

6463
"""
6564
cat scored_part*.sdf | gzip > output.sdf.gz
6665
"""
6766
}
6867

69-
68+
results.println { "Results: $it" }
7069

src/nextflow/docking/rdock.config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
docker.enabled = true
2+
// allow to run with SELinux
3+
docker.mountFlags = 'z'
4+
// this runs the containers as the current user
5+
docker.runOptions = '-u $(id -u):$(id -g)'
6+
// See here for information on this image: https://github.com/InformaticsMatters/rdock_docker
7+
process.container = 'informaticsmatters/rdock-mini:latest'

src/nextflow/docking/rdock.nf

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env nextflow
2+
3+
/* Example Nextflow pipeline that runs rDock docking
4+
*/
5+
6+
7+
params.ligands = 'ligands.sdf.gz'
8+
params.prmfile = 'receptor.prm'
9+
params.protein = 'receptor.mol2'
10+
params.asfile = 'receptor.as'
11+
params.chunk = 25
12+
13+
params.num_dockings = 100
14+
params.top = 1
15+
params.score = null
16+
params.nscore = null
17+
params.limit = 0
18+
params.digits = 4
19+
20+
21+
ligands = file(params.ligands)
22+
protein = file(params.protein)
23+
prmfile = file(params.prmfile)
24+
asfile = file(params.asfile)
25+
26+
/* Splits the input SD file into multiple files of ${params.chunk} records.
27+
* Each file is sent individually to the ligand_parts channel.
28+
* Parts are named so as to be in correct sorted area.
29+
*/
30+
process sdsplit {
31+
32+
container 'informaticsmatters/rdkit_pipelines:latest'
33+
34+
input:
35+
file ligands
36+
37+
output:
38+
file 'ligands_part*.sdf' into ligand_parts mode flatten
39+
40+
41+
"""
42+
python -m pipelines_utils_rdkit.filter -i $ligands -c $params.chunk -d $params.digits -o ligands_part -of sdf --no-gzip
43+
"""
44+
}
45+
46+
/* Docks each file from the ligand_parts channel sending each resulting SD file to the results channel
47+
*/
48+
process rdock {
49+
50+
input:
51+
file part from ligand_parts
52+
file protein
53+
file prmfile
54+
file asfile
55+
56+
output:
57+
file 'docked_part*.sd' into docked_parts
58+
59+
"""
60+
rbdock -r $prmfile -p dock.prm -n $params.num_dockings -i $part -o ${part.name.replace('ligands', 'docked')[0..-5]} > docked_out.log
61+
"""
62+
}
63+
64+
/* Filter, combine and publish the results
65+
*/
66+
process results {
67+
68+
publishDir './', mode: 'copy'
69+
70+
input:
71+
file part from docked_parts.collect()
72+
73+
output:
74+
file 'results.sdf' into results
75+
76+
"""
77+
sdsort -n -s -fSCORE docked_part*.sd |${params.score == null ? '' : " sdfilter -f'\$SCORE <= $params.score' |"}${params.nscore == null ? '' : " sdfilter -f'\$SCORE.norm <= $params.nscore' |"} sdfilter -f'\$_COUNT <= ${params.top}' > results.sdf
78+
"""
79+
}
80+
81+
results.println { "Results: $it" }

src/nextflow/docking/rdock.nsd.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ process splitter {
6666
*/
6767
process rdock {
6868

69-
container 'informaticsmatters/rdock'
69+
container 'informaticsmatters/rdock-mini:latest'
7070
// change permissions on the work dir so that the rdock user in the container
7171
// can write to the directory that is owned by root
7272
beforeScript 'chmod g+w .'

src/nextflow/docking/smog.nf

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,22 @@ process smog_scoring {
4747
"""
4848
}
4949

50-
/* Recombine and publish the results
50+
/* Recombine the results
5151
*/
5252
process results {
5353

54-
publishDir './', mode: 'copy'
5554

5655
input:
5756
file ligands
5857
file part from scored_parts.collect()
5958

6059
output:
61-
file 'output.sdf.gz'
60+
file 'output.sdf.gz' into results
6261

6362

6463
"""
6564
cat scored_part*.sdf | gzip > output.sdf.gz
6665
"""
6766
}
6867

69-
70-
68+
results.println { "Results: $it" }

test-nextflow.sh

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,21 @@ set -e
77
echo 'Running screen+config'
88
nextflow run src/nextflow/rdkit/screen+conformers.nf -c src/nextflow/rdkit/screen.config -with-docker
99

10-
#echo 'Running screen in Squonk mode'
11-
#nextflow run src/nextflow/rdkit/smog.nf -c src/nextflow/docking/smog.config -with-docker --ligands data/smog/confs.sdf --protein data/smog/DCP2_1.pdb informaticsmatters/smog:latest
12-
13-
echo 'Running RDock in squonk mode'
14-
sudo rm -rf tmp/*
15-
cp src/nextflow/docking/rdock.nsd.nf tmp/nextflow.nf
16-
cp src/nextflow/docking/rdock.nsd.config tmp/nextflow.config
17-
cp data/hivpr.config.zip tmp/config.zip
18-
cp data/dhfr_3d.data.gz tmp/ligands.data.gz
19-
cp data/dhfr_3d.metadata tmp/ligands.metadata
20-
cd tmp
21-
docker run -it --rm -v $PWD:$PWD:z -w $PWD -v /var/run/docker.sock:/var/run/docker.sock informaticsmatters/nextflow sh -c 'nextflow run nextflow.nf -c nextflow.config --num_dockings 1 --limit 40 --chunk 5 -with-docker'
22-
cd ..
23-
sudo rm -rf tmp/*
2410

2511
echo 'Running SMoG2016 in basic mode'
2612
nextflow run src/nextflow/docking/smog.nf -c src/nextflow/docking/smog.config -with-docker --ligands data/smog/confs.sdf --protein data/smog/DCP2_1.pdb informaticsmatters/smog:latest
2713

2814
echo 'Running PLI in basic mode'
2915
nextflow run src/nextflow/docking/plip.nf -c src/nextflow/docking/plip.config -with-docker --ligands data/smog/confs.sdf --protein data/smog/DCP2_1.pdb informaticsmatters/pli:latest
3016

17+
echo 'Running rDock in basic mode'
18+
nextflow run src/nextflow/docking/rdock.nf -c src/nextflow/docking/rdock.config -with-docker\
19+
--ligands data/hivpr_ligprep_100.sdf.gz\
20+
--protein data/hivpr_rdock.mol2\
21+
--asfile data/hivpr_rdock.as\
22+
--prmfile data/hivpr_rdock.prm\
23+
--num_dockings 2
24+
3125
echo 'Running SMoG2016 in squonk mode'
3226
sudo rm -rf tmp/*
3327
cp src/nextflow/docking/smog.nsd.nf tmp/nextflow.nf
@@ -54,3 +48,14 @@ cd ..
5448
sudo rm -rf tmp/*
5549

5650

51+
echo 'Running rDock in squonk mode'
52+
sudo rm -rf tmp/*
53+
cp src/nextflow/docking/rdock.nsd.nf tmp/nextflow.nf
54+
cp src/nextflow/docking/rdock.nsd.config tmp/nextflow.config
55+
cp data/hivpr.config.zip tmp/config.zip
56+
cp data/dhfr_3d.data.gz tmp/ligands.data.gz
57+
cp data/dhfr_3d.metadata tmp/ligands.metadata
58+
cd tmp
59+
docker run -it --rm -v $PWD:$PWD:z -w $PWD -v /var/run/docker.sock:/var/run/docker.sock informaticsmatters/nextflow sh -c 'nextflow run nextflow.nf -c nextflow.config --num_dockings 1 --limit 40 --chunk 5 -with-docker'
60+
cd ..
61+
sudo rm -rf tmp/*

0 commit comments

Comments
 (0)