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__
|
516
|
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
|
93
|
61 --output_type_analysis "${",".join(map(str, $output_types_analysis))}"
|
489
|
62
|
|
63 #if 'FVA' in str($output_types_analysis):
|
|
64 --perc_opt $fva_params.optimality_fraction
|
|
65 #end if
|
|
66
|
93
|
67 --out_log $log
|
516
|
68 --out_fluxes $fluxes_results
|
|
69 --out_mean $mean_results
|
|
70 --out_median $median_results
|
|
71 --out_quantiles $quantile_results
|
|
72 --out_fva $fva_results
|
|
73 --out_pfba $pFBA_results
|
|
74 --out_sensitivity $sensitivity_results
|
93
|
75 ]]>
|
|
76 </command>
|
489
|
77
|
93
|
78 <inputs>
|
489
|
79 <conditional name="model_and_bounds">
|
|
80 <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.">
|
|
81 <option value="True" selected="true">Model + bounds (separate files)</option>
|
|
82 <option value="False">Multiple complete models</option>
|
|
83 </param>
|
93
|
84
|
489
|
85 <when value="True">
|
|
86 <param name="model_upload" argument="--model_upload" type="data" format="csv,tsv,tabular"
|
|
87 label="Model (rules) file:"
|
|
88 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." />
|
|
89
|
|
90 <param name="inputs" argument="--inputs" multiple="true" type="data" format="tabular,csv,tsv"
|
|
91 label="Bound file(s):"
|
|
92 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
|
93 </when>
|
489
|
94
|
|
95 <when value="False">
|
|
96 <param name="model_files" argument="--model_files" multiple="true" type="data" format="csv,tsv,tabular"
|
|
97 label="Complete model files:"
|
|
98 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." />
|
|
99 </when>
|
|
100 </conditional>
|
93
|
101
|
489
|
102 <conditional name="sampling_params">
|
|
103 <param name="sampling_enabled" argument="--sampling_enabled" type="boolean" display="checkboxes" checked="false" label="Enable sampling" help="Enable flux sampling"/>
|
|
104
|
|
105 <when value="true">
|
|
106 <conditional name="algorithm_param">
|
|
107 <param name="algorithm" argument="--algorithm" type="select" label="Choose sampling algorithm:">
|
|
108 <option value="CBS" selected="true">CBS</option>
|
|
109 <option value="OPTGP">OPTGP</option>
|
|
110 </param>
|
|
111 <when value="OPTGP">
|
|
112 <param name="thinning" argument="--thinning" type="integer" label="Thinning:" value="100" help="Number of iterations to wait before taking a sample."/>
|
|
113 </when>
|
|
114 </conditional>
|
|
115
|
|
116 <param name="n_samples" argument="--n_samples" type="integer" label="Samples:" value="1000" min="1" max="1000"/>
|
|
117 <param name="n_batches" argument="--n_batches" type="integer" label="Batches:" value="1" help="This is useful for computational performances."/>
|
|
118 <param name="seed" argument="--seed" type="integer" label="Seed:" value="0" help="Random seed."/>
|
93
|
119
|
489
|
120 <param type="select" argument="--output_types" multiple="true" name="output_types" label="Choose outputs from sampling">
|
|
121 <option value="mean" selected="true">Mean</option>
|
|
122 <option value="median" selected="true">Median</option>
|
|
123 <option value="quantiles" selected="true">Quantiles</option>
|
|
124 <option value="fluxes" selected="false">All fluxes</option>
|
|
125 </param>
|
|
126 </when>
|
|
127
|
|
128 <when value="false">
|
|
129 <!-- Hidden parameters when sampling is disabled -->
|
|
130 <param name="algorithm" type="hidden" value="CBS"/>
|
|
131 <param name="n_samples" type="hidden" value="1000"/>
|
|
132 <param name="n_batches" type="hidden" value="1"/>
|
|
133 <param name="seed" type="hidden" value="0"/>
|
|
134 <param name="output_types" type="hidden" value="mean"/>
|
|
135 </when>
|
|
136 </conditional>
|
93
|
137
|
489
|
138 <param type="select" argument="--output_types_analysis" multiple="true" name="output_types_analysis" label="Choose outputs from optimization">
|
|
139 <option value="FVA" selected="true">FVA</option>
|
|
140 <option value="pFBA" selected="false">pFBA</option>
|
|
141 <option value="sensitivity" selected="false">Sensitivity reaction knock-out (Biomass)</option>
|
93
|
142 </param>
|
|
143
|
489
|
144 <conditional name="fva_params">
|
|
145 <param name="show_fva_options" type="boolean" display="checkboxes" checked="false" label="Configure FVA parameters" help="Show additional FVA configuration options"/>
|
|
146 <when value="true">
|
|
147 <param name="optimality_fraction" argument="--fva_optimality" type="float" label="FVA Optimality (fraction):" value="0.90" min="0.0" max="1.0"
|
|
148 help="Fraction of optimality for FVA analysis. 1.0 means the flux must be optimal, lower values allow suboptimal solutions."/>
|
|
149 </when>
|
|
150 <when value="false">
|
|
151 <param name="optimality_fraction" argument="--fva_optimality" type="hidden" value="1.0"/>
|
|
152 </when>
|
|
153 </conditional>
|
|
154
|
93
|
155 </inputs>
|
|
156
|
|
157 <outputs>
|
|
158 <data format="txt" name="log" label="Flux Simulation - Log" />
|
516
|
159 <!---<data name="output" format="tabular" label="Fluxes">
|
489
|
160 <discover_datasets pattern="__name_and_ext__" directory="flux_simulation" visible="true" />
|
516
|
161 </data>-->
|
|
162 <collection name="fluxes_results" type="list" label="Fluxes">
|
|
163 <filter>'fluxes' in str($sampling_params.output_types)</filter>
|
|
164 <discover_datasets name = "collection" pattern="__name_and_ext__" directory="flux_simulation"/>
|
|
165 </collection>
|
|
166 <data format="tabular" name="mean_results" label="Mean">
|
|
167 <filter>'mean' in str($sampling_params.output_types)</filter>
|
|
168 </data>
|
|
169 <data format="tabular" name="median_results" label="Median">
|
|
170 <filter>'median' in str($sampling_params.output_types)</filter>
|
|
171 </data>
|
|
172 <data format="tabular" name="quantile_results" label="Quantiles">
|
|
173 <filter>'quantiles' in str($sampling_params.output_types)</filter>
|
93
|
174 </data>
|
514
|
175 <data format="tabular" name="fva_results" label="FVA">
|
|
176 <filter>'FVA' in str($output_types_analysis)</filter>
|
|
177 </data>
|
516
|
178 <data format="tabular" name="pFBA_results" label="pFBA">
|
|
179 <filter>'pFBA' in str($output_types_analysis)</filter>
|
|
180 </data>
|
|
181 <data format="tabular" name="sensitivity_results" label="Sensitivity">
|
|
182 <filter>'sensitivity' in str($output_types_analysis)</filter>
|
|
183 </data>
|
93
|
184 </outputs>
|
|
185
|
|
186 <help>
|
|
187 <![CDATA[
|
|
188 What it does
|
|
189 -------------
|
|
190
|
489
|
191 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
|
192
|
489
|
193 Two upload modes are supported:
|
|
194 1. **Model + bounds**: Upload one base model and multiple bound files (one per context/cell type)
|
|
195 2. **Multiple complete models**: Upload multiple complete model files, each with integrated bounds
|
|
196
|
|
197 It can return sampled fluxes by applying summary statistics:
|
93
|
198 - mean
|
|
199 - median
|
489
|
200 - quantiles (0.25, 0.50, 0.75)
|
93
|
201
|
489
|
202 Flux analysis can be performed over the metabolic model by using the objective function already set in the model. The following analyses are supported:
|
|
203 - parsimonious-FBA (optimized by Biomass)
|
|
204 - FVA (with configurable optimality percentage)
|
|
205 - Biomass sensitivity analysis (single reaction knock-out)
|
93
|
206
|
|
207 Output:
|
|
208 -------------
|
|
209
|
|
210 The tool generates:
|
|
211 - Samples: reporting the sampled fluxes for each reaction (reaction names on the rows and sample names on the columns). Format: tab-separated.
|
|
212 - a log file (.txt).
|
|
213
|
489
|
214 **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.
|
|
215
|
|
216 **TIP**: The Batches parameter helps maintain memory efficiency. For 10,000 samples, use n_samples=1,000 and n_batches=10.
|
93
|
217
|
489
|
218 **TIP**: The Thinning parameter for OPTGP helps converge to stationary distribution.
|
|
219
|
|
220 **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
|
221 ]]>
|
|
222 </help>
|
|
223 <expand macro="citations_fluxes" />
|
|
224 </tool> |