Mercurial > repos > bimib > cobraxy
changeset 442:37cb70ff98b1 draft
Uploaded
author | francesco_lapi |
---|---|
date | Wed, 10 Sep 2025 16:45:58 +0000 |
parents | ee39c2579400 |
children | 3d4e10546917 |
files | flux_simulation_beta.xml |
diffstat | 1 files changed, 145 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flux_simulation_beta.xml Wed Sep 10 16:45:58 2025 +0000 @@ -0,0 +1,145 @@ +<tool id="fluxSimulation - Beta" name="Flux Simulation - BETA" 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_beta.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 = "" + #for $input_temp in $model_and_bounds.inputs: + #set $names = $names + $input_temp.element_identifier + "," + #end for + --name $names + #else: + --input "${",".join(map(str, $model_and_bounds.model_files))}" + #set $names = "" + #for $input_temp in $model_and_bounds.model_files: + #set $names = $names + $input_temp.element_identifier + "," + #end for + --name $names + #end if + + --thinning 0 + #if $algorithm_param.algorithm == 'OPTGP': + --thinning $algorithm_param.thinning + #end if + --algorithm $algorithm_param.algorithm + --n_batches $n_batches + --n_samples $n_samples + --seed $seed + --output_type "${",".join(map(str, $output_types))}" + --output_type_analysis "${",".join(map(str, $output_types_analysis))}" + --out_log $log + ]]> + </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="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"/> + <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="Desired 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> + + <param type="select" argument="--output_types_analysis" multiple="true" name="output_types_analysis" label="Desired outputs from flux analysis"> + <option value="pFBA" selected="false">pFBA</option> + <option value="FVA" selected="false">FVA</option> + <option value="sensitivity" selected="false">Sensitivity reaction knock-out (Biomass)</option> + </param> + </inputs> + + <outputs> + <data format="txt" name="log" label="Flux Simulation - Log" /> + <data name="output" format="tabular" label="Flux Simulation - Output"> + <discover_datasets pattern="__name_and_ext__" directory="flux_simulation" visible="true" /> + </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: + - parsimonious-FBA (optimized by Biomass) + - FVA + - 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**: 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. +]]> + </help> + <expand macro="citations_fluxes" /> +</tool> \ No newline at end of file