view COBRAxy/flux_to_map.xml @ 19:505b8574c017 draft

Uploaded
author luca_milaz
date Wed, 18 Sep 2024 12:49:47 +0000
parents 41f35c2f0c7b
children 10e8386ed410
line wrap: on
line source

<tool id="FluxToMap" name="Metabolic Flux Enrichment Analysis" 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.13.0">seaborn</requirement>
        <requirement type="package" version="1.10.1">scipy</requirement>
		<requirement type="package" version="1.5.1">svglib</requirement>
		<requirement type="package" version="2.2.3">pyvips</requirement>
		<requirement type="package" version="2.7.1">cairosvg</requirement>
		<requirement type="package" version="0.29.0">cobra</requirement>
		<requirement type="package" version="5.2.2">lxml</requirement>
	</requirements>
	
	<command detect_errors="exit_code">
		<![CDATA[
      	python $__tool_directory__/flux_to_map.py

      	--tool_dir $__tool_directory__
      	--option $cond.type_selector
        --out_log $log
		--color_map $color_map
	
        #if $cond.type_selector == 'datasets':

			--input_datas_fluxes
			#for $data in $cond.input_datasets_fluxes:
				${data.input_fluxes}
			#end for

			--names_fluxes
			#for $data in $cond.input_datasets_fluxes:
				${data.input_name_fluxes}
			#end for

        #elif $cond.type_selector == 'dataset_class':

			--input_data_fluxes $input_data_fluxes
			--input_class_fluxes $input_class_fluxes

        #end if

		--comparison ${comparis.comparison}
		#if $comparis.comparison == 'onevsmany'
			--control '${cond.comparis.controlgroup}'
		#end if

		--choice_map '${cond_choice_map.choice_map}'
		#if $cond_choice_map.choice_map == 'Custom':
			--custom_map ${cond_choice_map.custom_map}
		#end if
		
		#if $advanced.choice == 'true':
			--pValue ${advanced.pValue}
			--fChange ${advanced.fChange}
			--generate_svg ${advanced.generateSvg}
			--generate_pdf ${advanced.generatePdf}
		#else 
			--pValue 0.05
			--fChange 1.2
			--generate_svg false
			--generate_pdf true
		#end if
        ]]>
	</command>
	
	<inputs>

		<conditional name="cond">
			<param name="type_selector" argument="--option" type="select" label="Input format:">
				<option value="datasets" selected="true">Fluxes of group 1 + Fluxes of group 2 + ... + Fluxes of group N</option>
				<option value="dataset_class">All fluxes + sample group specification</option>
			</param>

			<when value="datasets">
				<repeat name="input_datasets_fluxes" title="Fluxes dataset" min="2">
					<param name="input_fluxes" argument="--input_datas_fluxes" type="data" format="tabular, csv, tsv" label="add dataset" />
					<param name="input_name_fluxes" argument="--names_fluxes" type="text" label="Dataset's name:" value="Dataset" help="Default: Dataset" />
				</repeat>
			</when>

			<when value="dataset_class">
				<param name="input_data_fluxes" argument="--input_data_fluxes" type="data" format="tabular, csv, tsv" label="All fluxes" />
				<param name="input_class_fluxes" argument="--input_class_fluxes" type="data" format="tabular, csv, tsv" label="Sample group specification" />
			</when>
		</conditional>

		<conditional name="comparis">
			<param name="comparison" argument="--comparison" type="select" label="Groups comparison:">
				<option value="manyvsmany" selected="true">One vs One</option>
				<option value="onevsrest">One vs All</option>
				<option value="onevsmany">One vs Control</option>
			</param>
			<when value="onevsmany">
				<param name="controlgroup" argument="--controlgroup" type="text" label="Control group label:" value="0" help="Name of group label to be compared to others"/>
			</when>
		</conditional>
		
		<conditional name="cond_choice_map">
			<param name="choice_map" argument="--choice_map" type="select" label="Choose metabolic map:">
				<option value="ENGRO2" selected="true">ENGRO2</option>
				<option value="HMRcore" >HMRcore</option>
				<option value="Custom">Custom</option>
			</param>

			<when value="Custom">				
				<param name="custom_map" argument="--custom_map" type="data" format="xml, svg" label="custom-map.svg"/>
			</when>
		</conditional>

		<param name="color_map" argument="--color_map" type="select" label="Color map:">
				<option value="viridis" selected="true">Viridis</option>
				<option value="jet">Jet</option>
		</param>

		<conditional name="advanced">
			<param name="choice" type="boolean" checked="false" label="Use advanced options?" help="Use this options to choose custom parameters for evaluation: pValue, Fold-Change threshold, how to solve (A and NaN) and specify output maps.">
				<option value="true" selected="true">No</option>
				<option value="false">Yes</option>
			</param>

			<when value="true">
				<param name="pValue" argument="--pValue" type="float" size="20" value="0.05" max="1" min="0" label="P-value threshold:" help="min value 0" />
				<param name="fChange" argument="--fChange" type="float" size="20" value="1.2" min="1" label="Fold-Change threshold:" help="min value 1" />
				<param name="generateSvg" argument="--generateSvg" type="boolean" checked="false" label="Generate SVG map" help="should the program generate an editable svg map of the processes?" />
				<param name="generatePdf" argument="--generatePdf" type="boolean" checked="true" label="Generate PDF map" help="should the program return a non editable (but displayble) pdf map of the processes?" />
			</when>
		</conditional>
	</inputs>

	<outputs>
		<data format="txt" name="log" label="FluxToMap - Log" />
		<collection name="results" type="list" label="FluxToMap - Results">
			<discover_datasets pattern="__name_and_ext__" directory="result"/>
		</collection>
	</outputs>
	
	<help>
	<![CDATA[

What it does
-------------

This tool analyzes and visualizes differences in reactions fluxes of groups of samples, returned by the Flux Simulation tool, of groups of samples.

Accepted files are: 
    - option 1) two or more fluxes datasets, each referring to samples in a given group. The user can specify a label for each group;
    - option 2) one fluxes dataset and one group-file specifying the group each sample belongs to (e.g. the accepted group file is thought to be the one returned by the Clustering tool).

