diff COBRAxy/src/exportMetabolicModel.xml @ 540:7d5b35c715e8 draft

Uploaded
author francesco_lapi
date Sat, 25 Oct 2025 15:08:19 +0000
parents
children fcdbc81feb45
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/COBRAxy/src/exportMetabolicModel.xml	Sat Oct 25 15:08:19 2025 +0000
@@ -0,0 +1,82 @@
+<tool id="exportMetabolicModel" name="Export Metabolic Model" version="1.0.0">
+    <description>Export a tabular model to file format (SBML, JSON, MAT or YAML)</description>
+
+    <!-- Python dependencies required for COBRApy -->
+    <requirements>
+        <requirement type="package" version="0.29.0">cobra</requirement>
+        <requirement type="package" version="1.24.4">numpy</requirement>
+        <requirement type="package" version="2.0.3">pandas</requirement>
+        <requirement type="package" version="5.2.2">lxml</requirement>
+    </requirements>
+
+    <!-- Import shared macros if available -->
+    <macros>
+        <import>marea_macros.xml</import>
+    </macros>
+
+    <!-- Command to run the Python script -->
+    <command detect_errors="exit_code"><![CDATA[
+        python $__tool_directory__/exportMetabolicModel.py
+            --tool_dir $__tool_directory__
+            --input $input 
+            --format $format
+            --output $output
+            --out_log $log
+    ]]></command>
+
+    <!-- Tool inputs -->
+    <inputs>
+        <param name="input" type="data" format="tabular,csv,tsv" label="Model tabular:"/>
+        <param name="model_name" type="text" value="Converted_Model" label="Output model name:" help="Name for the created COBRA model"/>
+        <param name="format" type="select" label="Output format">
+            <option value="sbml" selected="true">SBML (.xml)</option>
+            <option value="json">JSON (.json)</option>
+            <option value="mat">MATLAB (.mat)</option>
+            <option value="yaml">YAML (.yml)</option>
+        </param>
+    </inputs>
+
+    <!-- Tool outputs -->
+    <outputs>
+        <data name="log" format="txt" label="Tabular to Model Conversion - Log" />
+        <data name="output" format="xml" label="${model_name}.${format}">
+            <change_format>
+                <when input="format" value="sbml" format="xml"/>
+                <when input="format" value="json" format="json"/>
+                <when input="format" value="mat" format="mat"/>
+                <when input="format" value="yaml" format="yaml"/>
+            </change_format>
+        </data>
+    </outputs>
+
+    <!-- Help section -->
+    <help><![CDATA[
+This tool exports a tabular dataset into a standard metabolic model file formats using COBRApy.
+
+**Input**
+- A tabular/CSV/TSV file describing the metabolic properties of the model (reactions, metabolites, and genes), as generated by the Import Metabolic Model tool.
+
+The possible columns are:
+    - ReactionID: unique identifier of the reactions
+    - Formula: chemical equation showing the metabolites involved in the reaction and their stoichiometric coefficients.
+    - GPR: gene-protein-reaction association, expressed as a logical rule describing how genes contribute to catalyzing the reaction.
+    - lower bound: minimum allowable flux value for the reaction.
+    - upper bound: maximum allowable flux value for the reaction.
+    - Objective coefficient: coefficient used in the objective function (e.g., for pFBA or FVA analyses).
+    - Pathway_1,Pathway_2,etc.: possible pathways in which the reaction is involved.
+    - InMedium: TRUE if the reaction represents nutrient uptake from the medium, FALSE otherwise.
+
+Columns ReactionID and Formula are mandatory.
+
+**Output**
+- A COBRA model in the chosen format:  
+  - SBML (.xml)  
+  - JSON (.json)  
+  - MATLAB (.mat)  
+  - YAML (.yml)  
+
+**Notes**
+- The exact table structure (columns required) depends on how you want to encode reactions and metabolites.  
+- You can extend the Python script to parse specific column formats.  
+    ]]></help>
+</tool>