Mercurial > repos > bimib > cobraxy
view COBRAxy/flux_simulation.xml @ 516:7726a4a7173f draft
Uploaded
author | luca_milaz |
---|---|
date | Thu, 09 Oct 2025 09:32:41 +0000 |
parents | e24998921824 |
children | c3c1d3b3941f |
line wrap: on
line source
<tool id="fluxSimulation" name="Flux Simulation" version="2.0.0"> <macros> <import>marea_macros.xml</import> </macros> <requirements> <requirement type="package" version="1.24.4">numpy</requirement> <requirement type="package" version="2.0.3">pandas</requirement> <requirement type="package" version="0.29.0">cobra</requirement> <requirement type="package" version="5.2.2">lxml</requirement> <requirement type="package" version="1.4.2">joblib</requirement> <requirement type="package" version="1.11">scipy</requirement> </requirements> <command detect_errors="exit_code"> <![CDATA[ python $__tool_directory__/flux_simulation.py --tool_dir $__tool_directory__ --model_and_bounds $model_and_bounds.model_and_bounds #if $model_and_bounds.model_and_bounds == 'True': --model_upload $model_and_bounds.model_upload --input "${",".join(map(str, $model_and_bounds.inputs))}" #set $names_list = [] #for $input_temp in $model_and_bounds.inputs: #silent $names_list.append(str($input_temp.element_identifier)) #end for --name "${",".join($names_list)}" #else: --input "${",".join(map(str, $model_and_bounds.model_files))}" #set $names_list = [] #for $input_temp in $model_and_bounds.model_files: #silent $names_list.append(str($input_temp.element_identifier)) #end for --name "${",".join($names_list)}" #end if --sampling_enabled $sampling_params.sampling_enabled #if $sampling_params.sampling_enabled == 'true': --thinning 0 #if $sampling_params.algorithm_param.algorithm == 'OPTGP': --thinning $sampling_params.algorithm_param.thinning #end if --algorithm $sampling_params.algorithm_param.algorithm --n_batches $sampling_params.n_batches --n_samples $sampling_params.n_samples --seed $sampling_params.seed --output_type "${",".join(map(str, $sampling_params.output_types))}" #else: --thinning 0 --algorithm 'CBS' --n_batches 1 --n_samples 1 --seed 0 --output_type 'mean' #end if --output_type_analysis "${",".join(map(str, $output_types_analysis))}" #if 'FVA' in str($output_types_analysis): --perc_opt $fva_params.optimality_fraction #end if --out_log $log --out_fluxes $fluxes_results --out_mean $mean_results --out_median $median_results --out_quantiles $quantile_results --out_fva $fva_results --out_pfba $pFBA_results --out_sensitivity $sensitivity_results ]]> </command> <inputs> <conditional name="model_and_bounds"> <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."> <option value="True" selected="true">Model + bounds (separate files)</option> <option value="False">Multiple complete models</option> </param> <when value="True"> <param name="model_upload" argument="--model_upload" type="data" format="csv,tsv,tabular" label="Model (rules) file:" 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." /> <param name="inputs" argument="--inputs" multiple="true" type="data" format="tabular,csv,tsv" label="Bound file(s):" 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." /> </when> <when value="False"> <param name="model_files" argument="--model_files" multiple="true" type="data" format="csv,tsv,tabular" label="Complete model files:" 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." /> </when> </conditional> <conditional name="sampling_params"> <param name="sampling_enabled" argument="--sampling_enabled" type="boolean" display="checkboxes" checked="false" label="Enable sampling" help="Enable flux sampling"/> <when value="true"> <conditional name="algorithm_param"> <param name="algorithm" argument="--algorithm" type="select" label="Choose sampling algorithm:"> <option value="CBS" selected="true">CBS</option> <option value="OPTGP">OPTGP</option> </param> <when value="OPTGP"> <param name="thinning" argument="--thinning" type="integer" label="Thinning:" value="100" help="Number of iterations to wait before taking a sample."/> </when> </conditional> <param name="n_samples" argument="--n_samples" type="integer" label="Samples:" value="1000" min="1" max="1000"/> <param name="n_batches" argument="--n_batches" type="integer" label="Batches:" value="1" help="This is useful for computational performances."/> <param name="seed" argument="--seed" type="integer" label="Seed:" value="0" help="Random seed."/> <param type="select" argument="--output_types" multiple="true" name="output_types" label="Choose outputs from sampling"> <option value="mean" selected="true">Mean</option> <option value="median" selected="true">Median</option> <option value="quantiles" selected="true">Quantiles</option> <option value="fluxes" selected="false">All fluxes</option> </param> </when> <when value="false"> <!-- Hidden parameters when sampling is disabled --> <param name="algorithm" type="hidden" value="CBS"/> <param name="n_samples" type="hidden" value="1000"/> <param name="n_batches" type="hidden" value="1"/> <param name="seed" type="hidden" value="0"/> <param name="output_types" type="hidden" value="mean"/> </when> </conditional> <param type="select" argument="--output_types_analysis" multiple="true" name="output_types_analysis" label="Choose outputs from optimization"> <option value="FVA" selected="true">FVA</option> <option value="pFBA" selected="false">pFBA</option> <option value="sensitivity" selected="false">Sensitivity reaction knock-out (Biomass)</option> </param> <conditional name="fva_params"> <param name="show_fva_options" type="boolean" display="checkboxes" checked="false" label="Configure FVA parameters" help="Show additional FVA configuration options"/> <when value="true"> <param name="optimality_fraction" argument="--fva_optimality" type="float" label="FVA Optimality (fraction):" value="0.90" min="0.0" max="1.0" help="Fraction of optimality for FVA analysis. 1.0 means the flux must be optimal, lower values allow suboptimal solutions."/> </when> <when value="false"> <param name="optimality_fraction" argument="--fva_optimality" type="hidden" value="1.0"/> </when> </conditional> </inputs> <outputs> <data format="txt" name="log" label="Flux Simulation - Log" /> <!---<data name="output" format="tabular" label="Fluxes"> <discover_datasets pattern="__name_and_ext__" directory="flux_simulation" visible="true" /> </data>--> <collection name="fluxes_results" type="list" label="Fluxes"> <filter>'fluxes' in str($sampling_params.output_types)</filter> <discover_datasets name = "collection" pattern="__name_and_ext__" directory="flux_simulation"/> </collection> <data format="tabular" name="mean_results" label="Mean"> <filter>'mean' in str($sampling_params.output_types)</filter> </data> <data format="tabular" name="median_results" label="Median"> <filter>'median' in str($sampling_params.output_types)</filter> </data> <data format="tabular" name="quantile_results" label="Quantiles"> <filter>'quantiles' in str($sampling_params.output_types)</filter> </data> <data format="tabular" name="fva_results" label="FVA"> <filter>'FVA' in str($output_types_analysis)</filter> </data> <data format="tabular" name="pFBA_results" label="pFBA"> <filter>'pFBA' in str($output_types_analysis)</filter> </data> <data format="tabular" name="sensitivity_results" label="Sensitivity"> <filter>'sensitivity' in str($output_types_analysis)</filter> </data> </outputs> <help> <![CDATA[ What it does ------------- This tool generates flux samples starting from metabolic models using CBS (Corner-based sampling) or OPTGP (Improved Artificial Centering Hit-and-Run sampler) algorithms. Two upload modes are supported: 1. **Model + bounds**: Upload one base model and multiple bound files (one per context/cell type) 2. **Multiple complete models**: Upload multiple complete model files, each with integrated bounds It can return sampled fluxes by applying summary statistics: - mean - median - quantiles (0.25, 0.50, 0.75) Flux analysis can be performed over the metabolic model by using the objective function already set in the model. The following analyses are supported: - parsimonious-FBA (optimized by Biomass) - FVA (with configurable optimality percentage) - Biomass sensitivity analysis (single reaction knock-out) Output: ------------- The tool generates: - Samples: reporting the sampled fluxes for each reaction (reaction names on the rows and sample names on the columns). Format: tab-separated. - a log file (.txt). **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. **TIP**: The Batches parameter helps maintain memory efficiency. For 10,000 samples, use n_samples=1,000 and n_batches=10. **TIP**: The Thinning parameter for OPTGP helps converge to stationary distribution. **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. ]]> </help> <expand macro="citations_fluxes" /> </tool>