Optional files:
    - custom svg map. Graphical elements must have the same IDs of reactions. See HmrCore svg map for an example.

The tool generates:
    - 1) a tab-separated file: reporting fold-change and p-values of fluxes between a pair of conditions/classes;
    - 2) a metabolic map file (downloadable as .svg): visualizing up- and down-regulated reactions between a pair of conditions/classes;
    - 3) a log file (.txt).
    
Output options:
To calculate P-Values and Fold-Changes and to enrich maps, comparisons are performed for each possible pair of groups (default option ‘One vs One’).

Alternative options are:
    - comparison of each group vs. the rest of samples (option ‘One vs Rest’)
    - comparison of each group vs. a control group (option ‘One vs Control). If this option is selected the user must indicate the control group label.

Output files will be named as classA_vs_classB. Reactions will conventionally be reported as up-regulated (down-regulated) if they are significantly more (less) active in class having label "classA".

Example input
-------------

"Fluxes of group 1 + Fluxes of group 2 + ... + Fluxes of group N" option:

Fluxes Dataset 1:

+------------+----------------+----------------+----------------+ 
| Reaction ID|   TCGAA62670   |   TCGAA62671   |   TCGAA62672   |  
+============+================+================+================+
| r1642      |    0.523167    |    0.371355    |    0.925661    |  
+------------+----------------+----------------+----------------+    
| r1643      |    0.568765    |    0.765567    |    0.456789    |    
+------------+----------------+----------------+----------------+    
| r1640      |    0.876545    |    0.768933    |    0.987654    |  
+------------+----------------+----------------+----------------+
| r1641      |    0.456788    |    0.876543    |    0.876542    |    
+------------+----------------+----------------+----------------+    
| r1646      |    0.876543    |    0.786543    |    0.897654    |   
+------------+----------------+----------------+----------------+

Fluxes Dataset 2:

+------------+----------------+----------------+----------------+ 
| Reaction ID|   TCGAA62670   |   TCGAA62671   |   TCGAA62672   |  
+============+================+================+================+
| r1642      |    0.523167    |    0.371355    |    0.925661    |  
+------------+----------------+----------------+----------------+    
| r1643      |    0.568765    |    0.765567    |    0.456789    |    
+------------+----------------+----------------+----------------+    
| r1640      |    0.876545    |    0.768933    |    0.987654    |  
+------------+----------------+----------------+----------------+
| r1641      |    0.456788    |    0.876543    |    0.876542    |    
+------------+----------------+----------------+----------------+    
| r1646      |    0.876543    |    0.786543    |    0.897654    |   
+------------+----------------+----------------+----------------+

"Fluxes of all samples + sample group specification" option:

Fluxes Dataset:

+------------+----------------+----------------+----------------+ 
| Reaction ID|   TCGAA62670   |   TCGAA62671   |   TCGAA62672   |  
+============+================+================+================+
| r1642      |    0.523167    |    0.371355    |    0.925661    |  
+------------+----------------+----------------+----------------+    
| r1643      |    0.568765    |    0.765567    |    0.456789    |    
+------------+----------------+----------------+----------------+    
| r1640      |    0.876545    |    0.768933    |    0.987654    |  
+------------+----------------+----------------+----------------+
| r1641      |    0.456788    |    0.876543    |    0.876542    |    
+------------+----------------+----------------+----------------+    
| r1646      |    0.876543    |    0.786543    |    0.897654    |   
+------------+----------------+----------------+----------------+

Group-file

+---------------+-----------+
| Patient ID    |   Class   | 
+===============+===========+
| TCGAAA3529    |    MSI    | 
+---------------+-----------+  
| TCGAA62671    |    MSS    |    
+---------------+-----------+   
| TCGAA62672    |    MSI    |
+---------------+-----------+


**TIP**: If your dataset is not split into classes, use `MaREA cluster analysis`_.

.. class:: infomark


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