|
93
|
1 <tool id="fluxSimulation" name="Flux Simulation" version="2.0.0">
|
|
|
2
|
|
|
3 <macros>
|
|
|
4 <import>marea_macros.xml</import>
|
|
|
5 </macros>
|
|
|
6
|
|
489
|
7 <requirements>
|
|
93
|
8 <requirement type="package" version="1.24.4">numpy</requirement>
|
|
|
9 <requirement type="package" version="2.0.3">pandas</requirement>
|
|
489
|
10 <requirement type="package" version="0.29.0">cobra</requirement>
|
|
93
|
11 <requirement type="package" version="5.2.2">lxml</requirement>
|
|
|
12 <requirement type="package" version="1.4.2">joblib</requirement>
|
|
307
|
13 <requirement type="package" version="1.11">scipy</requirement>
|
|
489
|
14 </requirements>
|
|
93
|
15
|
|
|
16 <command detect_errors="exit_code">
|
|
|
17 <![CDATA[
|
|
|
18 python $__tool_directory__/flux_simulation.py
|
|
|
19 --tool_dir $__tool_directory__
|
|
518
|
20
|
|
489
|
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
|
|
|
25 --input "${",".join(map(str, $model_and_bounds.inputs))}"
|
|
511
|
26 #set $names_list = []
|
|
489
|
27 #for $input_temp in $model_and_bounds.inputs:
|
|
511
|
28 #silent $names_list.append(str($input_temp.element_identifier))
|
|
489
|
29 #end for
|
|
511
|
30 --name "${",".join($names_list)}"
|
|
489
|
31 #else:
|
|
|
32 --input "${",".join(map(str, $model_and_bounds.model_files))}"
|
|
511
|
33 #set $names_list = []
|
|
489
|
34 #for $input_temp in $model_and_bounds.model_files:
|
|
511
|
35 #silent $names_list.append(str($input_temp.element_identifier))
|
|
489
|
36 #end for
|
|
511
|
37 --name "${",".join($names_list)}"
|
|
93
|
38 #end if
|
|
489
|
39
|
|
|
40 --sampling_enabled $sampling_params.sampling_enabled
|
|
|
41
|
|
|
42 #if $sampling_params.sampling_enabled == 'true':
|
|
|
43 --thinning 0
|
|
|
44 #if $sampling_params.algorithm_param.algorithm == 'OPTGP':
|
|
|
45 --thinning $sampling_params.algorithm_param.thinning
|
|
|
46 #end if
|
|
|
47 --algorithm $sampling_params.algorithm_param.algorithm
|
|
|
48 --n_batches $sampling_params.n_batches
|
|
|
49 --n_samples $sampling_params.n_samples
|
|
|
50 --seed $sampling_params.seed
|
|
|
51 --output_type "${",".join(map(str, $sampling_params.output_types))}"
|
|
|
52 #else:
|
|
|
53 --thinning 0
|
|
|
54 --algorithm 'CBS'
|
|
|
55 --n_batches 1
|
|
|
56 --n_samples 1
|
|
|
57 --seed 0
|
|
|
58 --output_type 'mean'
|
|
93
|
59 #end if
|
|
489
|
60
|
|
523
|
61 #if $output_types_analysis:
|
|
|
62 --output_type_analysis "${",".join(map(str, $output_types_analysis))}"
|
|
|
63 #end if
|
|
489
|
64
|
|
|
65 #if 'FVA' in str($output_types_analysis):
|
|
|
66 --perc_opt $fva_params.optimality_fraction
|
|
|
67 #end if
|
|
|
68
|
|
93
|
69 --out_log $log
|
|
518
|
70
|
|
|
71 #if $sampling_params.sampling_enabled == 'true':
|
|
|
72 #if 'mean' in str($sampling_params.output_types):
|
|
|
73 --out_mean $mean_results
|
|
|
74 #end if
|
|
|
75 #if 'median' in str($sampling_params.output_types):
|
|
|
76 --out_median $median_results
|
|
|
77 #end if
|
|
|
78 #if 'quantiles' in str($sampling_params.output_types):
|
|
|
79 --out_quantiles $quantile_results
|
|
|
80 #end if
|
|
|
81 #end if
|
|
|
82
|
|
|
83 #if 'FVA' in str($output_types_analysis):
|
|
|
84 --out_fva $fva_results
|
|
|
85 #end if
|
|
|
86 #if 'pFBA' in str($output_types_analysis):
|
|
|
87 --out_pfba $pFBA_results
|
|
|
88 #end if
|
|
|
89 #if 'sensitivity' in str($output_types_analysis):
|
|
|
90 --out_sensitivity $sensitivity_results
|
|
|
91 #end if
|
|
93
|
92 ]]>
|
|
|
93 </command>
|
|
489
|
94
|
|
93
|
95 <inputs>
|
|
489
|
96 <conditional name="model_and_bounds">
|
|
|
97 <param name="model_and_bounds" argument="--model_and_bounds" type="select" label="Upload mode:" help="Choose whether to upload the model and bounds in separate files or to upload multiple complete model files.">
|
|
|
98 <option value="True" selected="true">Model + bounds (separate files)</option>
|
|
|
99 <option value="False">Multiple complete models</option>
|
|
|
100 </param>
|
|
93
|
101
|
|
489
|
102 <when value="True">
|
|
|
103 <param name="model_upload" argument="--model_upload" type="data" format="csv,tsv,tabular"
|
|
|
104 label="Model (rules) file:"
|
|
|
105 help="Upload a CSV/TSV file that contains the model reaction rules. 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." />
|
|
|
106
|
|
|
107 <param name="inputs" argument="--inputs" multiple="true" type="data" format="tabular,csv,tsv"
|
|
|
108 label="Bound file(s):"
|
|
|
109 help="Upload one or more CSV/TSV files containing reaction bounds. 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." />
|
|
93
|
110 </when>
|
|
489
|
111
|
|
|
112 <when value="False">
|
|
|
113 <param name="model_files" argument="--model_files" multiple="true" type="data" format="csv,tsv,tabular"
|
|
|
114 label="Complete model files:"
|
|
|
115 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." />
|
|
|
116 </when>
|
|
|
117 </conditional>
|
|
93
|
118
|
|
489
|
119 <conditional name="sampling_params">
|
|
|
120 <param name="sampling_enabled" argument="--sampling_enabled" type="boolean" display="checkboxes" checked="false" label="Enable sampling" help="Enable flux sampling"/>
|
|
|
121
|
|
|
122 <when value="true">
|
|
|
123 <conditional name="algorithm_param">
|
|
|
124 <param name="algorithm" argument="--algorithm" type="select" label="Choose sampling algorithm:">
|
|
|
125 <option value="CBS" selected="true">CBS</option>
|
|
|
126 <option value="OPTGP">OPTGP</option>
|
|
|
127 </param>
|
|
|
128 <when value="OPTGP">
|
|
|
129 <param name="thinning" argument="--thinning" type="integer" label="Thinning:" value="100" help="Number of iterations to wait before taking a sample."/>
|
|
|
130 </when>
|
|
|
131 </conditional>
|
|
|
132
|
|
|
133 <param name="n_samples" argument="--n_samples" type="integer" label="Samples:" value="1000" min="1" max="1000"/>
|
|
|
134 <param name="n_batches" argument="--n_batches" type="integer" label="Batches:" value="1" help="This is useful for computational performances."/>
|
|
|
135 <param name="seed" argument="--seed" type="integer" label="Seed:" value="0" help="Random seed."/>
|
|
93
|
136
|
|
489
|
137 <param type="select" argument="--output_types" multiple="true" name="output_types" label="Choose outputs from sampling">
|
|
|
138 <option value="mean" selected="true">Mean</option>
|
|
|
139 <option value="median" selected="true">Median</option>
|
|
|
140 <option value="quantiles" selected="true">Quantiles</option>
|
|
|
141 <option value="fluxes" selected="false">All fluxes</option>
|
|
|
142 </param>
|
|
|
143 </when>
|
|
|
144
|
|
|
145 <when value="false">
|
|
|
146 <!-- Hidden parameters when sampling is disabled -->
|
|
|
147 <param name="algorithm" type="hidden" value="CBS"/>
|
|
|
148 <param name="n_samples" type="hidden" value="1000"/>
|
|
|
149 <param name="n_batches" type="hidden" value="1"/>
|
|
|
150 <param name="seed" type="hidden" value="0"/>
|
|
|
151 <param name="output_types" type="hidden" value="mean"/>
|
|
|
152 </when>
|
|
|
153 </conditional>
|
|
93
|
154
|
|
489
|
155 <param type="select" argument="--output_types_analysis" multiple="true" name="output_types_analysis" label="Choose outputs from optimization">
|
|
|
156 <option value="FVA" selected="true">FVA</option>
|
|
|
157 <option value="pFBA" selected="false">pFBA</option>
|
|
|
158 <option value="sensitivity" selected="false">Sensitivity reaction knock-out (Biomass)</option>
|
|
93
|
159 </param>
|
|
|
160
|
|
489
|
161 <conditional name="fva_params">
|
|
|
162 <param name="show_fva_options" type="boolean" display="checkboxes" checked="false" label="Configure FVA parameters" help="Show additional FVA configuration options"/>
|
|
|
163 <when value="true">
|
|
|
164 <param name="optimality_fraction" argument="--fva_optimality" type="float" label="FVA Optimality (fraction):" value="0.90" min="0.0" max="1.0"
|
|
|
165 help="Fraction of optimality for FVA analysis. 1.0 means the flux must be optimal, lower values allow suboptimal solutions."/>
|
|
|
166 </when>
|
|
|
167 <when value="false">
|
|
|
168 <param name="optimality_fraction" argument="--fva_optimality" type="hidden" value="1.0"/>
|
|
|
169 </when>
|
|
|
170 </conditional>
|
|
|
171
|
|
93
|
172 </inputs>
|
|
|
173
|
|
|
174 <outputs>
|
|
|
175 <data format="txt" name="log" label="Flux Simulation - Log" />
|
|
522
|
176
|
|
516
|
177 <collection name="fluxes_results" type="list" label="Fluxes">
|
|
522
|
178 <filter>sampling_params['sampling_enabled'] and 'fluxes' in sampling_params['output_types']</filter>
|
|
|
179 <discover_datasets name="collection" pattern="__name_and_ext__" directory="flux_simulation"/>
|
|
516
|
180 </collection>
|
|
522
|
181
|
|
516
|
182 <data format="tabular" name="mean_results" label="Mean">
|
|
522
|
183 <filter>sampling_params['sampling_enabled'] and 'mean' in sampling_params['output_types']</filter>
|
|
516
|
184 </data>
|
|
522
|
185
|
|
516
|
186 <data format="tabular" name="median_results" label="Median">
|
|
522
|
187 <filter>sampling_params['sampling_enabled'] and 'median' in sampling_params['output_types']</filter>
|
|
516
|
188 </data>
|
|
522
|
189
|
|
516
|
190 <data format="tabular" name="quantile_results" label="Quantiles">
|
|
522
|
191 <filter>sampling_params['sampling_enabled'] and 'quantiles' in sampling_params['output_types']</filter>
|
|
93
|
192 </data>
|
|
522
|
193
|
|
514
|
194 <data format="tabular" name="fva_results" label="FVA">
|
|
525
|
195 <filter>output_types_analysis and 'FVA' in output_types_analysis</filter>
|
|
514
|
196 </data>
|
|
522
|
197
|
|
516
|
198 <data format="tabular" name="pFBA_results" label="pFBA">
|
|
525
|
199 <filter>output_types_analysis and 'pFBA' in output_types_analysis</filter>
|
|
516
|
200 </data>
|
|
522
|
201
|
|
516
|
202 <data format="tabular" name="sensitivity_results" label="Sensitivity">
|
|
525
|
203 <filter>output_types_analysis and 'sensitivity' in output_types_analysis</filter>
|
|
516
|
204 </data>
|
|
93
|
205 </outputs>
|
|
|
206
|
|
|
207 <help>
|
|
|
208 <![CDATA[
|
|
|
209 What it does
|
|
|
210 -------------
|
|
|
211
|
|
489
|
212 This tool generates flux samples starting from metabolic models using CBS (Corner-based sampling) or OPTGP (Improved Artificial Centering Hit-and-Run sampler) algorithms.
|
|
93
|
213
|
|
489
|
214 Two upload modes are supported:
|
|
|
215 1. **Model + bounds**: Upload one base model and multiple bound files (one per context/cell type)
|
|
|
216 2. **Multiple complete models**: Upload multiple complete model files, each with integrated bounds
|
|
|
217
|
|
|
218 It can return sampled fluxes by applying summary statistics:
|
|
93
|
219 - mean
|
|
|
220 - median
|
|
489
|
221 - quantiles (0.25, 0.50, 0.75)
|
|
93
|
222
|
|
489
|
223 Flux analysis can be performed over the metabolic model by using the objective function already set in the model. The following analyses are supported:
|
|
|
224 - parsimonious-FBA (optimized by Biomass)
|
|
|
225 - FVA (with configurable optimality percentage)
|
|
|
226 - Biomass sensitivity analysis (single reaction knock-out)
|
|
93
|
227
|
|
|
228 Output:
|
|
|
229 -------------
|
|
|
230
|
|
|
231 The tool generates:
|
|
|
232 - Samples: reporting the sampled fluxes for each reaction (reaction names on the rows and sample names on the columns). Format: tab-separated.
|
|
|
233 - a log file (.txt).
|
|
|
234
|
|
489
|
235 **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.
|
|
|
236
|
|
|
237 **TIP**: The Batches parameter helps maintain memory efficiency. For 10,000 samples, use n_samples=1,000 and n_batches=10.
|
|
93
|
238
|
|
489
|
239 **TIP**: The Thinning parameter for OPTGP helps converge to stationary distribution.
|
|
|
240
|
|
|
241 **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.
|
|
93
|
242 ]]>
|
|
|
243 </help>
|
|
|
244 <expand macro="citations_fluxes" />
|
|
|
245 </tool> |