Mercurial > repos > chemteam > parmconv
comparison parmconv.xml @ 0:6c6cecf51bd0 draft
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3664d8011044773cc3250ce15d712d97b0b91373"
author | chemteam |
---|---|
date | Tue, 07 Apr 2020 08:07:39 -0400 |
parents | |
children | da2252f1ccab |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:6c6cecf51bd0 |
---|---|
1 <tool id="parmconv" name="Convert Parameters" version="@VERSION@"> | |
2 <description>to AMBER prmtop in preparation for MMPBSA</description> | |
3 <macros> | |
4 <import>macros.xml</import> | |
5 </macros> | |
6 <expand macro="requirements"> | |
7 <requirement type="package" version="3.2.0">parmed</requirement> | |
8 <requirement type="package" version="2019.1">gromacs</requirement> | |
9 <requirement type="package" version="2.11.1">jinja2</requirement> | |
10 </expand> | |
11 <command detect_errors="exit_code"> | |
12 <![CDATA[ | |
13 python '$templating_script' '$inputs' && | |
14 PATH_TO_PARMED=\$(dirname `which parmed`) && | |
15 export AMBERHOME=\$(dirname \$PATH_TO_PARMED) && | |
16 export GMXDATA=\$AMBERHOME/share/gromacs/top/ && | |
17 parmed -i ligand.script -O && | |
18 parmed -i receptor.script -O && | |
19 parmed -i complex.script -O && | |
20 parmed -i solvatedcomplex.script -O | |
21 | |
22 ]]> | |
23 </command> | |
24 <configfiles> | |
25 <inputs name="inputs"/> | |
26 <configfile name="templating_script"> | |
27 <![CDATA[ | |
28 | |
29 import os | |
30 import sys | |
31 import json | |
32 | |
33 from jinja2 import Environment, FileSystemLoader | |
34 input_json_path = sys.argv[1] | |
35 params = json.load(open(input_json_path, "r")) | |
36 currentpath = "$__tool_directory__" # should work generally | |
37 template_environment = Environment(loader=FileSystemLoader(currentpath),lstrip_blocks=True, trim_blocks=True) | |
38 template = template_environment.get_template('template_parmconv.j2') | |
39 params['fmt'] = '$param_inputs.fmt' | |
40 #if str($param_inputs.fmt) == 'AMBER': | |
41 params["top_in"] = '$param_inputs.top_in' | |
42 #else: | |
43 params["top_in"] = '$param_inputs.top_in' | |
44 params["str_in"] = '$param_inputs.str_in' | |
45 #end if | |
46 params['prmtop_ligand'] = '$prmtop_ligand' | |
47 params['prmtop_receptor'] = '$prmtop_receptor' | |
48 params['prmtop_complex'] = '$prmtop_complex' | |
49 params['prmtop_solvatedcomplex'] = '$prmtop_solvatedcomplex' | |
50 print(params) | |
51 | |
52 | |
53 def unescape(cond_text): | |
54 """ | |
55 # Unescape if input has been escaped - credit @bgruening //github.com/bgruening/galaxytools.git get_online_data.py | |
56 """ | |
57 mapped_chars = { '>' :'__gt__', | |
58 '<' :'__lt__', | |
59 "'" :'__sq__', | |
60 '"' :'__dq__', | |
61 '[' :'__ob__', | |
62 ']' :'__cb__', | |
63 '{' :'__oc__', | |
64 '}' :'__cc__', | |
65 '@' : '__at__', | |
66 '\n' : '__cn__', | |
67 '\r' : '__cr__', | |
68 '\t' : '__tc__', | |
69 '&' : '__and__' | |
70 } | |
71 for key, value in mapped_chars.items(): | |
72 cond_text = cond_text.replace( value, key ) | |
73 return cond_text | |
74 | |
75 def run_template(params=params, system="ligand"): | |
76 """ | |
77 # Render template on a selected system using a local parameter copy | |
78 """ | |
79 localparams=params.copy() # shallow copy ok for simple variables | |
80 localparams['stripmask']=unescape(localparams['stripmask_'+system]) | |
81 localparams['prmtop_out']=localparams['prmtop_'+system] | |
82 print(localparams) | |
83 with open(system+'.script','w+') as f: | |
84 f.write(template.render(localparams)) | |
85 | |
86 systems = ['ligand', 'receptor', 'complex', 'solvatedcomplex'] | |
87 for system in systems: | |
88 run_template(system=system) | |
89 | |
90 ]]> | |
91 </configfile> | |
92 </configfiles> | |
93 <inputs> | |
94 <conditional name="param_inputs"> | |
95 <param name="fmt" type="select" label="Force Field format"> | |
96 <option selected="True" value="AMBER">AMBER</option> | |
97 <option value="GROMACS">GROMACS</option> | |
98 </param> | |
99 <when value="AMBER"> | |
100 <param name="top_in" type="data" label="Input topology (prmtop) file" format="txt"/> | |
101 </when> | |
102 <when value="GROMACS"> | |
103 <param name="top_in" type="data" label="Input topology (top) file" format="top"/> | |
104 <param name="str_in" type="data" label="Input structure (gro) file" format="gro"/> | |
105 </when> | |
106 </conditional> | |
107 <param name="stripmask_ligand" type="text" label="Ligand selection" value="!:UNL" help="Define a valid AMBER stripmask that will select only the ligand"> | |
108 <sanitizer> | |
109 <valid initial="string.printable"> | |
110 <remove value="&"/> | |
111 </valid> | |
112 <mapping initial="none"> | |
113 <add source="&" target="__and__"/> | |
114 </mapping> | |
115 </sanitizer> | |
116 </param> | |
117 <param name="stripmask_receptor" type="text" label="Receptor selection" value=":NA,SOL,UNL" help="Define a valid AMBER stripmask that will select only the receptor"> | |
118 <sanitizer> | |
119 <valid initial="string.printable"> | |
120 <remove value="&"/> | |
121 </valid> | |
122 <mapping initial="none"> | |
123 <add source="&" target="__and__"/> | |
124 </mapping> | |
125 </sanitizer> | |
126 </param> | |
127 <param name="stripmask_complex" type="text" label="Complex selection" value=":NA,SOL" help="Define a valid AMBER stripmask that will select the complex (receptor with ligand)"> | |
128 <sanitizer> | |
129 <valid initial="string.printable"> | |
130 <remove value="&"/> | |
131 </valid> | |
132 <mapping initial="none"> | |
133 <add source="&" target="__and__"/> | |
134 </mapping> | |
135 </sanitizer> | |
136 </param> | |
137 <param name="stripmask_solvatedcomplex" type="text" label="Solvated complex selection" help="Define a valid AMBER stripmask that will select the solvated complex (includes water and ions)"> | |
138 <sanitizer> | |
139 <valid initial="string.printable"> | |
140 <remove value="&"/> | |
141 </valid> | |
142 <mapping initial="none"> | |
143 <add source="&" target="__and__"/> | |
144 </mapping> | |
145 </sanitizer> | |
146 </param> | |
147 </inputs> | |
148 <outputs> | |
149 <data format="txt" name="prmtop_ligand" label="ligand prmtop"/> | |
150 <data format="txt" name="prmtop_receptor" label="receptor prmtop"/> | |
151 <data format="txt" name="prmtop_complex" label="complex prmtop"/> | |
152 <data format="txt" name="prmtop_solvatedcomplex" label="solvated complex prmtop"/> | |
153 </outputs> | |
154 <tests> | |
155 <test> | |
156 <!--example in this test is not solvated but sufficient --> | |
157 <param name="fmt" value="AMBER"/> | |
158 <conditional name="param_inputs"> | |
159 <param name="top_in" value="complex.prmtop"/> | |
160 </conditional> | |
161 <param name="stripmask_ligand" value="!:RAL"/> | |
162 <param name="stripmask_receptor" value=":NA,CL,SOL,WAT,RAL"/> | |
163 <param name="stripmask_complex" value=":NA,CL,SOL,WAT"/> | |
164 <output name="prmtop_ligand"> | |
165 <assert_contents> | |
166 <has_text text=" 61 15"/> | |
167 <has_text text="%FLAG MASS"/> | |
168 <has_text text="RAL"/> | |
169 </assert_contents> | |
170 </output> | |
171 <output name="prmtop_receptor"> | |
172 <assert_contents> | |
173 <has_text text=" 3880 15"/> | |
174 <has_text text="%FLAG MASS"/> | |
175 <has_text text="ALA LEU"/> | |
176 <not_has_text text="RAL "/> | |
177 </assert_contents> | |
178 </output> | |
179 <output name="prmtop_complex"> | |
180 <assert_contents> | |
181 <has_text text=" 3941 15"/> | |
182 <has_text text="%FLAG MASS"/> | |
183 <has_text text="ALA LEU"/> | |
184 <has_text text="RAL"/> | |
185 </assert_contents> | |
186 </output> | |
187 </test> | |
188 <test> | |
189 <!--example in this test is from @sbrays' gromacs tests. It has no ligand but is sufficient and will not take extra space in the repo! --> | |
190 <param name="fmt" value="GROMACS"/> | |
191 <conditional name="param_inputs"> | |
192 <param name="top_in" value="topol_solv.top"/> | |
193 <param name="str_in" value="solv_ions.gro"/> | |
194 </conditional> | |
195 <!-- pretending CL is a ligand --> | |
196 <param name="stripmask_ligand" value="!:CL"/> | |
197 <param name="stripmask_receptor" value=":NA,CL,SOL,WAT"/> | |
198 <!-- test a fairly complex selection. All backbone oxygens in residues 1-500 but not in water, lysine or arginine --> | |
199 <param name="stripmask_solvatedcomplex" value=":1-500@O&!(:WAT|:LYS,ARG)"/> | |
200 <output name="prmtop_ligand"> | |
201 <assert_contents> | |
202 <has_text text=" 8 59"/> | |
203 <has_text text="%FLAG MASS"/> | |
204 <has_text text="CL"/> | |
205 </assert_contents> | |
206 </output> | |
207 <output name="prmtop_receptor"> | |
208 <assert_contents> | |
209 <has_text text=" 1960 59"/> | |
210 <has_text text="%FLAG MASS"/> | |
211 <has_text text="LYS VAL PHE "/> | |
212 <not_has_text text="CL "/> | |
213 </assert_contents> | |
214 </output> | |
215 <output name="prmtop_solvatedcomplex"> | |
216 <assert_contents> | |
217 <has_text text=" 38265 59"/> | |
218 <has_text text="%FLAG MASS"/> | |
219 <has_text text="LYS VAL PHE"/> | |
220 </assert_contents> | |
221 </output> | |
222 </test> | |
223 </tests> | |
224 <help> | |
225 <![CDATA[ | |
226 .. class:: infomark | |
227 | |
228 **What it does** | |
229 | |
230 This tool converts parameter and topology files that represent a solvated complex into parameter files for the ligand, receptor, complex and solvated complex in AMBER prmtop format. These files are needed for MMPBSA calculations. | |
231 | |
232 .. class:: infomark | |
233 | |
234 **How it works** | |
235 | |
236 AmberTools ParmEd is used to strip unneeded atoms and save out the parameter files. The stripmasks are defined by the user. | |
237 | |
238 .. class:: infomark | |
239 | |
240 **Outputs created** | |
241 | |
242 prmtop files for the ligand, receptor, complex and solvated complex. | |
243 | |
244 .. class:: infomark | |
245 | |
246 **User guide and documentation** | |
247 | |
248 - The `AmberTools Manual`_ | |
249 - The `Parmed Documentation`_ | |
250 | |
251 | |
252 .. _`AmberTools Manual`: https://ambermd.org/doc12/Amber18.pdf | |
253 .. _`Parmed Documentation`: https://parmed.github.io/ParmEd/html/index.html | |
254 | |
255 | |
256 ]]> | |
257 </help> | |
258 <expand macro="citations"> | |
259 <citation type="bibtex">@misc{parmed_2020, author = {ParmEd}, title = {ParmEd/ParmEd}, url={https://github.com/ParmEd/ParmEd}, abstract = {Parameter/topology editor and molecular simulator. Contribute to ParmEd/ParmEd development by creating an | |
260 account on GitHub.}, urldate = {2020-04-03}, publisher = {GitHub}, year = {2020}, month = mar, }</citation> | |
261 </expand> | |
262 </tool> |