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