view COBRAxy/flux_simulation.xml @ 99:9f1a751652fc draft

Uploaded
author luca_milaz
date Sun, 13 Oct 2024 11:54:36 +0000
parents 7e703e546998
children 1977baf41548
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.10.1">scipy</requirement>
	</requirements>

    <command detect_errors="exit_code">
        <![CDATA[
        python $__tool_directory__/flux_simulation.py
        --tool_dir $__tool_directory__
        --model_selector $cond_model.model_selector
        #if $cond_model.model_selector == 'Custom'
            --model $model
            --model_name $model.element_identifier
        #end if
        --input "${",".join(map(str, $inputs))}"
        #set $names = ""
        #for $input_temp in $inputs:
            #set $names = $names + $input_temp.element_identifier + ","
        #end for
        --name $names
        --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="cond_model">
            <expand macro="options_ras_to_bounds_model"/>
            <when value="Custom">
                <param name="model" argument="--model" type="data" format="json, xml" label="Custom model" />
            </when>
        </conditional> 

        <param name="inputs" argument="--inputs" multiple="true" type="data" format="tabular, csv, tsv" label="Bound(s):" />
        
        
        <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="10" help="This is useful for computational perfomances."/>

        <param name="seed" argument="--seed" type="integer" label="Seed:" value="0" helph="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 a model in JSON or XML format by using CBS (Corner-based sampling) or OPTGP (Improved Artificial Centering Hit-and-Run sampler) sampling algorithms.

It can return sampled fluxes by appliying summary statistics: 
   - mean
   - median
   - quantiles (0.25, 0.50, 0.75). 

Flux analysis can be perfomed over the metabolic model:
   - parsimoniuos-FBA (optimized by Biomass)
   - FVA
   - Biomass sensitivity analysis (single reaction knock-out). It is the ratio between the optimal of the Biomass reaction computed by FBA after knocking-out a reaction and the same over the complete model.

Accepted files:
   - A model: JSON or XML file reporting reactions and rules contained in the model. It can be ENGRO2 or a custom model. 
   - Context-specific bounds: generated by RAS to Bounds tool. This can be a collection of bounds too (one bounds file per context).

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 is useful to mantain in memory just a batch of samples at time. For example, if you wish to sample 10.000 points, than it is suggested to select n_samples = 1.000 and n_batches=10.
**TIP**: The Thinning parameter of the OPTGP algorithm is useful to converge to a stationary distribution (see cited articles by Galuzzi, Milazzo and Damiani).

]]>
    </help>
    <expand macro="citations_fluxes" />
 
</tool>