-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.nf
135 lines (102 loc) · 3.41 KB
/
main.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/env nextflow
println """
################################################################################
THANKS FOR USING THE aaRS PIPELINE - AIDING GENETIC CODE EXPANSION.
Version - 1.0
Author - James Sanders
################################################################################
"""
// Declare Global Variables
optionFiles_ch = Channel.fromPath(launchDir + '/output/optionFiles/*option')
rosettaCartesian = launchDir + '/resources/rosetta*/main/source/bin/cartesian_ddg*' // Use symlink location as probably more version stable
cbdock = launchDir + '/resources/CB-Dock/prog/AutoBlindDock.pl'
// Passes option Files to Rosetta Cartesian for Structure Prediction
process structurePrediction{
input:
file optionFile from optionFiles_ch
output:
path structureDir into structureDir_ch
stdout mutantID_ch
shell:
'''
!{rosettaCartesian} @!{optionFile} > structureDir
echo !{optionFile}
'''
}
// Finds the Lowest Free Energy Structure and Outputs Path to .pdb File
process minimizedStructure{
input:
path structureDir from structureDir_ch
output:
stdout mutantStructure into mutantStructure_ch
shell:
'''
min=$(minimizedStructure.py $(dirname $(realpath !{structureDir}))/*.ddg)
minPath=$(dirname $(realpath !{structureDir}))'/'$min
echo $minPath
'''
}
// Docks Mutant with Native Substrate Supplied in /inputs/ dir
nativeLigand=launchDir + '/inputs/nativeLigand.mol2'
process nativeDocking{
input:
val mutantStructure from mutantStructure_ch
output:
path nativeDocking into nativeDocking_ch
stdout mutantStructure2_ch
shell:
'''
outputDir=$(pwd)
# Create Replicate Dirs
mkdir 1
mkdir 2
mkdir 3
main="!{cbdock} !{mutantStructure}" # solves bug if concatanated together
echo Replicate 1: >> nativeDocking
$main !{nativeLigand} 1 "$outputDir/1" >> nativeDocking
echo Replicate 2: >> nativeDocking
$main !{nativeLigand} 1 "$outputDir/2" >> nativeDocking
echo Replicate 3: >> nativeDocking
$main !{nativeLigand} 1 "$outputDir/3" >> nativeDocking
# Pass on mutant structure for use by exogenous docking
echo !{mutantStructure}
'''
}
// Docks Mutant with Target Substrate Supplied in /inputs/ dir
exogenousLigand=launchDir = launchDir + '/inputs/exogenousLigand.mol2'
process exogenousDocking{
input:
val mutantStructure from mutantStructure2_ch
output:
path exogenousDocking into exogenousDocking_ch
shell:
'''
outputDir=$(pwd)
mkdir 1
mkdir 2
mkdir 3
main="!{cbdock} !{mutantStructure}" # solves bug if concatanated together
echo Replicate 1: >> exogenousDocking
$main !{exogenousLigand} 1 "$outputDir/1" >> exogenousDocking
echo Replicate 2: >> exogenousDocking
$main !{exogenousLigand} 1 "$outputDir/2" >> exogenousDocking
echo Replicate 3: >> exogenousDocking
$main !{exogenousLigand} 1 "$outputDir/3" >> exogenousDocking
'''
}
// Process Docking Results into a JSON for Analysis
process docktoJSON{
input:
path nativeDocking from nativeDocking_ch
path exogenousDocking from exogenousDocking_ch
val mutantID from mutantID_ch
output:
stdout progress
shell:
'''
nativeDocking=$(dirname $(realpath !{nativeDocking}))
exogenousDocking=$(dirname $(realpath !{exogenousDocking}))
docktoJSON.py $nativeDocking $exogenousDocking !{mutantID}
'''
}
progress.view()