|
539
|
1 <tool id="fluxSimulation" name="Flux Simulation" version="2.0.0">
|
|
|
2
|
|
|
3 <macros>
|
|
|
4 <import>marea_macros.xml</import>
|
|
|
5 </macros>
|
|
|
6
|
|
|
7 <requirements>
|
|
|
8 <requirement type="package" version="1.24.4">numpy</requirement>
|
|
|
9 <requirement type="package" version="2.0.3">pandas</requirement>
|
|
|
10 <requirement type="package" version="0.29.0">cobra</requirement>
|
|
|
11 <requirement type="package" version="5.2.2">lxml</requirement>
|
|
|
12 <requirement type="package" version="1.4.2">joblib</requirement>
|
|
|
13 <requirement type="package" version="1.11">scipy</requirement>
|
|
|
14 </requirements>
|
|
|
15
|
|
|
16 <command detect_errors="exit_code">
|
|
|
17 <![CDATA[
|
|
|
18 python $__tool_directory__/flux_simulation.py
|
|
|
19 --tool_dir $__tool_directory__
|
|
|
20
|
|
|
21 --model_and_bounds $model_and_bounds.model_and_bounds
|
|
|
22
|
|
|
23 #if $model_and_bounds.model_and_bounds == 'True':
|
|
|
24 --model_upload $model_and_bounds.model_upload
|
|
545
|
25 --input_file $input_paths_file
|
|
|
26 --name_file $input_names_file
|
|
539
|
27 #else:
|
|
545
|
28 --input_file $model_paths_file
|
|
|
29 --name_file $model_names_file
|
|
539
|
30 #end if
|
|
|
31
|
|
|
32 --sampling_enabled $sampling_params.sampling_enabled
|
|
|
33
|
|
|
34 #if $sampling_params.sampling_enabled == 'true':
|
|
|
35 --thinning 0
|
|
|
36 #if $sampling_params.algorithm_param.algorithm == 'OPTGP':
|
|
|
37 --thinning $sampling_params.algorithm_param.thinning
|
|
|
38 #end if
|
|
|
39 --algorithm $sampling_params.algorithm_param.algorithm
|
|
|
40 --n_batches $sampling_params.n_batches
|
|
|
41 --n_samples $sampling_params.n_samples
|
|
|
42 --seed $sampling_params.seed
|
|
|
43 --output_type "${",".join(map(str, $sampling_params.output_types))}"
|
|
|
44 #else:
|
|
|
45 --thinning 0
|
|
|
46 --algorithm 'CBS'
|
|
|
47 --n_batches 1
|
|
|
48 --n_samples 1
|
|
|
49 --seed 0
|
|
|
50 --output_type 'mean'
|
|
|
51 #end if
|
|
|
52
|
|
|
53 #if $output_types_analysis:
|
|
|
54 --output_type_analysis "${",".join(map(str, $output_types_analysis))}"
|
|
|
55 #end if
|
|
|
56
|
|
|
57 #if 'FVA' in str($output_types_analysis):
|
|
|
58 --perc_opt $fva_params.optimality_fraction
|
|
|
59 #end if
|
|
|
60
|
|
|
61 --out_log $log
|
|
|
62
|
|
|
63 #if $sampling_params.sampling_enabled == 'true':
|
|
|
64 #if 'mean' in str($sampling_params.output_types):
|
|
|
65 --out_mean $mean_results
|
|
|
66 #end if
|
|
|
67 #if 'median' in str($sampling_params.output_types):
|
|
|
68 --out_median $median_results
|
|
|
69 #end if
|
|
|
70 #if 'quantiles' in str($sampling_params.output_types):
|
|
|
71 --out_quantiles $quantile_results
|
|
|
72 #end if
|
|
|
73 #end if
|
|
|
74
|
|
|
75 #if 'FVA' in str($output_types_analysis):
|
|
|
76 --out_fva $fva_results
|
|
|
77 #end if
|
|
|
78 #if 'pFBA' in str($output_types_analysis):
|
|
|
79 --out_pfba $pFBA_results
|
|
|
80 #end if
|
|
|
81 #if 'sensitivity' in str($output_types_analysis):
|
|
|
82 --out_sensitivity $sensitivity_results
|
|
|
83 #end if
|
|
|
84 ]]>
|
|
|
85 </command>
|
|
|
86
|
|
545
|
87 <configfiles>
|
|
|
88 <configfile name="input_paths_file"><![CDATA[#if $model_and_bounds.model_and_bounds == 'True'
|
|
|
89 #for $input_temp in $model_and_bounds.inputs
|
|
|
90 ${input_temp}
|
|
|
91 #end for
|
|
|
92 #end if]]></configfile>
|
|
|
93
|
|
|
94 <configfile name="input_names_file"><![CDATA[#if $model_and_bounds.model_and_bounds == 'True'
|
|
|
95 #for $input_temp in $model_and_bounds.inputs
|
|
|
96 ${input_temp.element_identifier}
|
|
|
97 #end for
|
|
|
98 #end if]]></configfile>
|
|
|
99
|
|
|
100 <configfile name="model_paths_file"><![CDATA[#if $model_and_bounds.model_and_bounds == 'False'
|
|
|
101 #for $input_temp in $model_and_bounds.model_files
|
|
|
102 ${input_temp}
|
|
|
103 #end for
|
|
|
104 #end if]]></configfile>
|
|
|
105
|
|
|
106 <configfile name="model_names_file"><![CDATA[#if $model_and_bounds.model_and_bounds == 'False'
|
|
|
107 #for $input_temp in $model_and_bounds.model_files
|
|
|
108 ${input_temp.element_identifier}
|
|
|
109 #end for
|
|
|
110 #end if]]></configfile>
|
|
|
111 </configfiles>
|
|
|
112
|
|
539
|
113 <inputs>
|
|
|
114 <conditional name="model_and_bounds">
|
|
|
115 <param name="model_and_bounds" argument="--model_and_bounds" type="select" label="Input format:" help="Choose whether to upload the model and bounds in separate files or to upload multiple complete model files.">
|
|
|
116 <option value="True" selected="true">Model + bounds (separate files)</option>
|
|
|
117 <option value="False">Multiple complete models</option>
|
|
|
118 </param>
|
|
|
119
|
|
|
120 <when value="True">
|
|
|
121 <param name="model_upload" argument="--model_upload" type="data" format="csv,tsv,tabular"
|
|
|
122 label="Model tabular:"
|
|
|
123 help="Upload a CSV/TSV file that contains the model reaction rules generated by the Import Metabolic Model tool. Recommended columns: ReactionID, Reaction (formula), Rule (GPR). Optional columns: name, lower_bound, upper_bound, InMedium. If bounds are present here they may be overridden by separate bound files." />
|
|
|
124
|
|
|
125 <param name="inputs" argument="--inputs" multiple="true" type="data" format="tabular,csv,tsv"
|
|
|
126 label="Bound file(s):"
|
|
|
127 help="Upload one or more CSV/TSV files containing reaction bounds generated by the Ras2Bounds tool. Each file must include at least: ReactionID, lower_bound, upper_bound. Files are applied in the order provided; later files override earlier ones for the same ReactionID." />
|
|
|
128 </when>
|
|
|
129
|
|
|
130 <when value="False">
|
|
|
131 <param name="model_files" argument="--model_files" multiple="true" type="data" format="csv,tsv,tabular"
|
|
|
132 label="Complete Model tabular:"
|
|
|
133 help="Upload one or more CSV/TSV files, each containing both model rules and reaction bounds for different contexts/cells. Required columns: ReactionID, Reaction, Rule, lower_bound, upper_bound." />
|
|
|
134 </when>
|
|
|
135 </conditional>
|
|
|
136
|
|
|
137 <conditional name="sampling_params">
|
|
|
138 <param name="sampling_enabled" argument="--sampling_enabled" type="boolean" display="checkboxes" checked="false" label="Enable sampling" help="Enable flux sampling"/>
|
|
|
139
|
|
|
140 <when value="true">
|
|
|
141 <conditional name="algorithm_param">
|
|
|
142 <param name="algorithm" argument="--algorithm" type="select" label="Choose sampling algorithm:">
|
|
|
143 <option value="CBS" selected="true">CBS</option>
|
|
|
144 <option value="OPTGP">OPTGP</option>
|
|
|
145 </param>
|
|
|
146 <when value="OPTGP">
|
|
|
147 <param name="thinning" argument="--thinning" type="integer" label="Thinning:" value="100" help="Number of iterations to wait before taking a sample."/>
|
|
|
148 </when>
|
|
|
149 </conditional>
|
|
|
150
|
|
|
151 <param name="n_samples" argument="--n_samples" type="integer" label="Samples:" value="1000" min="1" max="1000"/>
|
|
|
152 <param name="n_batches" argument="--n_batches" type="integer" label="Batches:" value="1" help="This is useful for computational performances."/>
|
|
|
153 <param name="seed" argument="--seed" type="integer" label="Seed:" value="0" help="Random seed."/>
|
|
|
154
|
|
|
155 <param type="select" argument="--output_types" multiple="true" name="output_types" label="Choose outputs from sampling">
|
|
|
156 <option value="mean" selected="true">Mean</option>
|
|
|
157 <option value="median" selected="true">Median</option>
|
|
|
158 <option value="quantiles" selected="true">Quantiles</option>
|
|
|
159 <option value="fluxes" selected="false">All fluxes</option>
|
|
|
160 </param>
|
|
|
161 </when>
|
|
|
162
|
|
|
163 <when value="false">
|
|
|
164 <!-- Hidden parameters when sampling is disabled -->
|
|
|
165 <param name="algorithm" type="hidden" value="CBS"/>
|
|
|
166 <param name="n_samples" type="hidden" value="1000"/>
|
|
|
167 <param name="n_batches" type="hidden" value="1"/>
|
|
|
168 <param name="seed" type="hidden" value="0"/>
|
|
|
169 <param name="output_types" type="hidden" value="mean"/>
|
|
|
170 </when>
|
|
|
171 </conditional>
|
|
|
172
|
|
|
173 <param type="select" argument="--output_types_analysis" multiple="true" name="output_types_analysis" label="Choose outputs from optimization">
|
|
|
174 <option value="FVA" selected="true">FVA</option>
|
|
|
175 <option value="pFBA" selected="false">pFBA</option>
|
|
|
176 <option value="sensitivity" selected="false">Sensitivity reaction knock-out (Biomass)</option>
|
|
|
177 </param>
|
|
|
178
|
|
|
179 <conditional name="fva_params">
|
|
|
180 <param name="show_fva_options" type="boolean" display="checkboxes" checked="false" label="Configure FVA parameters" help="Show additional FVA configuration options"/>
|
|
|
181 <when value="true">
|
|
|
182 <param name="optimality_fraction" argument="--fva_optimality" type="float" label="FVA Optimality (fraction):" value="0.90" min="0.0" max="1.0"
|
|
|
183 help="Fraction of optimality for FVA analysis. 1.0 means the flux must be optimal, lower values allow suboptimal solutions."/>
|
|
|
184 </when>
|
|
|
185 <when value="false">
|
|
|
186 <param name="optimality_fraction" argument="--fva_optimality" type="hidden" value="1.0"/>
|
|
|
187 </when>
|
|
|
188 </conditional>
|
|
|
189
|
|
|
190 </inputs>
|
|
|
191
|
|
|
192 <outputs>
|
|
|
193 <data format="txt" name="log" label="Flux Simulation - Log" />
|
|
|
194
|
|
|
195 <collection name="fluxes_results" type="list" label="Fluxes">
|
|
|
196 <filter>sampling_params['sampling_enabled'] and 'fluxes' in sampling_params['output_types']</filter>
|
|
|
197 <discover_datasets name="collection" pattern="__name_and_ext__" directory="flux_simulation"/>
|
|
|
198 </collection>
|
|
|
199
|
|
|
200 <data format="tabular" name="mean_results" label="Mean">
|
|
|
201 <filter>sampling_params['sampling_enabled'] and 'mean' in sampling_params['output_types']</filter>
|
|
|
202 </data>
|
|
|
203
|
|
|
204 <data format="tabular" name="median_results" label="Median">
|
|
|
205 <filter>sampling_params['sampling_enabled'] and 'median' in sampling_params['output_types']</filter>
|
|
|
206 </data>
|
|
|
207
|
|
|
208 <data format="tabular" name="quantile_results" label="Quantiles">
|
|
|
209 <filter>sampling_params['sampling_enabled'] and 'quantiles' in sampling_params['output_types']</filter>
|
|
|
210 </data>
|
|
|
211
|
|
|
212 <data format="tabular" name="fva_results" label="FVA">
|
|
|
213 <filter>output_types_analysis and 'FVA' in output_types_analysis</filter>
|
|
|
214 </data>
|
|
|
215
|
|
|
216 <data format="tabular" name="pFBA_results" label="pFBA">
|
|
|
217 <filter>output_types_analysis and 'pFBA' in output_types_analysis</filter>
|
|
|
218 </data>
|
|
|
219
|
|
|
220 <data format="tabular" name="sensitivity_results" label="Sensitivity">
|
|
|
221 <filter>output_types_analysis and 'sensitivity' in output_types_analysis</filter>
|
|
|
222 </data>
|
|
|
223 </outputs>
|
|
|
224
|
|
|
225 <help>
|
|
|
226 <![CDATA[
|
|
|
227 Overview
|
|
|
228 -------------
|
|
|
229
|
|
|
230 This tool generates flux samples from a set of metabolic models. It supports two input modes:
|
|
|
231 - Model + bounds: upload a single base model and multiple bound files (one per context/cell type)
|
|
|
232 - Multiple complete models: upload multiple model files, each already containing its own bounds.
|
|
|
233
|
|
|
234 In the first mode:
|
|
|
235 - the base model must be in tabular format as produced by the Import Metabolic Model tool.
|
|
|
236 - the bound files should come from the RAStoBounds tool.
|
|
|
237
|
|
|
238 In the second mode, provide a separate tabular file for each complete model.
|
|
|
239
|
|
|
240 Available analyses
|
|
|
241 -------------
|
|
|
242
|
|
|
243 Two types of analysis are available:
|
|
|
244 - flux optimization
|
|
|
245 - flux sampling
|
|
|
246
|
|
|
247 For flux optimization, one of the following methods can be performed:
|
|
|
248 - parsimonious-FBA
|
|
|
249 - Flux Variability Analysis
|
|
|
250 - Biomass sensitivity analysis (single reaction knock-out)
|
|
|
251 The objective function — a linear combination of fluxes weighted by specific coefficients — depends on the provided metabolic network.
|
|
|
252
|
|
|
253 For flux sampling, one of the following methods can be performed:
|
|
|
254 - CBS (Corner-based sampling)
|
|
|
255 - OPTGP (Improved Artificial Centering Hit-and-Run sampler) algorithms.
|
|
|
256
|
|
|
257
|
|
|
258 Output:
|
|
|
259 -------------
|
|
|
260
|
|
|
261 The tool produces:
|
|
|
262 - Samples: reporting the sampled fluxes for each reaction (reaction names on the rows and sample names on the columns). Format: tab-separated.
|
|
|
263 - a log file (.txt).
|
|
|
264
|
|
|
265 The sampled fluxes can be reported as full datasets or summarized using descriptive statistics such as mean, median, and quantiles (0.25, 0.50, 0.75), computed for each model.
|
|
|
266
|
|
|
267 **TIP**: Bounds generated by RAStoBound are grouped in a collection. You can select collections by clicking on "Dataset Collection" option in the "Bound file(s):" input parameter.
|
|
|
268
|
|
|
269 **TIP**: The Batches parameter helps maintain memory efficiency. For example, for 10,000 samples, use n_samples=1,000 and n_batches=10.
|
|
|
270
|
|
|
271 **TIP**: Adjust the Thinning parameter to improve convergence toward the stationary distribution.
|
|
|
272 Common thinning values are 100 or 1000.Note that if you set thinning = 100 and request 100 samples, the total number of generated flux samples will be 100 * 100.
|
|
|
273
|
|
|
274 **TIP**: FVA optimality percentage allows you to explore suboptimal flux ranges. 100% restricts to optimal solutions, while lower values (e.g., 90%) allow broader flux ranges.
|
|
|
275 ]]>
|
|
|
276 </help>
|
|
|
277 <expand macro="citations_fluxes" />
|
|
|
278 </tool> |