From d9c58620fce29f300838f319016d21adfb10986f Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 1 Apr 2022 18:09:05 +0200
Subject: [PATCH 01/83] Methods to create the json description of an app

---
 met4j-toolbox/pom.xml                         |   5 +
 .../generic/AbstractMet4jApplication.java     | 135 ++++++++++++++++++
 2 files changed, 140 insertions(+)

diff --git a/met4j-toolbox/pom.xml b/met4j-toolbox/pom.xml
index 622b33e8f..6df8cf534 100644
--- a/met4j-toolbox/pom.xml
+++ b/met4j-toolbox/pom.xml
@@ -66,6 +66,11 @@
             <artifactId>json-simple</artifactId>
             <version>1.1.1</version>
         </dependency>
+        <dependency>
+            <groupId>org.hibernate.validator</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <version>6.0.17.Final</version>
+        </dependency>
     </dependencies>
 
     <description>Bundle of all met4j modules and api</description>
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index ee2d2d203..9ca9568d1 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -36,9 +36,17 @@
 
 package fr.inrae.toulouse.metexplore.met4j_toolbox.generic;
 
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
 import org.kohsuke.args4j.CmdLineException;
 import org.kohsuke.args4j.CmdLineParser;
 import org.kohsuke.args4j.Option;
+import org.hibernate.validator.constraints.Range;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
 
 /**
  * <p>Abstract AbstractMet4jApplication class.</p>
@@ -48,6 +56,133 @@ import org.kohsuke.args4j.Option;
  */
 public abstract class AbstractMet4jApplication {
 
+    private ArrayList<HashMap<String, String>> options = new ArrayList<HashMap<String, String>>();
+
+    /**
+     * Inits the options from the field annotations
+     *
+     * @throws IllegalArgumentException
+     * @throws IllegalAccessException
+     */
+    private void initOptions() throws IllegalArgumentException, IllegalAccessException {
+        // Browse each class field
+        for (Field f : this.getClass().getDeclaredFields()) {
+            // Browse each annotation of the field
+            HashMap<String, String> map = new HashMap<String, String>();
+
+            Boolean flag = false;
+
+            for (Annotation a : f.getDeclaredAnnotations()) {
+                if (a instanceof Option) {
+                    flag = true;
+                    Option option = (Option) a;
+
+                    map.put("name", f.getName());
+
+                    map.put("description", option.usage());
+                    if (!option.metaVar().equals("")) {
+                        map.put("metaVar", option.metaVar());
+                    } else {
+                        map.put("metaVar", "");
+                    }
+
+                    if (f.getType().isEnum()) {
+                        map.put("type", "String");
+                    } else {
+                        map.put("type", f.getType().getSimpleName());
+                    }
+
+                    String required = "false";
+                    if (option.required()) {
+                        required = "true";
+                    }
+                    map.put("required", required);
+
+                    String defaultValue = "";
+                    if (f.get(this) != null) {
+                        defaultValue = f.get(this).toString();
+                    }
+                    map.put("default", defaultValue);
+
+                    if (f.getType().isEnum()) {
+
+                        Enum<?> enumValue = (Enum<?>) f.get(this);
+
+                        Object[] possibleValues = enumValue.getDeclaringClass().getEnumConstants();
+
+                        String choices = "";
+
+                        int n = 0;
+
+                        for (Object object : possibleValues) {
+
+                            String choice = object.toString();
+
+                            if (n > 0) {
+                                choices += ",";
+                            }
+
+                            choices += choice;
+
+                            n++;
+                        }
+
+                        map.put("choices", choices);
+                    }
+
+                } else if (a instanceof Range) {
+                    Range option = (Range) a;
+
+                    map.put("min", Double.toString(option.min()));
+                    map.put("max", Double.toString(option.max()));
+
+                }
+            }
+            if (flag) {
+                options.add(map);
+            }
+
+        }
+    }
+
+    /**
+     * Prints the description of the application in json format
+     *
+     * @return a json representing the detailed description of the class and all
+     * the parameters available for it's main method
+     * @throws IllegalAccessException
+     * @throws IllegalArgumentException
+     */
+    @SuppressWarnings("unchecked")
+    public String json() throws IllegalArgumentException, IllegalAccessException {
+
+        String json = "";
+
+        this.initOptions();
+
+        JSONArray parameters = new JSONArray();
+        parameters.addAll(options);
+
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("name", new String(this.getLabel()));
+        jsonObject.put("description", new String(this.getLongDescription()));
+        jsonObject.put("short_description", new String(this.getShortDescription()));
+        jsonObject.put("java_class", this.getClass().getSimpleName());
+
+        String packageName = this.getClass().getPackage().getName();
+
+        String tab[] = packageName.split("\\.");
+        String simplePackageName = tab[tab.length - 1];
+
+        jsonObject.put("package", simplePackageName);
+
+        jsonObject.put("parameters", parameters);
+
+        json = jsonObject.toJSONString();
+
+        return json;
+    }
+
     /**
      * <p>getLabel.</p>
      *
-- 
GitLab


From 481526a9605793ba4873988ce750467acf266fa2 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 1 Apr 2022 18:09:32 +0200
Subject: [PATCH 02/83] Options set as public to allow the json generation

---
 .../attributes/SbmlToMetaboliteTable.java          |  4 ++--
 .../met4j_toolbox/networkAnalysis/MetaboRank.java  | 14 +++++++-------
 .../networkAnalysis/PrecursorNetwork.java          |  6 +++---
 .../networkAnalysis/ScopeNetwork.java              |  6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
index 9fb436079..bfb67d845 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
@@ -56,10 +56,10 @@ import java.io.PrintWriter;
 public class SbmlToMetaboliteTable extends AbstractMet4jApplication {
 
     @Option(name = "-s", usage = "Sbml file", required = true)
-    protected String sbml;
+    public String sbml;
 
     @Option(name = "-o", usage = "Output file", required=true)
-    protected String outputFile;
+    public String outputFile;
 
     /**
      * <p>main.</p>
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java
index b678e749a..905ca7ccb 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java
@@ -68,21 +68,21 @@ public class MetaboRank extends AbstractMet4jApplication {
 
     //arguments
     @Option(name = "-i", usage = "input SBML file: path to network used for computing centrality, in sbml format.", required = true)
-    String sbmlFilePath;
+    public String sbmlFilePath;
     @Option(name = "-s", usage = "input seeds file: tabulated file containing node of interest ids and weight", required = true)
-    String seedsFilePath;
+    public String seedsFilePath;
     @Option(name = "-o", usage = "output file: path to the file where the results will be exported", required = true)
-    String output;
+    public String output;
 
     //parameters
     @Option(name = "-w", usage = "input edge weight file: (recommended) path to file containing edges' weights. Will be normalized as transition probabilities")
-    String edgeWeightsFilePaths;
+    public String edgeWeightsFilePaths;
     @Option(name = "-max", usage = "maximal number of iteration")
-    int maxNbOfIter = 15000;
+    public int maxNbOfIter = 15000;
     @Option(name = "-t", usage = "convergence tolerance")
-    double tolerance = 0.001;
+    public double tolerance = 0.001;
     @Option(name = "-d", usage = "damping factor")
-    double dampingFactor = 0.85;
+    public double dampingFactor = 0.85;
 
     //variables
     CompoundGraph firstGraph;
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java
index d2bef7f3a..e5d474993 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java
@@ -20,11 +20,11 @@ public class PrecursorNetwork extends AbstractMet4jApplication {
 
     //arguments
     @Option(name = "-i", usage = "input SBML file: path to network used for computing scope, in sbml format.", required = true)
-    String sbmlFilePath;
+    public String sbmlFilePath;
     @Option(name = "-t", aliases = {"--targets"}, usage = "input target file: tabulated file containing node of interest ids", required = true)
-    String targetsFilePath;
+    public String targetsFilePath;
     @Option(name = "-o", usage = "output file: path to the .gml file where the results precursor network will be exported", required = true)
-    String output;
+    public String output;
 
     //oprtions
     @Option(name = "-sc", aliases = {"--sides"}, usage = "an optional file containing list of ubiquitous compounds to be considered already available")
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java
index fbe4ce57f..4e0ec490d 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java
@@ -21,11 +21,11 @@ public class ScopeNetwork extends AbstractMet4jApplication {
 
     //arguments
     @Option(name = "-i", usage = "input SBML file: path to network used for computing scope, in sbml format.", required = true)
-    String sbmlFilePath;
+    public String sbmlFilePath;
     @Option(name = "-s", aliases = {"--seeds"}, usage = "input seeds file: tabulated file containing node of interest ids", required = true)
-    String seedsFilePath;
+    public String seedsFilePath;
     @Option(name = "-o", usage = "output file: path to the .gml file where the results scope network will be exported", required = true)
-    String output;
+    public String output;
 
     //options
     @Option(name = "-sc", aliases = {"--sides"}, usage = "an optional file containing list of ubiquitous side compounds to be considered available by default but ignored during expansion")
-- 
GitLab


From af4dba466e0e666640912d4b3517cd7d62d01034 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 1 Apr 2022 18:09:56 +0200
Subject: [PATCH 03/83] Class to generate the json description

---
 .../met4j_toolbox/GenerateJson.java           | 113 ++++++++++++++++++
 1 file changed, 113 insertions(+)
 create mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateJson.java

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateJson.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateJson.java
new file mode 100644
index 000000000..78e0d4a94
--- /dev/null
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateJson.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright INRAE (2022)
+ *
+ * contact-metexplore@inrae.fr
+ *
+ * This software is a computer program whose purpose is to [describe
+ * functionalities and technical features of your software].
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ */
+package fr.inrae.toulouse.metexplore.met4j_toolbox;
+
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.ResourceURLFilter;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Resources;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URL;
+
+public class GenerateJson {
+
+
+    public static void main(String[] args) {
+        try {
+
+
+            ResourceURLFilter filter = new ResourceURLFilter() {
+
+                public @Override
+                boolean accept(URL u) {
+
+                    String path = GenerateJson.class.getPackage().getName()
+                            .replace(".", "/");
+
+                    String s = u.getFile();
+                    return s.endsWith(".class") && !s.contains("$")
+                            && s.contains(path);
+                }
+            };
+
+            String jsonStr = "{\"status\":\"true\",\"apps\":[";
+
+            String path = GenerateJson.class.getPackage().getName()
+                    .replace(".", "/");
+
+
+            int n = 0;
+
+            for (URL u : Resources.getResourceURLs(Resources.class, filter)) {
+
+                String entry = u.getFile();
+                int idx = entry.indexOf(path);
+
+                entry = entry.substring(idx, entry.length() - ".class".length());
+
+                Class<?> myClass = Class.forName(entry.replace('/', '.'));
+
+                if (myClass.getSuperclass() != null && myClass.getSuperclass().equals(AbstractMet4jApplication.class)) {
+
+                    Constructor<?> ctor = myClass.getConstructor();
+
+                    try {
+                        Object obj = ctor.newInstance();
+
+                        Method method = obj.getClass().getMethod("json");
+                        if (n > 0) {
+                            jsonStr += ",";
+                        }
+                        jsonStr += method.invoke(obj);
+                        n++;
+                    } catch (InstantiationException e) {
+                        // It's not a class that can be instantiated
+                    }
+
+                }
+            }
+
+            jsonStr += "]}";
+
+            System.out.println(jsonStr);
+
+        } catch (Exception e) {
+            System.out.println("{\"status\":\"false\"}");
+            e.printStackTrace();
+        }
+    }
+}
-- 
GitLab


From 2cb9302c8ce59313f86e74b7ad775d7f0460e301 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 5 Apr 2022 16:36:01 +0200
Subject: [PATCH 04/83] Add annotations for app file parameters

@Sbml @Gml @Input @Output @Tabulated
---
 .../generic/AbstractMet4jApplication.java     | 26 +++++-----
 .../generic/annotations/Gml.java              | 47 +++++++++++++++++++
 .../generic/annotations/Input.java            | 47 +++++++++++++++++++
 .../generic/annotations/Output.java           | 47 +++++++++++++++++++
 .../generic/annotations/Sbml.java             | 47 +++++++++++++++++++
 .../generic/annotations/Tabulated.java        | 47 +++++++++++++++++++
 6 files changed, 250 insertions(+), 11 deletions(-)
 create mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gml.java
 create mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Input.java
 create mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Output.java
 create mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Sbml.java
 create mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tabulated.java

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index 9ca9568d1..14e37db9e 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -47,6 +47,7 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.stream.Collectors;
 
 /**
  * <p>Abstract AbstractMet4jApplication class.</p>
@@ -72,6 +73,8 @@ public abstract class AbstractMet4jApplication {
 
             Boolean flag = false;
 
+            ArrayList<String> additionalTypes = new ArrayList<>();
+
             for (Annotation a : f.getDeclaredAnnotations()) {
                 if (a instanceof Option) {
                     flag = true;
@@ -136,7 +139,12 @@ public abstract class AbstractMet4jApplication {
                     map.put("min", Double.toString(option.min()));
                     map.put("max", Double.toString(option.max()));
 
+                } else {
+                    additionalTypes.add(a.annotationType().getSimpleName());
                 }
+
+                map.put("additionalTypes", additionalTypes.stream()
+                        .collect(Collectors.joining("-")));
             }
             if (flag) {
                 options.add(map);
@@ -209,22 +217,20 @@ public abstract class AbstractMet4jApplication {
 
     /**
      * <p>printHeader.</p>
-     *
+     * <p>
      * Prints the label and the long description
      */
-    public void printLongHeader()
-    {
+    public void printLongHeader() {
         System.out.println(this.getLabel());
         System.out.println(this.getLongDescription());
     }
 
     /**
      * <p>printHeader.</p>
-     *
+     * <p>
      * Prints the label and the long description
      */
-    public void printShortHeader()
-    {
+    public void printShortHeader() {
         System.out.println(this.getLabel());
         System.out.println(this.getShortDescription());
     }
@@ -248,21 +254,19 @@ public abstract class AbstractMet4jApplication {
         try {
             parser.parseArgument(args);
         } catch (CmdLineException e) {
-            if(this.h == false) {
+            if (this.h == false) {
                 this.printShortHeader();
                 System.err.println("Error in arguments");
                 parser.printUsage(System.err);
                 System.exit(0);
-            }
-            else {
+            } else {
                 this.printLongHeader();
                 parser.printUsage(System.err);
                 System.exit(1);
             }
         }
 
-        if(this.h == true)
-        {
+        if (this.h == true) {
             this.printLongHeader();
             parser.printUsage(System.err);
             System.exit(1);
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gml.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gml.java
new file mode 100644
index 000000000..38e1c88b0
--- /dev/null
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gml.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright INRAE (2022)
+ *
+ * contact-metexplore@inrae.fr
+ *
+ * This software is a computer program whose purpose is to [describe
+ * functionalities and technical features of your software].
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ */
+
+package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Gml {
+}
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Input.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Input.java
new file mode 100644
index 000000000..b42fb2f21
--- /dev/null
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Input.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright INRAE (2022)
+ *
+ * contact-metexplore@inrae.fr
+ *
+ * This software is a computer program whose purpose is to [describe
+ * functionalities and technical features of your software].
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ */
+
+package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Input {
+}
\ No newline at end of file
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Output.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Output.java
new file mode 100644
index 000000000..ea1d8e6e0
--- /dev/null
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Output.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright INRAE (2022)
+ *
+ * contact-metexplore@inrae.fr
+ *
+ * This software is a computer program whose purpose is to [describe
+ * functionalities and technical features of your software].
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ */
+
+package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Output {
+}
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Sbml.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Sbml.java
new file mode 100644
index 000000000..62f408ca7
--- /dev/null
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Sbml.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright INRAE (2022)
+ *
+ * contact-metexplore@inrae.fr
+ *
+ * This software is a computer program whose purpose is to [describe
+ * functionalities and technical features of your software].
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ */
+
+package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Sbml {
+}
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tabulated.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tabulated.java
new file mode 100644
index 000000000..120169bef
--- /dev/null
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tabulated.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright INRAE (2022)
+ *
+ * contact-metexplore@inrae.fr
+ *
+ * This software is a computer program whose purpose is to [describe
+ * functionalities and technical features of your software].
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ */
+
+package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Tabulated {
+}
-- 
GitLab


From a0da0ab1ff3bd5971cd6dd51fec7ec96d3b4e946 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Wed, 6 Apr 2022 17:21:57 +0200
Subject: [PATCH 05/83] Rename Tabulated in Tsv

---
 .../generic/annotations/{Tabulated.java => Tsv.java}            | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/{Tabulated.java => Tsv.java} (98%)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tabulated.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tsv.java
similarity index 98%
rename from met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tabulated.java
rename to met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tsv.java
index 120169bef..f114cdec6 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tabulated.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tsv.java
@@ -43,5 +43,5 @@ import java.lang.annotation.Target;
 
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.FIELD)
-public @interface Tabulated {
+public @interface Tsv {
 }
-- 
GitLab


From 54de7a03bb189b421d26d3888d7a9d76b32bbdee Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Wed, 6 Apr 2022 17:22:47 +0200
Subject: [PATCH 06/83] New file parameter annotations

---
 .../generic/annotations/Csv.java              | 47 +++++++++++++++++++
 .../generic/annotations/Fasta.java            | 47 +++++++++++++++++++
 .../generic/annotations/Gsam.java             | 47 +++++++++++++++++++
 3 files changed, 141 insertions(+)
 create mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Csv.java
 create mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Fasta.java
 create mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gsam.java

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Csv.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Csv.java
new file mode 100644
index 000000000..c13312b65
--- /dev/null
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Csv.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright INRAE (2022)
+ *
+ * contact-metexplore@inrae.fr
+ *
+ * This software is a computer program whose purpose is to [describe
+ * functionalities and technical features of your software].
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ */
+
+package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Csv {
+}
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Fasta.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Fasta.java
new file mode 100644
index 000000000..cf30406ee
--- /dev/null
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Fasta.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright INRAE (2022)
+ *
+ * contact-metexplore@inrae.fr
+ *
+ * This software is a computer program whose purpose is to [describe
+ * functionalities and technical features of your software].
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ */
+
+package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Fasta {
+}
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gsam.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gsam.java
new file mode 100644
index 000000000..bd2b43255
--- /dev/null
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gsam.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright INRAE (2022)
+ *
+ * contact-metexplore@inrae.fr
+ *
+ * This software is a computer program whose purpose is to [describe
+ * functionalities and technical features of your software].
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ */
+
+package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Gsam {
+}
-- 
GitLab


From 34fe38aed420213c4e7a977dee7d3c6bfd0e1087 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Wed, 6 Apr 2022 17:23:11 +0200
Subject: [PATCH 07/83] Add annotations to all met4j-toolbox apps

---
 .../attributes/AbstractSbmlSet.java             | 10 ++++++++++
 .../met4j_toolbox/bigg/GetModelProteome.java    |  7 +++++++
 .../met4j_toolbox/convert/FbcToNotes.java       |  7 +++++++
 .../met4j_toolbox/convert/Kegg2Sbml.java        |  4 ++++
 .../met4j_toolbox/convert/Sbml2Graph.java       |  7 ++++++-
 .../met4j_toolbox/convert/Sbml2Tab.java         | 10 ++++++++--
 .../met4j_toolbox/convert/Tab2Sbml.java         |  8 ++++++++
 .../networkAnalysis/CarbonSkeletonNet.java      |  7 +++++++
 .../networkAnalysis/ChokePoint.java             |  8 ++++++++
 .../networkAnalysis/DistanceMatrix.java         |  8 ++++++++
 .../networkAnalysis/ExtractSubNetwork.java      | 16 +++++++++++++++-
 .../ExtractSubReactionNetwork.java              | 16 +++++++++++++++-
 .../networkAnalysis/LoadPoint.java              |  9 +++++++++
 .../networkAnalysis/MetaboRank.java             | 17 +++++++++++++++++
 .../networkAnalysis/NetworkSummary.java         |  7 +++++++
 .../networkAnalysis/PrecursorNetwork.java       | 11 +++++++++++
 .../networkAnalysis/ScopeNetwork.java           | 16 ++++++++++++++++
 .../networkAnalysis/SideCompoundsScan.java      |  8 ++++++++
 18 files changed, 171 insertions(+), 5 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java
index 96b8c9b8b..9312afdc6 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java
@@ -41,6 +41,10 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.JsbmlWriter;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
@@ -56,12 +60,18 @@ public abstract class AbstractSbmlSet extends AbstractMet4jApplication {
     @Option(name="-n", usage="[0] Number of lines to skip at the beginning of the tabulated file")
     protected int nSkip = 0;
 
+    @Output
+    @Sbml
     @Option(name="-out", usage="[out.sbml] Out sbml file")
     protected String out = "out.sbml";
 
+    @Input
+    @Sbml
     @Option(name="-sbml", usage="Original sbml file", required=true)
     protected String sbml;
 
+    @Input
+    @Tsv
     @Option(name="-tab", usage="Tabulated file")
     protected String tab;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java
index fd9c91621..66499cbde 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java
@@ -37,6 +37,8 @@
 package fr.inrae.toulouse.metexplore.met4j_toolbox.bigg;
 
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Fasta;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.json.simple.parser.JSONParser;
@@ -67,8 +69,13 @@ public class GetModelProteome extends AbstractMet4jApplication {
     public String description = "Get proteome in fasta format of a model present in BIGG";
     @Option(name = "-m", usage = "[ex: iMM904] id of the BIGG model", required = true)
     public String modelId = "iMM904";
+
+    @Output
+    @Fasta
     @Option(name = "-o", usage = "[proteome.fas] path of the output file")
     public String outputFile = "proteome.fas";
+
+
     private String baseUrl = "http://bigg.ucsd.edu/api/v2/models/";
 
     /**
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java
index 6d6956dd7..4ef09ed00 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java
@@ -46,6 +46,9 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.plugin.GroupPathwayWri
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.plugin.NotesWriter;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.plugin.PackageWriter;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
 import org.kohsuke.args4j.CmdLineException;
 import org.kohsuke.args4j.CmdLineParser;
 import org.kohsuke.args4j.Option;
@@ -61,9 +64,13 @@ import java.util.HashSet;
  */
 public class FbcToNotes extends AbstractMet4jApplication {
 
+    @Sbml
+    @Input
     @Option(name = "-i", usage = "input file", required = true)
     public String inputPath = null;
 
+    @Sbml
+    @Output
     @Option(name = "-o", usage = "output file", required = true)
     public String outputPath = null;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Kegg2Sbml.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Kegg2Sbml.java
index 81f4b0f9b..d070eeebd 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Kegg2Sbml.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Kegg2Sbml.java
@@ -39,6 +39,8 @@ import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.JsbmlWriter;
 import fr.inrae.toulouse.metexplore.met4j_io.kegg.Kegg2BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
 import org.kohsuke.args4j.Option;
 
 public class Kegg2Sbml  extends AbstractMet4jApplication  {
@@ -46,6 +48,8 @@ public class Kegg2Sbml  extends AbstractMet4jApplication  {
     @Option(name="-org", usage="[] Kegg org id. Must be 3 letters (")
     public String org = "";
 
+    @Output
+    @Sbml
     @Option(name="-sbml", usage="[out.sbml] Out sbml file")
     public String sbml = "out.sbml";
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Graph.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Graph.java
index acc2a5377..7a3a02392 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Graph.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Graph.java
@@ -10,18 +10,23 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.plugin.*;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashSet;
 
 public class Sbml2Graph extends AbstractMet4jApplication {
 
+    @Input
+    @Sbml
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
+    @Output
+    @Gml
+    @Tsv
     @Option(name = "-o", usage = "output Graph file", required = true)
     public String outputPath = null;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Tab.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Tab.java
index 338bd4c03..1bd689942 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Tab.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Tab.java
@@ -39,10 +39,12 @@ package fr.inrae.toulouse.metexplore.met4j_toolbox.convert;
 import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
-import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.JsbmlWriter;
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.network.BioNetwork2Tab;
-import fr.inrae.toulouse.metexplore.met4j_io.tabulated.network.Tab2BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
@@ -61,9 +63,13 @@ public class Sbml2Tab extends AbstractMet4jApplication {
     @Option(name = "-r", usage = "[<==>] String for reversible reaction")
     public String r = "<==>";
 
+    @Tsv
+    @Output
     @Option(name = "-out", usage = "[out.tsv] Tabulated file")
     public String out = "out.tsv";
 
+    @Input
+    @Sbml
     @Option(name = "-in", usage = "Sbml file", required = true)
     public String in;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java
index ffddd1874..076d0b70b 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java
@@ -41,6 +41,10 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.JsbmlWriter;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.Met4jSbmlWriterException;
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.network.Tab2BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
@@ -74,9 +78,13 @@ public class Tab2Sbml extends AbstractMet4jApplication {
     @Option(name="-r", usage="[<==>] String for reversible reaction")
     public String r="<==>";
 
+    @Output
+    @Sbml
     @Option(name="-sbml", usage="[out.sbml] Out sbml file")
     public String sbml = "out.sbml";
 
+    @Input
+    @Tsv
     @Option(name="-in", usage="Tabulated file")
     public String in;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CarbonSkeletonNet.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CarbonSkeletonNet.java
index 3c86c369f..fa73a6ce3 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CarbonSkeletonNet.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CarbonSkeletonNet.java
@@ -19,6 +19,7 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.plugin.NotesParser;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.plugin.PackageParser;
 import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.ExportMatrix;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
@@ -28,12 +29,18 @@ import java.util.HashSet;
 
 public class CarbonSkeletonNet  extends AbstractMet4jApplication {
 
+    @Sbml
+    @Input
     @Option(name = "-s", usage = "input SBML file", required = true)
     public String inputPath = null;
 
+    @Gsam
+    @Input
     @Option(name = "-g", usage = "input GSAM file", required = true)
     public String inputAAM = null;
 
+    @Gml
+    @Output
     @Option(name = "-o", usage = "output Graph file", required = true)
     public String outputPath = null;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java
index f7e0ad85b..9240c0d59 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java
@@ -11,6 +11,10 @@ import fr.inrae.toulouse.metexplore.met4j_graph.io.Bionetwork2BioGraph;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
 import org.kohsuke.args4j.Option;
 
 import java.io.BufferedReader;
@@ -21,9 +25,13 @@ import java.util.HashSet;
 
 public class ChokePoint  extends AbstractMet4jApplication {
 
+    @Input
+    @Sbml
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
+    @Output
+    @Tsv
     @Option(name = "-o", usage = "output results file", required = true)
     public String outputPath = null;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java
index 33441d239..ee2495c23 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java
@@ -16,6 +16,7 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderExcepti
 import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.BioMatrix;
 import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.ExportMatrix;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*;
 import org.kohsuke.args4j.Option;
 
 import java.io.BufferedReader;
@@ -24,18 +25,25 @@ import java.io.IOException;
 
 public class DistanceMatrix extends AbstractMet4jApplication {
 
+    @Input
+    @Sbml
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
+    @Output
+    @Csv
     @Option(name = "-o", usage = "output Matrix file", required = true)
     public String outputPath = null;
 
+    @Input
     @Option(name = "-s", aliases = {"--side"}, usage = "an optional file containing list of side compounds to ignore")
     public String sideCompoundFile = null;
 
     @Option(name = "-dw", aliases = {"--degree"}, usage = "penalize traversal of hubs by using degree square weighting", forbids = {"-w"})
     public Boolean degree = false;
 
+    @Input
+    @Tsv
     @Option(name = "-w", aliases = {"--weights"}, usage = "an optional file containing weights for compound pairs", forbids = {"-d"})
     public String weightFile = null;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubNetwork.java
index 9371b1c1c..1a4531818 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubNetwork.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubNetwork.java
@@ -22,6 +22,7 @@ import fr.inrae.toulouse.metexplore.met4j_graph.io.NodeMapping;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
@@ -30,23 +31,36 @@ import java.util.List;
 
 public class ExtractSubNetwork extends AbstractMet4jApplication {
 
+    @Input
+    @Sbml
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
+
+    @Input
     @Option(name = "-s", usage = "input sources txt file", required = true)
     public String sourcePath = null;
+
+    @Input
     @Option(name = "-t", usage = "input targets txt file", required = true)
     public String targetPath = null;
+
+    @Output
+    @Gml
     @Option(name = "-o", usage = "output gml file", required = true)
     public String outputPath = null;
 
-
+    @Input
     @Option(name = "-sc", aliases = {"--side"}, usage = "an optional file containing list of side compounds to ignore")
     public String sideCompoundFile = null;
 
     @Option(name = "-dw", aliases = {"--degreeWeights"}, usage = "penalize traversal of hubs by using degree square weighting", forbids = {"-cw", "-sw"})
     public Boolean degree = false;
+
+    @Input
+    @Tsv
     @Option(name = "-cw", aliases = {"--customWeights"}, usage = "an optional file containing weights for compound pairs", forbids = {"-dw", "-sw"})
     public String weightFile = null;
+
     @Option(name = "-sw", aliases = {"--chemSimWeights"}, usage = "penalize traversal of non-relevant edges by using chemical similarity weighting", forbids = {"-dw", "-cw"})
     public Boolean chemicalSim = false;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubReactionNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubReactionNetwork.java
index 66b50460c..dfa1b8ba9 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubReactionNetwork.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubReactionNetwork.java
@@ -24,6 +24,7 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_mapping.Mapper;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
@@ -32,23 +33,36 @@ import java.util.List;
 
 public class ExtractSubReactionNetwork extends AbstractMet4jApplication {
 
+    @Sbml
+    @Input
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
+
+    @Input
     @Option(name = "-s", usage = "input sources txt file", required = true)
     public String sourcePath = null;
+
+    @Input
     @Option(name = "-t", usage = "input targets txt file", required = true)
     public String targetPath = null;
+
+    @Output
+    @Gml
     @Option(name = "-o", usage = "output gml file", required = true)
     public String outputPath = null;
+
+    @Input
     @Option(name = "-sc", aliases = {"--side"}, usage = "a file containing list of side compounds to ignore", required = true)
     public String sideCompoundFile = null;
 
-    
+    @Input
+    @Tsv
     @Option(name = "-cw", aliases = {"--customWeights"}, usage = "an optional file containing weights for reactions pairs")
     public String weightFile = null;
 
     @Option(name = "-k", usage = "Extract k-shortest paths", forbids = {"-st"})
     public int k = 1;
+
     @Option(name = "-st", aliases = {"--steinertree"}, usage = "Extract Steiner Tree", forbids = {"-k"})
     public boolean st = false;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/LoadPoint.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/LoadPoint.java
index 951a09823..8af3404c0 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/LoadPoint.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/LoadPoint.java
@@ -11,6 +11,10 @@ import fr.inrae.toulouse.metexplore.met4j_graph.io.Bionetwork2BioGraph;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
 import org.kohsuke.args4j.Option;
 
 import java.io.BufferedReader;
@@ -22,12 +26,17 @@ import java.util.Map;
 
 public class LoadPoint  extends AbstractMet4jApplication {
 
+    @Sbml
+    @Input
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
+    @Output
+    @Tsv
     @Option(name = "-o", usage = "output results file", required = true)
     public String outputPath = null;
 
+    @Input
     @Option(name = "-s", aliases = {"--side"}, usage = "an optional file containing list of side compounds to ignore")
     public String sideCompoundFile = null;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java
index 905ca7ccb..98b02c5fc 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java
@@ -52,6 +52,10 @@ import fr.inrae.toulouse.metexplore.met4j_graph.io.Bionetwork2BioGraph;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
 import org.kohsuke.args4j.Option;
 
 import java.io.*;
@@ -67,20 +71,33 @@ import java.util.Set;
 public class MetaboRank extends AbstractMet4jApplication {
 
     //arguments
+    @Sbml
+    @Input
     @Option(name = "-i", usage = "input SBML file: path to network used for computing centrality, in sbml format.", required = true)
     public String sbmlFilePath;
+
+    @Input
+    @Tsv
     @Option(name = "-s", usage = "input seeds file: tabulated file containing node of interest ids and weight", required = true)
     public String seedsFilePath;
+
+    @Output
+    @Tsv
     @Option(name = "-o", usage = "output file: path to the file where the results will be exported", required = true)
     public String output;
 
     //parameters
+    @Input
+    @Tsv
     @Option(name = "-w", usage = "input edge weight file: (recommended) path to file containing edges' weights. Will be normalized as transition probabilities")
     public String edgeWeightsFilePaths;
+
     @Option(name = "-max", usage = "maximal number of iteration")
     public int maxNbOfIter = 15000;
+
     @Option(name = "-t", usage = "convergence tolerance")
     public double tolerance = 0.001;
+
     @Option(name = "-d", usage = "damping factor")
     public double dampingFactor = 0.85;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/NetworkSummary.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/NetworkSummary.java
index 53ea5f43a..84d0b95ab 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/NetworkSummary.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/NetworkSummary.java
@@ -18,6 +18,9 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.BioMatrix;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
 import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
 import org.kohsuke.args4j.Option;
 
@@ -31,12 +34,16 @@ import java.util.stream.Collectors;
 
 public class NetworkSummary extends AbstractMet4jApplication {
 
+    @Input
+    @Sbml
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
+    @Output
     @Option(name = "-o", usage = "output report file", required = true)
     public String outputPath = null;
 
+    @Input
     @Option(name = "-s", aliases = {"--side"}, usage = "an optional file containing list of side compounds to ignore (recommended)")
     public String sideCompoundFile = null;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java
index e5d474993..309df8551 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java
@@ -12,6 +12,10 @@ import fr.inrae.toulouse.metexplore.met4j_graph.io.NodeMapping;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Gml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
@@ -19,10 +23,17 @@ import java.io.IOException;
 public class PrecursorNetwork extends AbstractMet4jApplication {
 
     //arguments
+    @Input
+    @Sbml
     @Option(name = "-i", usage = "input SBML file: path to network used for computing scope, in sbml format.", required = true)
     public String sbmlFilePath;
+
+    @Input
     @Option(name = "-t", aliases = {"--targets"}, usage = "input target file: tabulated file containing node of interest ids", required = true)
     public String targetsFilePath;
+
+    @Output
+    @Gml
     @Option(name = "-o", usage = "output file: path to the .gml file where the results precursor network will be exported", required = true)
     public String output;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java
index 4e0ec490d..35211a2c9 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java
@@ -13,6 +13,10 @@ import fr.inrae.toulouse.metexplore.met4j_graph.io.NodeMapping;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Gml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
@@ -20,20 +24,32 @@ import java.io.IOException;
 public class ScopeNetwork extends AbstractMet4jApplication {
 
     //arguments
+    @Input
+    @Sbml
     @Option(name = "-i", usage = "input SBML file: path to network used for computing scope, in sbml format.", required = true)
     public String sbmlFilePath;
+
+    @Input
     @Option(name = "-s", aliases = {"--seeds"}, usage = "input seeds file: tabulated file containing node of interest ids", required = true)
     public String seedsFilePath;
+
+    @Output
+    @Gml
     @Option(name = "-o", usage = "output file: path to the .gml file where the results scope network will be exported", required = true)
     public String output;
 
     //options
+    @Input
     @Option(name = "-sc", aliases = {"--sides"}, usage = "an optional file containing list of ubiquitous side compounds to be considered available by default but ignored during expansion")
     public String sideCompoundFile = null;
+
     @Option(name = "-ssc", aliases = {"--showsides"}, usage = "show side compounds in output network", depends = {"-sc"})
     public boolean includeSides = false;
+
+    @Input
     @Option(name = "-ir", aliases = {"--ignore"}, usage = "an optional file containing list of reaction to ignore (forbid inclusion in scope")
     public String reactionToIgnoreFile = null;
+
     @Option(name = "-t", aliases = {"--trace"}, usage = "trace inclusion step index for each node in output")
     public boolean trace = false;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java
index 6744936d9..0d815797e 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java
@@ -11,6 +11,10 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_core.utils.StringUtils;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
 import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
 import org.kohsuke.args4j.Option;
 
@@ -23,9 +27,13 @@ import java.util.regex.Pattern;
  */
 public class SideCompoundsScan extends AbstractMet4jApplication {
 
+    @Sbml
+    @Input
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
+    @Output
+    @Tsv
     @Option(name = "-o", usage = "output Side-Compounds file", required = true)
     public String outputPath = null;
 
-- 
GitLab


From d07cc2a213450cc8a5925ddcab8cbf8a6ecfb4b0 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 12 Apr 2022 15:41:19 +0200
Subject: [PATCH 08/83] refactoring of app annotations

---
 met4j-toolbox/pom.xml                         |   1 +
 .../attributes/AbstractSbmlSet.java           |  21 +-
 .../attributes/AbstractSbmlSetAny.java        |   6 +
 .../attributes/AbstractSbmlSetMetabolite.java |   2 +-
 .../attributes/AbstractSbmlSetReaction.java   |   3 +
 .../attributes/SbmlSetChargesFromFile.java    |   3 +
 .../attributes/SbmlSetEcsFromFile.java        |   4 +-
 .../attributes/SbmlSetFormulasFromFile.java   |   3 +
 .../attributes/SbmlSetGprsFromFile.java       |   4 +-
 .../attributes/SbmlSetNamesFromFile.java      |   3 +
 .../attributes/SbmlSetPathwaysFromFile.java   |   4 +
 .../attributes/SbmlSetRefsFromFile.java       |   4 +
 .../attributes/SbmlToMetaboliteTable.java     |   4 +
 .../met4j_toolbox/bigg/GetModelProteome.java  |  11 +-
 .../met4j_toolbox/convert/FbcToNotes.java     |  18 +-
 .../met4j_toolbox/convert/Kegg2Sbml.java      |  12 +-
 .../met4j_toolbox/convert/Sbml2Graph.java     |  13 +-
 .../met4j_toolbox/convert/Sbml2Tab.java       |  16 +-
 .../met4j_toolbox/convert/Tab2Sbml.java       | 118 ++++-----
 .../generic/AbstractMet4jApplication.java     | 237 +++++++++++++-----
 .../{Gml.java => EnumFormats.java}            |  10 +-
 .../{Tsv.java => EnumParameterTypes.java}     |  10 +-
 .../generic/annotations/Fasta.java            |  47 ----
 .../annotations/{Input.java => Format.java}   |   5 +-
 .../generic/annotations/Gsam.java             |  47 ----
 .../generic/annotations/Output.java           |  47 ----
 .../{Csv.java => ParameterType.java}          |   3 +-
 .../generic/annotations/Sbml.java             |  47 ----
 .../networkAnalysis/CarbonSkeletonNet.java    |  64 ++---
 .../networkAnalysis/ChokePoint.java           |  42 ++--
 .../networkAnalysis/DistanceMatrix.java       |  19 +-
 .../networkAnalysis/ExtractSubNetwork.java    |  26 +-
 .../ExtractSubReactionNetwork.java            |  42 ++--
 .../networkAnalysis/LoadPoint.java            |  42 ++--
 .../networkAnalysis/MetaboRank.java           |  28 ++-
 .../networkAnalysis/NetworkSummary.java       | 100 ++++----
 .../networkAnalysis/PrecursorNetwork.java     |  22 +-
 .../networkAnalysis/ScopeNetwork.java         |  26 +-
 .../networkAnalysis/SideCompoundsScan.java    |  39 +--
 39 files changed, 588 insertions(+), 565 deletions(-)
 rename met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/{Gml.java => EnumFormats.java} (87%)
 rename met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/{Tsv.java => EnumParameterTypes.java} (87%)
 delete mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Fasta.java
 rename met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/{Input.java => Format.java} (97%)
 delete mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gsam.java
 delete mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Output.java
 rename met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/{Csv.java => ParameterType.java} (96%)
 delete mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Sbml.java

diff --git a/met4j-toolbox/pom.xml b/met4j-toolbox/pom.xml
index 6df8cf534..597452532 100644
--- a/met4j-toolbox/pom.xml
+++ b/met4j-toolbox/pom.xml
@@ -105,6 +105,7 @@
                                     </mainClass>
                                     <manifestEntries>
                                         <Multi-Release>true</Multi-Release>
+                                        <Implementation-Version>${project.version}</Implementation-Version>
                                     </manifestEntries>
                                 </transformer>
                                 <transformer
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java
index 9312afdc6..8efc04086 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java
@@ -41,14 +41,14 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.JsbmlWriter;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.*;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
 
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.*;
+
 /**
  * <p>Abstract AbstractSbmlSet class.</p>
  *
@@ -60,21 +60,22 @@ public abstract class AbstractSbmlSet extends AbstractMet4jApplication {
     @Option(name="-n", usage="[0] Number of lines to skip at the beginning of the tabulated file")
     protected int nSkip = 0;
 
-    @Output
-    @Sbml
+    @Format(name= Sbml)
+    @ParameterType(name = OutputFile)
     @Option(name="-out", usage="[out.sbml] Out sbml file")
     protected String out = "out.sbml";
 
-    @Input
-    @Sbml
+    @Format(name= Sbml)
+    @ParameterType(name = InputFile)
     @Option(name="-sbml", usage="Original sbml file", required=true)
     protected String sbml;
 
-    @Input
-    @Tsv
+    @ParameterType(name = InputFile)
+    @Format(name= Tsv)
     @Option(name="-tab", usage="Tabulated file")
     protected String tab;
 
+    @ParameterType(name= EnumParameterTypes.Text)
     @Option(name="-c", usage="[#] Comment String in the tabulated file. The lines beginning by this string won't be read")
     protected String c="#";
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java
index c62e3ce2a..1a2bca7a0 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java
@@ -37,8 +37,12 @@
 package fr.inrae.toulouse.metexplore.met4j_toolbox.attributes;
 
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.EntityType;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.*;
+
 /**
  * <p>Abstract AbstractSbmlSetAny class.</p>
  *
@@ -50,6 +54,7 @@ public abstract class AbstractSbmlSetAny extends AbstractSbmlSet {
     public final String setDescription = "The ids must correspond between the tabulated file and the SBML file.\n" +
             "If prefix or suffix is different in the SBML file, use the -p or the -s options.";
 
+    @ParameterType(name=Text)
     @Option(name="-ci", usage="[1] number of the column where are the object ids")
     protected int colid=1;
 
@@ -59,6 +64,7 @@ public abstract class AbstractSbmlSetAny extends AbstractSbmlSet {
     @Option(name="-s", usage="[deactivated] To match the objects in the sbml file, adds the suffix _comparmentID to metabolites")
     protected Boolean s=false;
 
+    @ParameterType(name=Text)
     @Option(name="-o", usage="[REACTION] Object type in the column id : REACTION;METABOLITE;PROTEIN;GENE;PATHWAY")
     protected EntityType o= EntityType.REACTION;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetMetabolite.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetMetabolite.java
index 3592da3ad..b95e80730 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetMetabolite.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetMetabolite.java
@@ -50,7 +50,7 @@ public abstract class AbstractSbmlSetMetabolite  extends AbstractSbmlSet{
             "If prefix or suffix is different in the SBML file, use the -p or the -s options.";
 
     @Option(name="-ci", usage="[1] number of the column where are the metabolite ids")
-    protected int colid=1;
+    protected Integer colid=1;
 
     @Option(name="-p", usage="[deactivated] To match the objects in the sbml file, adds the prefix M_ to metabolite ids")
     protected Boolean p=false;
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetReaction.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetReaction.java
index ae63e70cc..4b67b39ab 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetReaction.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetReaction.java
@@ -36,6 +36,8 @@
 
 package fr.inrae.toulouse.metexplore.met4j_toolbox.attributes;
 
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 /**
@@ -49,6 +51,7 @@ public abstract class AbstractSbmlSetReaction extends AbstractSbmlSet {
     public final String setDescription = "The ids must correspond between the tabulated file and the SBML file.\n" +
             "If prefix R_ is present in the ids in the SBML file and not in the tabulated file, use the -p option.";
 
+    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-ci", usage="[1] number of the column where are the reaction ids")
     protected int colid=1;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java
index 078b0d6cb..640ab6965 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java
@@ -38,6 +38,8 @@ package fr.inrae.toulouse.metexplore.met4j_toolbox.attributes;
 
 import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetChargesFromFile;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 /**
@@ -48,6 +50,7 @@ import org.kohsuke.args4j.Option;
  */
 public class SbmlSetChargesFromFile extends AbstractSbmlSetMetabolite {
 
+    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cc", usage="[2] number of the column where are the charges")
     private int colcharge=2;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java
index c4c361666..ff6bb992a 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java
@@ -38,6 +38,8 @@ package fr.inrae.toulouse.metexplore.met4j_toolbox.attributes;
 
 import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetEcsFromFile;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 /**
@@ -48,7 +50,7 @@ import org.kohsuke.args4j.Option;
  */
 public class SbmlSetEcsFromFile extends AbstractSbmlSetReaction {
 
-
+    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cec", usage="[2] number of the column where are the ecs")
     private int colec=2;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java
index 9095c1f55..c13d4e14e 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java
@@ -38,6 +38,8 @@ package fr.inrae.toulouse.metexplore.met4j_toolbox.attributes;
 
 import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetFormulasFromFile;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 /**
@@ -48,6 +50,7 @@ import org.kohsuke.args4j.Option;
  */
 public class SbmlSetFormulasFromFile extends AbstractSbmlSetMetabolite {
 
+    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cf", usage="[2] number of the column where are the formulas")
     private int colformula=2;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java
index f6a20b2f2..bea4d49fc 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java
@@ -38,6 +38,8 @@ package fr.inrae.toulouse.metexplore.met4j_toolbox.attributes;
 
 import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetGprsFromFile;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
@@ -50,7 +52,7 @@ import java.io.IOException;
  */
 public class SbmlSetGprsFromFile  extends AbstractSbmlSetReaction {
 
-
+    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cgpr", usage="[2] number of the column where are the gprs")
     private int colgpr=2;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java
index 7bef87ebb..cd33a2e23 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java
@@ -39,6 +39,8 @@ package fr.inrae.toulouse.metexplore.met4j_toolbox.attributes;
 import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetNamesFromFile;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 /**
@@ -49,6 +51,7 @@ import org.kohsuke.args4j.Option;
  */
 public class SbmlSetNamesFromFile extends AbstractSbmlSetAny {
 
+    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cname", usage="[2] number of the column where are the names")
     private int colname=2;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java
index c04f2d23a..f05d7fce6 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java
@@ -38,6 +38,8 @@ package fr.inrae.toulouse.metexplore.met4j_toolbox.attributes;
 
 import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetPathwaysFromFile;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 /**
@@ -48,9 +50,11 @@ import org.kohsuke.args4j.Option;
  */
 public class SbmlSetPathwaysFromFile extends AbstractSbmlSetReaction {
 
+    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cp", usage="[2] number of the column where are the pathways")
     private int colp=2;
 
+    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-sep", usage="[|] Separator of pathways in the tabulated file")
     private String sep = "|";
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java
index c30d5de4c..aea95a02c 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java
@@ -39,6 +39,8 @@ package fr.inrae.toulouse.metexplore.met4j_toolbox.attributes;
 import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetChargesFromFile;
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.attributes.SetRefsFromFile;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 /**
@@ -49,9 +51,11 @@ import org.kohsuke.args4j.Option;
  */
 public class SbmlSetRefsFromFile extends AbstractSbmlSetAny {
 
+    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cr", usage="[2] number of the column where are the references")
     private int colRef=2;
 
+    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-ref", usage="Name of the ref. Must exist in identifiers.org", required = true)
     private String ref=null;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
index bfb67d845..fca3fcc36 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
@@ -41,6 +41,8 @@ import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 import java.io.FileWriter;
@@ -55,9 +57,11 @@ import java.io.PrintWriter;
  */
 public class SbmlToMetaboliteTable extends AbstractMet4jApplication {
 
+    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name = "-s", usage = "Sbml file", required = true)
     public String sbml;
 
+    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name = "-o", usage = "Output file", required=true)
     public String outputFile;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java
index 66499cbde..5ae341159 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java
@@ -37,8 +37,10 @@
 package fr.inrae.toulouse.metexplore.met4j_toolbox.bigg;
 
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Fasta;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.json.simple.parser.JSONParser;
@@ -67,11 +69,12 @@ import java.util.Set;
 public class GetModelProteome extends AbstractMet4jApplication {
 
     public String description = "Get proteome in fasta format of a model present in BIGG";
+
     @Option(name = "-m", usage = "[ex: iMM904] id of the BIGG model", required = true)
     public String modelId = "iMM904";
 
-    @Output
-    @Fasta
+    @Format(name= EnumFormats.Fasta)
+    @ParameterType(name= EnumParameterTypes.OutputFile)
     @Option(name = "-o", usage = "[proteome.fas] path of the output file")
     public String outputFile = "proteome.fas";
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java
index 4ef09ed00..de9482d71 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java
@@ -46,9 +46,9 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.plugin.GroupPathwayWri
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.plugin.NotesWriter;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.plugin.PackageWriter;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.CmdLineException;
 import org.kohsuke.args4j.CmdLineParser;
 import org.kohsuke.args4j.Option;
@@ -56,6 +56,10 @@ import org.kohsuke.args4j.Option;
 import java.io.IOException;
 import java.util.HashSet;
 
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile;
+
 /**
  * <p>FbcToNotes class.</p>
  *
@@ -64,13 +68,13 @@ import java.util.HashSet;
  */
 public class FbcToNotes extends AbstractMet4jApplication {
 
-    @Sbml
-    @Input
+    @Format(name= Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-i", usage = "input file", required = true)
     public String inputPath = null;
 
-    @Sbml
-    @Output
+    @Format(name= Sbml)
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output file", required = true)
     public String outputPath = null;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Kegg2Sbml.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Kegg2Sbml.java
index d070eeebd..6695dce70 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Kegg2Sbml.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Kegg2Sbml.java
@@ -39,17 +39,21 @@ import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.JsbmlWriter;
 import fr.inrae.toulouse.metexplore.met4j_io.kegg.Kegg2BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile;
+
 public class Kegg2Sbml  extends AbstractMet4jApplication  {
 
     @Option(name="-org", usage="[] Kegg org id. Must be 3 letters (")
     public String org = "";
 
-    @Output
-    @Sbml
+    @Format(name= Sbml)
+    @ParameterType(name = OutputFile)
     @Option(name="-sbml", usage="[out.sbml] Out sbml file")
     public String sbml = "out.sbml";
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Graph.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Graph.java
index 7a3a02392..244800384 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Graph.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Graph.java
@@ -17,16 +17,19 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile;
+
 public class Sbml2Graph extends AbstractMet4jApplication {
 
-    @Input
-    @Sbml
+    @Format(name = Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
-    @Output
-    @Gml
-    @Tsv
+    @Format(name = EnumFormats.Text)
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output Graph file", required = true)
     public String outputPath = null;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Tab.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Tab.java
index 1bd689942..ee714696f 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Tab.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Sbml2Tab.java
@@ -41,10 +41,10 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.network.BioNetwork2Tab;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
@@ -63,13 +63,13 @@ public class Sbml2Tab extends AbstractMet4jApplication {
     @Option(name = "-r", usage = "[<==>] String for reversible reaction")
     public String r = "<==>";
 
-    @Tsv
-    @Output
+    @Format(name = EnumFormats.Tsv)
+    @ParameterType(name = EnumParameterTypes.OutputFile)
     @Option(name = "-out", usage = "[out.tsv] Tabulated file")
     public String out = "out.tsv";
 
-    @Input
-    @Sbml
+    @ParameterType(name = EnumParameterTypes.InputFile)
+    @Format(name = EnumFormats.Sbml)
     @Option(name = "-in", usage = "Sbml file", required = true)
     public String in;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java
index 076d0b70b..5da1181c5 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java
@@ -41,10 +41,10 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.JsbmlWriter;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.Met4jSbmlWriterException;
 import fr.inrae.toulouse.metexplore.met4j_io.tabulated.network.Tab2BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
@@ -57,62 +57,68 @@ import java.io.IOException;
  */
 public class Tab2Sbml extends AbstractMet4jApplication {
 
-    @Option(name="-ci", usage="[1] number of the column where are the reaction ids")
-    public int colid=1;
+    @Option(name = "-ci", usage = "[1] number of the column where are the reaction ids")
+    public int colid = 1;
 
-    @Option(name="-cf", usage="[2] number of the column where are the reaction formulas")
-    public int colformula=2;
+    @Option(name = "-cf", usage = "[2] number of the column where are the reaction formulas")
+    public int colformula = 2;
 
-    @Option(name="-rp", usage="[deactivated] format the reaction ids in a Palsson way (R_***)")
-    public Boolean rp=false;
+    @Option(name = "-rp", usage = "[deactivated] format the reaction ids in a Palsson way (R_***)")
+    public Boolean rp = false;
 
-    @Option(name="-mp", usage="[deactivated] format the metabolite ids in a Palsson way (M_***_c)")
-    public Boolean mp=false;
+    @Option(name = "-mp", usage = "[deactivated] format the metabolite ids in a Palsson way (M_***_c)")
+    public Boolean mp = false;
 
-    @Option(name="-e", usage="[_b] flag to assign metabolite as external")
-    public String e="_b";
+    @Option(name = "-e", usage = "[_b] flag to assign metabolite as external")
+    public String e = "_b";
 
-    @Option(name="-i", usage="[-->] String for irreversible reaction")
-    public String i="-->";
+    @Option(name = "-i", usage = "[-->] String for irreversible reaction")
+    public String i = "-->";
 
-    @Option(name="-r", usage="[<==>] String for reversible reaction")
-    public String r="<==>";
+    @Option(name = "-r", usage = "[<==>] String for reversible reaction")
+    public String r = "<==>";
 
-    @Output
-    @Sbml
-    @Option(name="-sbml", usage="[out.sbml] Out sbml file")
+    @Format(name = EnumFormats.Sbml)
+    @ParameterType(name = EnumParameterTypes.OutputFile)
+    @Option(name = "-sbml", usage = "[out.sbml] Out sbml file")
     public String sbml = "out.sbml";
 
-    @Input
-    @Tsv
-    @Option(name="-in", usage="Tabulated file")
+    @Format(name = EnumFormats.Tsv)
+    @ParameterType(name = EnumParameterTypes.InputFile)
+    @Option(name = "-in", usage = "Tabulated file")
     public String in;
 
-    @Option(name="-id", usage="[NA] Model id written in the SBML file")
-    public String id="NA";
+    @Option(name = "-id", usage = "[NA] Model id written in the SBML file")
+    public String id = "NA";
 
-    @Option(name="-cpt", usage="[deactivated] Create compartment from metabolite suffixes. If this option is deactivated, only one compartment (the default compartment) will be created")
+    @Option(name = "-cpt", usage = "[deactivated] Create compartment from metabolite suffixes. If this option is deactivated, only one compartment (the default compartment) will be created")
     public Boolean createCompartment = false;
 
-    @Option(name="-dcpt", usage="[c] Default compartment")
+    @Option(name = "-dcpt", usage = "[c] Default compartment")
     public String defaultCompartment = "c";
 
-    @Option(name="-n", usage="[0] Number of lines to skip at the beginning of the tabulated file")
+    @Option(name = "-n", usage = "[0] Number of lines to skip at the beginning of the tabulated file")
     public int nSkip = 0;
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public String getLabel() {
         return this.getClass().getSimpleName();
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public String getLongDescription() {
         return this.getShortDescription();
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public String getShortDescription() {
         return "Create a Sbml File from a tabulated file that contains the reaction ids and the formulas";
@@ -137,40 +143,40 @@ public class Tab2Sbml extends AbstractMet4jApplication {
 
     private void run() throws Met4jSbmlWriterException {
 
-            Tab2BioNetwork tb = new Tab2BioNetwork(this.id, this.colid-1,
-                    this.colformula-1,
-                    this.rp, this.mp, this.e, this.i, this.r, this.createCompartment,
-                    this.defaultCompartment, this.nSkip);
+        Tab2BioNetwork tb = new Tab2BioNetwork(this.id, this.colid - 1,
+                this.colformula - 1,
+                this.rp, this.mp, this.e, this.i, this.r, this.createCompartment,
+                this.defaultCompartment, this.nSkip);
 
 
-            String fileIn = this.in;
-            String sbmlFile = this.sbml;
+        String fileIn = this.in;
+        String sbmlFile = this.sbml;
 
-            Boolean flag = true;
-            try {
-                flag = tb.createReactionsFromFile(fileIn);
-            } catch (Exception e) {
-                e.printStackTrace();
-                System.err.println("Error in creating the network from "+fileIn);
-                return;
-            }
+        Boolean flag = true;
+        try {
+            flag = tb.createReactionsFromFile(fileIn);
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.err.println("Error in creating the network from " + fileIn);
+            return;
+        }
 
-            if(! flag) {
-                System.err.println("Error in creating the network from "+fileIn);
-                return;
-            }
+        if (!flag) {
+            System.err.println("Error in creating the network from " + fileIn);
+            return;
+        }
 
-            BioNetwork bn = tb.getBioNetwork();
+        BioNetwork bn = tb.getBioNetwork();
 
-            JsbmlWriter writer = new JsbmlWriter(sbmlFile, bn);
-            writer.write();
+        JsbmlWriter writer = new JsbmlWriter(sbmlFile, bn);
+        writer.write();
 
-            return;
+        return;
 
-        }
+    }
 
 
-    }
+}
 
 
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index 14e37db9e..9b2a3cd5b 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -36,6 +36,8 @@
 
 package fr.inrae.toulouse.metexplore.met4j_toolbox.generic;
 
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.kohsuke.args4j.CmdLineException;
@@ -43,10 +45,23 @@ import org.kohsuke.args4j.CmdLineParser;
 import org.kohsuke.args4j.Option;
 import org.hibernate.validator.constraints.Range;
 
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.*;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
+import java.util.List;
 import java.util.stream.Collectors;
 
 /**
@@ -57,7 +72,7 @@ import java.util.stream.Collectors;
  */
 public abstract class AbstractMet4jApplication {
 
-    private ArrayList<HashMap<String, String>> options = new ArrayList<HashMap<String, String>>();
+    private ArrayList<HashMap<String, String>> options;
 
     /**
      * Inits the options from the field annotations
@@ -66,90 +81,88 @@ public abstract class AbstractMet4jApplication {
      * @throws IllegalAccessException
      */
     private void initOptions() throws IllegalArgumentException, IllegalAccessException {
-        // Browse each class field
-        for (Field f : this.getClass().getDeclaredFields()) {
-            // Browse each annotation of the field
-            HashMap<String, String> map = new HashMap<String, String>();
 
-            Boolean flag = false;
+        options = new ArrayList<>();
 
-            ArrayList<String> additionalTypes = new ArrayList<>();
-
-            for (Annotation a : f.getDeclaredAnnotations()) {
-                if (a instanceof Option) {
-                    flag = true;
-                    Option option = (Option) a;
+        // Browse each class field
+        for (Field f : this.getClass().getDeclaredFields()) {
 
-                    map.put("name", f.getName());
+            boolean isParameter = Arrays.stream(f.getDeclaredAnnotations()).anyMatch(a -> a instanceof Option);
 
-                    map.put("description", option.usage());
-                    if (!option.metaVar().equals("")) {
-                        map.put("metaVar", option.metaVar());
-                    } else {
-                        map.put("metaVar", "");
-                    }
+            if (isParameter) {
 
-                    if (f.getType().isEnum()) {
-                        map.put("type", "String");
-                    } else {
-                        map.put("type", f.getType().getSimpleName());
-                    }
+                HashMap<String, String> map = new HashMap<>();
 
-                    String required = "false";
-                    if (option.required()) {
-                        required = "true";
-                    }
-                    map.put("required", required);
+                map.put("name", f.getName());
 
-                    String defaultValue = "";
-                    if (f.get(this) != null) {
-                        defaultValue = f.get(this).toString();
-                    }
-                    map.put("default", defaultValue);
+                if (f.getType().isEnum()) {
 
-                    if (f.getType().isEnum()) {
+                    Enum<?> enumValue = (Enum<?>) f.get(this);
+                    Object[] possibleValues = enumValue.getDeclaringClass().getEnumConstants();
 
-                        Enum<?> enumValue = (Enum<?>) f.get(this);
+                    String choices = "";
+                    int n = 0;
 
-                        Object[] possibleValues = enumValue.getDeclaringClass().getEnumConstants();
+                    for (Object object : possibleValues) {
+                        String choice = object.toString();
 
-                        String choices = "";
+                        if (n > 0) {
+                            choices += ",";
+                        }
+                        choices += choice;
+                        n++;
+                    }
 
-                        int n = 0;
+                    map.put("choices", choices);
 
-                        for (Object object : possibleValues) {
+                    map.put("type", "select");
 
-                            String choice = object.toString();
+                } else if (f.getType().getSimpleName().equals("String")) {
+                    map.put("type", "text");
+                } else if (f.getType().getSimpleName().equals("int")) {
+                    map.put("type", "text");
+                } else if (f.getType().getSimpleName().equalsIgnoreCase("double")) {
+                    map.put("type", "float");
+                } else {
+                    map.put("type", f.getType().getSimpleName().toLowerCase());
+                }
 
-                            if (n > 0) {
-                                choices += ",";
-                            }
+                String defaultValue = "";
+                if (f.get(this) != null) {
+                    defaultValue = f.get(this).toString();
+                }
+                map.put("default", defaultValue);
 
-                            choices += choice;
+                for (Annotation a : f.getDeclaredAnnotations()) {
+                    if (a instanceof Option) {
+                        Option option = (Option) a;
 
-                            n++;
+                        map.put("description", option.usage());
+                        if (!option.metaVar().equals("")) {
+                            map.put("metaVar", option.metaVar());
+                        } else {
+                            map.put("metaVar", "");
                         }
 
-                        map.put("choices", choices);
-                    }
-
-                } else if (a instanceof Range) {
-                    Range option = (Range) a;
+                        String required = "false";
+                        if (option.required()) {
+                            required = "true";
+                        }
+                        map.put("required", required);
+                    } else if (a instanceof Range) {
+                        Range option = (Range) a;
 
-                    map.put("min", Double.toString(option.min()));
-                    map.put("max", Double.toString(option.max()));
+                        map.put("min", Double.toString(option.min()));
+                        map.put("max", Double.toString(option.max()));
 
-                } else {
-                    additionalTypes.add(a.annotationType().getSimpleName());
+                    } else if (a instanceof ParameterType) {
+                        map.put("type", ((ParameterType) a).name().toString().toLowerCase());
+                    } else if (a instanceof Format) {
+                        map.put("format", ((Format) a).name().toString().toLowerCase());
+                    }
                 }
-
-                map.put("additionalTypes", additionalTypes.stream()
-                        .collect(Collectors.joining("-")));
-            }
-            if (flag) {
                 options.add(map);
             }
-
         }
     }
 
@@ -161,7 +174,6 @@ public abstract class AbstractMet4jApplication {
      * @throws IllegalAccessException
      * @throws IllegalArgumentException
      */
-    @SuppressWarnings("unchecked")
     public String json() throws IllegalArgumentException, IllegalAccessException {
 
         String json = "";
@@ -177,10 +189,7 @@ public abstract class AbstractMet4jApplication {
         jsonObject.put("short_description", new String(this.getShortDescription()));
         jsonObject.put("java_class", this.getClass().getSimpleName());
 
-        String packageName = this.getClass().getPackage().getName();
-
-        String tab[] = packageName.split("\\.");
-        String simplePackageName = tab[tab.length - 1];
+        String simplePackageName = this.getSimplePackageName();
 
         jsonObject.put("package", simplePackageName);
 
@@ -191,6 +200,102 @@ public abstract class AbstractMet4jApplication {
         return json;
     }
 
+    private String getSimplePackageName() {
+        String packageName = this.getClass().getPackage().getName();
+
+        String tab[] = packageName.split("\\.");
+        String simplePackageName = tab[tab.length - 1];
+
+        return simplePackageName;
+    }
+
+    public void xmlGalaxyWrapper(String filename, String baseCommand) throws ParserConfigurationException, XmlPullParserException, IOException, IllegalAccessException {
+
+        this.initOptions();
+
+        DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
+
+        DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder();
+
+        Document document = documentBuilder.newDocument();
+
+        Element root = document.createElement("tool");
+        root.setAttribute("id", this.getLabel());
+        root.setAttribute("name", this.getLabel());
+        root.setAttribute("version", this.getVersion());
+
+        Element description = document.createElement("description");
+        description.setTextContent(this.getShortDescription());
+        root.appendChild(description);
+
+        Element command = document.createElement("command");
+        String packageName = this.getSimplePackageName();
+        String className = this.getClass().getSimpleName();
+        String commandText = baseCommand + packageName + "." + className;
+        Node cDataDescription = document.createCDATASection(commandText);
+        command.appendChild(cDataDescription);
+        root.appendChild(command);
+
+        Element inputElements = document.createElement("inputs");
+        List<HashMap<String, String>> inputOptions = getInputOptions();
+        inputOptions.forEach(o -> {
+            if (o.get("paramType").equals("parameter")) {
+                Element param = document.createElement("param");
+                param.setAttribute("name", o.get("name"));
+
+                String javaType = o.get("type");
+                String galaxyType = "text";
+
+                String format = "text";
+
+                if (javaType.equalsIgnoreCase("Double")) {
+                    galaxyType = "float";
+                } else if (javaType.equalsIgnoreCase("Integer")) {
+                    galaxyType = "integer";
+                } else if (javaType.equalsIgnoreCase("Boolean")) {
+                    galaxyType = "boolean";
+                } else if (o.get("paramType").equals("input")) {
+                    galaxyType = "data";
+                    if (o.get("additionalTypes").contains("Tsv")) {
+                        format = "tabular";
+                    } else if (o.get("additionalTypes").contains("Csv")) {
+
+                    }
+                }
+
+
+                param.setAttribute("type", o.get("name"));
+            }
+
+
+        });
+
+
+        document.appendChild(root);
+    }
+
+
+    private List<HashMap<String, String>> getInputOptions() {
+        return this.options.stream().filter(o -> !o.get("paramType").equals("output")).collect(Collectors.toList());
+    }
+
+    private String getVersion() throws IOException, XmlPullParserException {
+        MavenXpp3Reader reader = new MavenXpp3Reader();
+        Model model;
+        if ((new File("pom.xml")).exists())
+            model = reader.read(new FileReader("pom.xml"));
+        else
+            model = reader.read(
+                    new InputStreamReader(
+                            AbstractMet4jApplication.class.getResourceAsStream(
+                                    "/META-INF/maven/fr.inrae.toulouse.metexplore/met4j-toolbox/pom.xml"
+                            )
+                    )
+            );
+
+        return model.getVersion();
+    }
+
     /**
      * <p>getLabel.</p>
      *
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gml.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/EnumFormats.java
similarity index 87%
rename from met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gml.java
rename to met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/EnumFormats.java
index 38e1c88b0..b86ac0fa4 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gml.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/EnumFormats.java
@@ -36,12 +36,6 @@
 
 package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
 
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface Gml {
+public enum EnumFormats {
+    Csv, Fasta, Gml, Gsam, Sbml, Text, Tsv
 }
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tsv.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/EnumParameterTypes.java
similarity index 87%
rename from met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tsv.java
rename to met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/EnumParameterTypes.java
index f114cdec6..46bd224da 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Tsv.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/EnumParameterTypes.java
@@ -36,12 +36,8 @@
 
 package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
 
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+public enum EnumParameterTypes {
+
+    InputFile, OutputFile, Integer, Float, Boolean, Text
 
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface Tsv {
 }
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Fasta.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Fasta.java
deleted file mode 100644
index cf30406ee..000000000
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Fasta.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright INRAE (2022)
- *
- * contact-metexplore@inrae.fr
- *
- * This software is a computer program whose purpose is to [describe
- * functionalities and technical features of your software].
- *
- * This software is governed by the CeCILL license under French law and
- * abiding by the rules of distribution of free software.  You can  use,
- * modify and/ or redistribute the software under the terms of the CeCILL
- * license as circulated by CEA, CNRS and INRIA at the following URL
- * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
- *
- * As a counterpart to the access to the source code and  rights to copy,
- * modify and redistribute granted by the license, users are provided only
- * with a limited warranty  and the software's author,  the holder of the
- * economic rights,  and the successive licensors  have only  limited
- * liability.
- *
- * In this respect, the user's attention is drawn to the risks associated
- * with loading,  using,  modifying and/or developing or reproducing the
- * software by the user in light of its specific status of free software,
- * that may mean  that it is complicated to manipulate,  and  that  also
- * therefore means  that it is reserved for developers  and  experienced
- * professionals having in-depth computer knowledge. Users are therefore
- * encouraged to load and test the software's suitability as regards their
- * requirements in conditions enabling the security of their systems and/or
- * data to be ensured and,  more generally, to use and operate it in the
- * same conditions as regards security.
- *
- * The fact that you are presently reading this means that you have had
- * knowledge of the CeCILL license and that you accept its terms.
- *
- */
-
-package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface Fasta {
-}
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Input.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Format.java
similarity index 97%
rename from met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Input.java
rename to met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Format.java
index b42fb2f21..2cefa74ed 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Input.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Format.java
@@ -33,9 +33,9 @@
  * knowledge of the CeCILL license and that you accept its terms.
  *
  */
-
 package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
 
+
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -43,5 +43,6 @@ import java.lang.annotation.Target;
 
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.FIELD)
-public @interface Input {
+public @interface Format {
+    public EnumFormats name();
 }
\ No newline at end of file
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gsam.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gsam.java
deleted file mode 100644
index bd2b43255..000000000
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Gsam.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright INRAE (2022)
- *
- * contact-metexplore@inrae.fr
- *
- * This software is a computer program whose purpose is to [describe
- * functionalities and technical features of your software].
- *
- * This software is governed by the CeCILL license under French law and
- * abiding by the rules of distribution of free software.  You can  use,
- * modify and/ or redistribute the software under the terms of the CeCILL
- * license as circulated by CEA, CNRS and INRIA at the following URL
- * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
- *
- * As a counterpart to the access to the source code and  rights to copy,
- * modify and redistribute granted by the license, users are provided only
- * with a limited warranty  and the software's author,  the holder of the
- * economic rights,  and the successive licensors  have only  limited
- * liability.
- *
- * In this respect, the user's attention is drawn to the risks associated
- * with loading,  using,  modifying and/or developing or reproducing the
- * software by the user in light of its specific status of free software,
- * that may mean  that it is complicated to manipulate,  and  that  also
- * therefore means  that it is reserved for developers  and  experienced
- * professionals having in-depth computer knowledge. Users are therefore
- * encouraged to load and test the software's suitability as regards their
- * requirements in conditions enabling the security of their systems and/or
- * data to be ensured and,  more generally, to use and operate it in the
- * same conditions as regards security.
- *
- * The fact that you are presently reading this means that you have had
- * knowledge of the CeCILL license and that you accept its terms.
- *
- */
-
-package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface Gsam {
-}
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Output.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Output.java
deleted file mode 100644
index ea1d8e6e0..000000000
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Output.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright INRAE (2022)
- *
- * contact-metexplore@inrae.fr
- *
- * This software is a computer program whose purpose is to [describe
- * functionalities and technical features of your software].
- *
- * This software is governed by the CeCILL license under French law and
- * abiding by the rules of distribution of free software.  You can  use,
- * modify and/ or redistribute the software under the terms of the CeCILL
- * license as circulated by CEA, CNRS and INRIA at the following URL
- * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
- *
- * As a counterpart to the access to the source code and  rights to copy,
- * modify and redistribute granted by the license, users are provided only
- * with a limited warranty  and the software's author,  the holder of the
- * economic rights,  and the successive licensors  have only  limited
- * liability.
- *
- * In this respect, the user's attention is drawn to the risks associated
- * with loading,  using,  modifying and/or developing or reproducing the
- * software by the user in light of its specific status of free software,
- * that may mean  that it is complicated to manipulate,  and  that  also
- * therefore means  that it is reserved for developers  and  experienced
- * professionals having in-depth computer knowledge. Users are therefore
- * encouraged to load and test the software's suitability as regards their
- * requirements in conditions enabling the security of their systems and/or
- * data to be ensured and,  more generally, to use and operate it in the
- * same conditions as regards security.
- *
- * The fact that you are presently reading this means that you have had
- * knowledge of the CeCILL license and that you accept its terms.
- *
- */
-
-package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface Output {
-}
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Csv.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/ParameterType.java
similarity index 96%
rename from met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Csv.java
rename to met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/ParameterType.java
index c13312b65..942f4b5b6 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Csv.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/ParameterType.java
@@ -43,5 +43,6 @@ import java.lang.annotation.Target;
 
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.FIELD)
-public @interface Csv {
+public @interface ParameterType {
+    public EnumParameterTypes name();
 }
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Sbml.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Sbml.java
deleted file mode 100644
index 62f408ca7..000000000
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/annotations/Sbml.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright INRAE (2022)
- *
- * contact-metexplore@inrae.fr
- *
- * This software is a computer program whose purpose is to [describe
- * functionalities and technical features of your software].
- *
- * This software is governed by the CeCILL license under French law and
- * abiding by the rules of distribution of free software.  You can  use,
- * modify and/ or redistribute the software under the terms of the CeCILL
- * license as circulated by CEA, CNRS and INRIA at the following URL
- * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
- *
- * As a counterpart to the access to the source code and  rights to copy,
- * modify and redistribute granted by the license, users are provided only
- * with a limited warranty  and the software's author,  the holder of the
- * economic rights,  and the successive licensors  have only  limited
- * liability.
- *
- * In this respect, the user's attention is drawn to the risks associated
- * with loading,  using,  modifying and/or developing or reproducing the
- * software by the user in light of its specific status of free software,
- * that may mean  that it is complicated to manipulate,  and  that  also
- * therefore means  that it is reserved for developers  and  experienced
- * professionals having in-depth computer knowledge. Users are therefore
- * encouraged to load and test the software's suitability as regards their
- * requirements in conditions enabling the security of their systems and/or
- * data to be ensured and,  more generally, to use and operate it in the
- * same conditions as regards security.
- *
- * The fact that you are presently reading this means that you have had
- * knowledge of the CeCILL license and that you accept its terms.
- *
- */
-
-package fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface Sbml {
-}
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CarbonSkeletonNet.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CarbonSkeletonNet.java
index fa73a6ce3..4d762bbf9 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CarbonSkeletonNet.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CarbonSkeletonNet.java
@@ -27,20 +27,24 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
 
-public class CarbonSkeletonNet  extends AbstractMet4jApplication {
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.*;
 
-    @Sbml
-    @Input
+public class CarbonSkeletonNet extends AbstractMet4jApplication {
+
+    @Format(name = Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-s", usage = "input SBML file", required = true)
     public String inputPath = null;
 
-    @Gsam
-    @Input
+    @Format(name = Gsam)
+    @ParameterType(name = InputFile)
     @Option(name = "-g", usage = "input GSAM file", required = true)
     public String inputAAM = null;
 
-    @Gml
-    @Output
+    @Format(name = Gml)
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output Graph file", required = true)
     public String outputPath = null;
 
@@ -94,26 +98,26 @@ public class CarbonSkeletonNet  extends AbstractMet4jApplication {
         System.out.println(" Done.");
 
         System.out.print("Processing atom mappings...");
-        AtomMappingWeightPolicy wp = ( fromIndexes ?
+        AtomMappingWeightPolicy wp = (fromIndexes ?
                 new AtomMappingWeightPolicy().fromConservedCarbonIndexes(inputAAM) :
                 new AtomMappingWeightPolicy().fromNumberOfConservedCarbons(inputAAM)
         );
         wp = wp.binarize()
-        .removeEdgeWithoutMapping()
-        .removeEdgesWithoutConservedCarbon();
+                .removeEdgeWithoutMapping()
+                .removeEdgesWithoutConservedCarbon();
 
         wp.setWeight(graph);
         System.out.println(" Done.");
 
         //invert graph as undirected (copy edge weight to reversed edge)
-       if(undirected){
-           System.out.print("Create Undirected...");
-           graph.asUndirected();
-           System.out.println(" Done.");
-       }
+        if (undirected) {
+            System.out.print("Create Undirected...");
+            graph.asUndirected();
+            System.out.println(" Done.");
+        }
 
         //merge compartment
-        if(mergeComp){
+        if (mergeComp) {
             System.out.print("Merging compartments...");
             VertexContraction vc = new VertexContraction();
             graph = vc.decompartmentalize(graph, new VertexContraction.MapByName());
@@ -121,10 +125,10 @@ public class CarbonSkeletonNet  extends AbstractMet4jApplication {
         }
 
         //remove single-carbon compounds
-        if(!keepSingleCarbon){
+        if (!keepSingleCarbon) {
             System.out.println("Skip compounds with less than two carbons detected...");
             HashSet<BioMetabolite> toRemove = new HashSet<>();
-            for(BioMetabolite n : graph.vertexSet()) {
+            for (BioMetabolite n : graph.vertexSet()) {
                 if (!graph.edgesOf(n).isEmpty()) {
                     String formula = n.getChemicalFormula();
                     try {
@@ -142,19 +146,19 @@ public class CarbonSkeletonNet  extends AbstractMet4jApplication {
         }
 
         //remove isolated nodes
-        if(removeIsolated){
+        if (removeIsolated) {
             System.out.println("Remove isolated nodes...");
             HashSet<BioMetabolite> nodes = new HashSet<>(graph.vertexSet());
             graph.removeIsolatedNodes();
             nodes.removeAll(graph.vertexSet());
-            for(BioMetabolite n : nodes){
+            for (BioMetabolite n : nodes) {
                 System.out.println("\tremoving " + n.getName());
             }
             System.out.println(" Done.");
         }
 
         //compute transitions probability from weights
-        if(computeWeight) {
+        if (computeWeight) {
             System.out.print("Compute transition matrix...");
             ReactionProbabilityWeight wp2 = new ReactionProbabilityWeight();
             wp2.setWeight(graph);
@@ -162,7 +166,7 @@ public class CarbonSkeletonNet  extends AbstractMet4jApplication {
         }
 
         //merge parallel edges
-        if(mergeEdges){
+        if (mergeEdges) {
             System.out.print("Merging edges...");
             EdgeMerger.mergeEdgesWithOverride(graph);
             System.out.println(" Done.");
@@ -170,11 +174,11 @@ public class CarbonSkeletonNet  extends AbstractMet4jApplication {
 
         //export graph
         System.out.print("Exporting...");
-        if(asMatrix){
+        if (asMatrix) {
             ComputeAdjacencyMatrix adjBuilder = new ComputeAdjacencyMatrix(graph);
-            if(!computeWeight) adjBuilder.parallelEdgeWeightsHandling((u, v) -> Math.max(u,v));
-            ExportMatrix.toCSV(this.outputPath,adjBuilder.getadjacencyMatrix());
-        }else{
+            if (!computeWeight) adjBuilder.parallelEdgeWeightsHandling((u, v) -> Math.max(u, v));
+            ExportMatrix.toCSV(this.outputPath, adjBuilder.getadjacencyMatrix());
+        } else {
             ExportGraph.toGmlWithAttributes(graph, this.outputPath, true);
         }
         System.out.println(" Done.");
@@ -182,7 +186,9 @@ public class CarbonSkeletonNet  extends AbstractMet4jApplication {
     }
 
     @Override
-    public String getLabel() {return this.getClass().getSimpleName();}
+    public String getLabel() {
+        return this.getClass().getSimpleName();
+    }
 
     @Override
     public String getLongDescription() {
@@ -194,6 +200,8 @@ public class CarbonSkeletonNet  extends AbstractMet4jApplication {
     }
 
     @Override
-    public String getShortDescription() {return "Create a carbon skeleton graph representation of a SBML file content, using GSAM atom-mapping file (see https://forgemia.inra.fr/metexplore/gsam)";}
+    public String getShortDescription() {
+        return "Create a carbon skeleton graph representation of a SBML file content, using GSAM atom-mapping file (see https://forgemia.inra.fr/metexplore/gsam)";
+    }
 }
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java
index 9240c0d59..2ecbe315e 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java
@@ -11,10 +11,10 @@ import fr.inrae.toulouse.metexplore.met4j_graph.io.Bionetwork2BioGraph;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 import java.io.BufferedReader;
@@ -23,18 +23,24 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.util.HashSet;
 
-public class ChokePoint  extends AbstractMet4jApplication {
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile;
 
-    @Input
-    @Sbml
+public class ChokePoint extends AbstractMet4jApplication {
+
+    @Format(name = Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
-    @Output
-    @Tsv
+    @Format(name = Tsv)
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output results file", required = true)
     public String outputPath = null;
 
+    @Format(name = Text)
+    @ParameterType(name = InputFile)
     @Option(name = "-s", aliases = {"--side"}, usage = "an optional file containing list of side compounds to ignore")
     public String sideCompoundFile = null;
 
@@ -64,23 +70,23 @@ public class ChokePoint  extends AbstractMet4jApplication {
         CompoundGraph graph = builder.getCompoundGraph();
 
         //Graph processing: side compound removal [optional]
-        if(sideCompoundFile!=null){
+        if (sideCompoundFile != null) {
             System.err.println("removing side compounds...");
-            BioCollection<BioMetabolite> sideCpds=new BioCollection<>();
+            BioCollection<BioMetabolite> sideCpds = new BioCollection<>();
             BufferedReader fr = new BufferedReader(new FileReader(sideCompoundFile));
             String line;
             while ((line = fr.readLine()) != null) {
                 String sId = line.trim().split("\t")[0];
                 BioMetabolite s = network.getMetabolite(sId);
-                if(s!=null){
+                if (s != null) {
                     sideCpds.add(s);
-                }else{
-                    System.err.println(sId+" side compound not found in network.");
+                } else {
+                    System.err.println(sId + " side compound not found in network.");
                 }
             }
             fr.close();
             boolean removed = graph.removeAllVertices(sideCpds);
-            if (removed) System.err.println(sideCpds.size()+" compounds removed.");
+            if (removed) System.err.println(sideCpds.size() + " compounds removed.");
         }
 
         //Graph processing: set weights
@@ -93,8 +99,8 @@ public class ChokePoint  extends AbstractMet4jApplication {
 
         //export results
         System.err.println("Export results...");
-        for(BioReaction r : choke){
-            fw.write(r.getId()+"\t"+r.getName()+"\t"+r.toString()+"\n");
+        for (BioReaction r : choke) {
+            fw.write(r.getId() + "\t" + r.getName() + "\t" + r.toString() + "\n");
         }
         System.err.println("done.");
         fw.close();
@@ -108,7 +114,7 @@ public class ChokePoint  extends AbstractMet4jApplication {
 
     @Override
     public String getLongDescription() {
-        return this.getShortDescription()+"\nLoad points constitute an indicator of lethality and can help identifying drug target " +
+        return this.getShortDescription() + "\nLoad points constitute an indicator of lethality and can help identifying drug target " +
                 "Choke points are reactions that are required to consume or produce one compound. Targeting of choke point can lead to the accumulation or the loss of some metabolites, thus choke points constitute an indicator of lethality and can help identifying drug target \n" +
                 "See : Syed Asad Rahman, Dietmar Schomburg; Observing local and global properties of metabolic pathways: ‘load points’ and ‘choke points’ in the metabolic networks. Bioinformatics 2006; 22 (14): 1767-1774. doi: 10.1093/bioinformatics/btl181";
     }
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java
index ee2495c23..68d959d9f 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java
@@ -23,27 +23,32 @@ import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
 
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Csv;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.*;
+
 public class DistanceMatrix extends AbstractMet4jApplication {
 
-    @Input
-    @Sbml
+    @Format(name = Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
-    @Output
-    @Csv
+    @Format(name = Csv)
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output Matrix file", required = true)
     public String outputPath = null;
 
-    @Input
+    @Format(name = EnumFormats.Text)
+    @ParameterType(name = InputFile)
     @Option(name = "-s", aliases = {"--side"}, usage = "an optional file containing list of side compounds to ignore")
     public String sideCompoundFile = null;
 
     @Option(name = "-dw", aliases = {"--degree"}, usage = "penalize traversal of hubs by using degree square weighting", forbids = {"-w"})
     public Boolean degree = false;
 
-    @Input
-    @Tsv
+    @Format(name = EnumFormats.Tsv)
+    @ParameterType(name = InputFile)
     @Option(name = "-w", aliases = {"--weights"}, usage = "an optional file containing weights for compound pairs", forbids = {"-d"})
     public String weightFile = null;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubNetwork.java
index 1a4531818..ed34df2e6 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubNetwork.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubNetwork.java
@@ -29,35 +29,42 @@ import java.io.IOException;
 import java.util.HashSet;
 import java.util.List;
 
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile;
+
 public class ExtractSubNetwork extends AbstractMet4jApplication {
 
-    @Input
-    @Sbml
+    @Format(name = Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
-    @Input
+    @Format(name = Text)
+    @ParameterType(name = InputFile)
     @Option(name = "-s", usage = "input sources txt file", required = true)
     public String sourcePath = null;
 
-    @Input
+    @Format(name = Text)
+    @ParameterType(name = InputFile)
     @Option(name = "-t", usage = "input targets txt file", required = true)
     public String targetPath = null;
 
-    @Output
-    @Gml
+    @Format(name = Gml)
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output gml file", required = true)
     public String outputPath = null;
 
-    @Input
+    @Format(name = Text)
+    @ParameterType(name = InputFile)
     @Option(name = "-sc", aliases = {"--side"}, usage = "an optional file containing list of side compounds to ignore")
     public String sideCompoundFile = null;
 
     @Option(name = "-dw", aliases = {"--degreeWeights"}, usage = "penalize traversal of hubs by using degree square weighting", forbids = {"-cw", "-sw"})
     public Boolean degree = false;
 
-    @Input
-    @Tsv
+    @Format(name = Tsv)
+    @ParameterType(name = InputFile)
     @Option(name = "-cw", aliases = {"--customWeights"}, usage = "an optional file containing weights for compound pairs", forbids = {"-dw", "-sw"})
     public String weightFile = null;
 
@@ -69,6 +76,7 @@ public class ExtractSubNetwork extends AbstractMet4jApplication {
 
     @Option(name = "-k", usage = "Extract k-shortest paths", forbids = {"-st"})
     public int k = 1;
+
     @Option(name = "-st", aliases = {"--steinertree"}, usage = "Extract Steiner Tree", forbids = {"-k"})
     public boolean st = false;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubReactionNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubReactionNetwork.java
index dfa1b8ba9..44b7807e4 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubReactionNetwork.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ExtractSubReactionNetwork.java
@@ -8,18 +8,14 @@ import fr.inrae.toulouse.metexplore.met4j_graph.computation.connect.KShortestPat
 import fr.inrae.toulouse.metexplore.met4j_graph.computation.connect.ShortestPath;
 import fr.inrae.toulouse.metexplore.met4j_graph.computation.connect.SteinerTreeApprox;
 import fr.inrae.toulouse.metexplore.met4j_graph.computation.connect.weighting.DefaultWeightPolicy;
-import fr.inrae.toulouse.metexplore.met4j_graph.computation.connect.weighting.DegreeWeightPolicy;
 import fr.inrae.toulouse.metexplore.met4j_graph.computation.connect.weighting.WeightsFromFile;
 import fr.inrae.toulouse.metexplore.met4j_graph.core.BioPath;
 import fr.inrae.toulouse.metexplore.met4j_graph.core.GraphFactory;
 import fr.inrae.toulouse.metexplore.met4j_graph.core.WeightingPolicy;
-import fr.inrae.toulouse.metexplore.met4j_graph.core.compound.CompoundGraph;
 import fr.inrae.toulouse.metexplore.met4j_graph.core.reaction.CompoundEdge;
 import fr.inrae.toulouse.metexplore.met4j_graph.core.reaction.ReactionGraph;
-import fr.inrae.toulouse.metexplore.met4j_graph.core.compound.ReactionEdge;
 import fr.inrae.toulouse.metexplore.met4j_graph.io.Bionetwork2BioGraph;
 import fr.inrae.toulouse.metexplore.met4j_graph.io.ExportGraph;
-import fr.inrae.toulouse.metexplore.met4j_graph.io.NodeMapping;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_mapping.Mapper;
@@ -31,32 +27,39 @@ import java.io.IOException;
 import java.util.HashSet;
 import java.util.List;
 
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile;
+
 public class ExtractSubReactionNetwork extends AbstractMet4jApplication {
 
-    @Sbml
-    @Input
+    @Format(name = Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
-    @Input
+    @Format(name = Text)
+    @ParameterType(name = InputFile)
     @Option(name = "-s", usage = "input sources txt file", required = true)
     public String sourcePath = null;
 
-    @Input
+    @Format(name = Text)
+    @ParameterType(name = InputFile)
     @Option(name = "-t", usage = "input targets txt file", required = true)
     public String targetPath = null;
 
-    @Output
-    @Gml
+    @Format(name = Gml)
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output gml file", required = true)
     public String outputPath = null;
 
-    @Input
+    @Format(name = Text)
+    @ParameterType(name = InputFile)
     @Option(name = "-sc", aliases = {"--side"}, usage = "a file containing list of side compounds to ignore", required = true)
     public String sideCompoundFile = null;
 
-    @Input
-    @Tsv
+    @Format(name = Tsv)
+    @ParameterType(name = InputFile)
     @Option(name = "-cw", aliases = {"--customWeights"}, usage = "an optional file containing weights for reactions pairs")
     public String weightFile = null;
 
@@ -74,18 +77,21 @@ public class ExtractSubReactionNetwork extends AbstractMet4jApplication {
 
         //Graph processing: import side compounds
         System.err.println("importing side compounds...");
-        Mapper<BioMetabolite> mapper = new Mapper<>(network,BioNetwork::getMetabolitesView).skipIfNotFound();
+        Mapper<BioMetabolite> mapper = new Mapper<>(network, BioNetwork::getMetabolitesView).skipIfNotFound();
         BioCollection<BioMetabolite> sideCpds = mapper.map(sideCompoundFile);
-        if(mapper.getNumberOfSkippedEntries()>0) System.err.println(mapper.getNumberOfSkippedEntries() + " side compounds not found in network.");
+        if (mapper.getNumberOfSkippedEntries() > 0)
+            System.err.println(mapper.getNumberOfSkippedEntries() + " side compounds not found in network.");
         System.err.println(sideCpds.size() + " side compounds ignored during graph build.");
 
         //get sources and targets
         System.err.println("extracting sources and targets");
-        Mapper<BioReaction> rmapper = new Mapper<>(network,BioNetwork::getReactionsView).skipIfNotFound();
+        Mapper<BioReaction> rmapper = new Mapper<>(network, BioNetwork::getReactionsView).skipIfNotFound();
         HashSet<BioReaction> sources = new HashSet<>(rmapper.map(sourcePath));
-        if(rmapper.getNumberOfSkippedEntries()>0) System.err.println(rmapper.getNumberOfSkippedEntries() + " source not found in network.");
+        if (rmapper.getNumberOfSkippedEntries() > 0)
+            System.err.println(rmapper.getNumberOfSkippedEntries() + " source not found in network.");
         HashSet<BioReaction> targets = new HashSet<>(rmapper.map(targetPath));
-        if(rmapper.getNumberOfSkippedEntries()>0) System.err.println(rmapper.getNumberOfSkippedEntries() + " target not found in network.");
+        if (rmapper.getNumberOfSkippedEntries() > 0)
+            System.err.println(rmapper.getNumberOfSkippedEntries() + " target not found in network.");
 
         //Create reaction graph
         Bionetwork2BioGraph builder = new Bionetwork2BioGraph(network);
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/LoadPoint.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/LoadPoint.java
index 8af3404c0..51aff1be5 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/LoadPoint.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/LoadPoint.java
@@ -11,10 +11,9 @@ import fr.inrae.toulouse.metexplore.met4j_graph.io.Bionetwork2BioGraph;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 import java.io.BufferedReader;
@@ -24,19 +23,24 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-public class LoadPoint  extends AbstractMet4jApplication {
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.*;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile;
 
-    @Sbml
-    @Input
+public class LoadPoint extends AbstractMet4jApplication {
+
+    @Format(name = Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
-    @Output
-    @Tsv
+    @Format(name = Tsv)
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output results file", required = true)
     public String outputPath = null;
 
-    @Input
+    @Format(name = Text)
+    @ParameterType(name = InputFile)
     @Option(name = "-s", aliases = {"--side"}, usage = "an optional file containing list of side compounds to ignore")
     public String sideCompoundFile = null;
 
@@ -68,23 +72,23 @@ public class LoadPoint  extends AbstractMet4jApplication {
         CompoundGraph graph = builder.getCompoundGraph();
 
         //Graph processing: side compound removal [optional]
-        if(sideCompoundFile!=null){
+        if (sideCompoundFile != null) {
             System.err.println("removing side compounds...");
-            BioCollection<BioMetabolite> sideCpds=new BioCollection<>();
+            BioCollection<BioMetabolite> sideCpds = new BioCollection<>();
             BufferedReader fr = new BufferedReader(new FileReader(sideCompoundFile));
             String line;
             while ((line = fr.readLine()) != null) {
                 String sId = line.trim().split("\t")[0];
                 BioMetabolite s = network.getMetabolite(sId);
-                if(s!=null){
+                if (s != null) {
                     sideCpds.add(s);
-                }else{
-                    System.err.println(sId+" side compound not found in network.");
+                } else {
+                    System.err.println(sId + " side compound not found in network.");
                 }
             }
             fr.close();
             boolean removed = graph.removeAllVertices(sideCpds);
-            if (removed) System.err.println(sideCpds.size()+" compounds removed.");
+            if (removed) System.err.println(sideCpds.size() + " compounds removed.");
         }
 
         //Graph processing: set weights
@@ -93,14 +97,14 @@ public class LoadPoint  extends AbstractMet4jApplication {
 
         //compute loads
         System.err.println("Computing load points...");
-        fr.inrae.toulouse.metexplore.met4j_graph.computation.analyze.LoadPoint computor = new fr.inrae.toulouse.metexplore.met4j_graph.computation.analyze.LoadPoint<BioMetabolite, ReactionEdge,CompoundGraph>(graph);
+        fr.inrae.toulouse.metexplore.met4j_graph.computation.analyze.LoadPoint computor = new fr.inrae.toulouse.metexplore.met4j_graph.computation.analyze.LoadPoint<BioMetabolite, ReactionEdge, CompoundGraph>(graph);
         HashMap<BioMetabolite, Double> loads = computor.getLoads(k);
 
         //export results
         System.err.println("Export results...");
-        for(Map.Entry<BioMetabolite, Double> e : loads.entrySet()){
+        for (Map.Entry<BioMetabolite, Double> e : loads.entrySet()) {
             BioMetabolite m = e.getKey();
-            fw.write(m.getId()+"\t"+m.getName()+"\t"+e.getValue()+"\n");
+            fw.write(m.getId() + "\t" + m.getName() + "\t" + e.getValue() + "\n");
         }
         System.err.println("done.");
         fw.close();
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java
index 98b02c5fc..9b735eec8 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/MetaboRank.java
@@ -52,10 +52,9 @@ import fr.inrae.toulouse.metexplore.met4j_graph.io.Bionetwork2BioGraph;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 import java.io.*;
@@ -65,30 +64,35 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Tsv;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile;
+
 /**
  * @author clement
  */
 public class MetaboRank extends AbstractMet4jApplication {
 
     //arguments
-    @Sbml
-    @Input
+    @Format(name = Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-i", usage = "input SBML file: path to network used for computing centrality, in sbml format.", required = true)
     public String sbmlFilePath;
 
-    @Input
-    @Tsv
+    @Format(name = Tsv)
+    @ParameterType(name = InputFile)
     @Option(name = "-s", usage = "input seeds file: tabulated file containing node of interest ids and weight", required = true)
     public String seedsFilePath;
 
-    @Output
-    @Tsv
+    @Format(name = Tsv)
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output file: path to the file where the results will be exported", required = true)
     public String output;
 
     //parameters
-    @Input
-    @Tsv
+    @Format(name = Tsv)
+    @ParameterType(name = InputFile)
     @Option(name = "-w", usage = "input edge weight file: (recommended) path to file containing edges' weights. Will be normalized as transition probabilities")
     public String edgeWeightsFilePaths;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/NetworkSummary.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/NetworkSummary.java
index 84d0b95ab..427fbbea6 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/NetworkSummary.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/NetworkSummary.java
@@ -18,9 +18,9 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.BioMatrix;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
 import org.kohsuke.args4j.Option;
 
@@ -31,30 +31,33 @@ import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile;
+
 
 public class NetworkSummary extends AbstractMet4jApplication {
 
-    @Input
-    @Sbml
+    @Format(name = Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
-    @Output
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output report file", required = true)
     public String outputPath = null;
 
-    @Input
+    @ParameterType(name = InputFile)
     @Option(name = "-s", aliases = {"--side"}, usage = "an optional file containing list of side compounds to ignore (recommended)")
     public String sideCompoundFile = null;
 
-    @Option(name = "-sd", aliases = {"--skipdist"}, usage = "skip full distance matrix computation (quick summary)", forbids={"-w"})
+    @Option(name = "-sd", aliases = {"--skipdist"}, usage = "skip full distance matrix computation (quick summary)", forbids = {"-w"})
     public Boolean skipdist = false;
 
     @Option(name = "-d", aliases = {"--directed"}, usage = "use reaction direction for distances")
     public Boolean directed = false;
 
 
-
     public static void main(String[] args) throws IOException, Met4jSbmlReaderException {
         NetworkSummary app = new NetworkSummary();
         app.parseArguments(args);
@@ -65,12 +68,12 @@ public class NetworkSummary extends AbstractMet4jApplication {
     public void run() throws IOException, Met4jSbmlReaderException {
         //Start output
         FileWriter fw = new FileWriter(outputPath);
-            fw.write("#\tMET4J NETWORK SUMMARY\n");
-            fw.write("#\tNetwork: "+this.inputPath+"\n");
-            if(sideCompoundFile!=null) fw.write("#\tSide compounds: "+this.sideCompoundFile+"\n");
+        fw.write("#\tMET4J NETWORK SUMMARY\n");
+        fw.write("#\tNetwork: " + this.inputPath + "\n");
+        if (sideCompoundFile != null) fw.write("#\tSide compounds: " + this.sideCompoundFile + "\n");
         Date currentDate = new Date();
-            fw.write("#\t"+currentDate.toString()+"\n");
-            fw.write("#"+"-".repeat(60)+"\n");
+        fw.write("#\t" + currentDate.toString() + "\n");
+        fw.write("#" + "-".repeat(60) + "\n");
 
         //import network
         System.err.println("reading SBML...");
@@ -86,23 +89,23 @@ public class NetworkSummary extends AbstractMet4jApplication {
         wp.setWeight(graph);
 
         //Graph processing: side compound removal
-        if(sideCompoundFile!=null){
+        if (sideCompoundFile != null) {
             System.err.println("removing side compounds...");
-            BioCollection<BioMetabolite> sideCpds=new BioCollection<>();
+            BioCollection<BioMetabolite> sideCpds = new BioCollection<>();
             BufferedReader fr = new BufferedReader(new FileReader(sideCompoundFile));
             String line;
             while ((line = fr.readLine()) != null) {
                 String sId = line.trim().split("\t")[0];
                 BioMetabolite s = network.getMetabolite(sId);
-                if(s!=null){
+                if (s != null) {
                     sideCpds.add(s);
-                }else{
-                    System.err.println(sId+" side compound not found in network.");
+                } else {
+                    System.err.println(sId + " side compound not found in network.");
                 }
             }
             fr.close();
             boolean removed = graph.removeAllVertices(sideCpds);
-            if (removed) System.err.println(sideCpds.size()+" compounds removed.");
+            if (removed) System.err.println(sideCpds.size() + " compounds removed.");
         }
 
         //Start Anlysis
@@ -111,43 +114,43 @@ public class NetworkSummary extends AbstractMet4jApplication {
         analyzer.adjustEdgeCountForMultiGraph();
 
         //basic stats
-            fw.write("Number of nodes:\t"+graph.vertexSet().size()+"\n");
-            fw.write("Number of edges:\t"+graph.edgeSet().size()+"\n");
-            fw.write("Number of neighbor pairs (ignore parallel edges):\t"+(int)analyzer.getNumberOfEdges()+"\n");
+        fw.write("Number of nodes:\t" + graph.vertexSet().size() + "\n");
+        fw.write("Number of edges:\t" + graph.edgeSet().size() + "\n");
+        fw.write("Number of neighbor pairs (ignore parallel edges):\t" + (int) analyzer.getNumberOfEdges() + "\n");
 
         //connectivity
         System.err.println("extract connected component...");
         List<Set<BioMetabolite>> cc = GraphMeasure.getConnectedCompenent(graph);
-            fw.write("Number of connected component:\t"+cc.size()+"\n");
+        fw.write("Number of connected component:\t" + cc.size() + "\n");
         Map<Integer, Integer> ccSizes = cc.stream().collect(Collectors.groupingBy(Set::size))
                 .entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, (e -> e.getValue().size())));
-        for(Map.Entry e : ccSizes.entrySet()){
-            fw.write("\t"+e.getKey()+" x"+e.getValue()+"\n");
+        for (Map.Entry e : ccSizes.entrySet()) {
+            fw.write("\t" + e.getKey() + " x" + e.getValue() + "\n");
         }
 
         //density
         System.err.println("Compute density...");
-        fw.write("Density (gamma index):\t"+analyzer.getGamma()+"\n");
+        fw.write("Density (gamma index):\t" + analyzer.getGamma() + "\n");
         DescriptiveStatistics clusterStats = new DescriptiveStatistics();
         System.err.println("Compute local clustering coefficients...");
-        GraphLocalMeasure<BioMetabolite,ReactionEdge,CompoundGraph> analyzer2 = new GraphLocalMeasure(graph);
-        for(BioMetabolite v : graph.vertexSet()){
+        GraphLocalMeasure<BioMetabolite, ReactionEdge, CompoundGraph> analyzer2 = new GraphLocalMeasure(graph);
+        for (BioMetabolite v : graph.vertexSet()) {
             clusterStats.addValue(analyzer2.getLocalClusteringCoeff(v));
         }
-            fw.write("Average local clustering coefficient:\t"+clusterStats.getMean()+"\n");
+        fw.write("Average local clustering coefficient:\t" + clusterStats.getMean() + "\n");
 
 
         //degree statistics
         System.err.println("Compute degree statistics...");
         DescriptiveStatistics degreeStats = new DescriptiveStatistics();
-        for(BioMetabolite v : graph.vertexSet()){
+        for (BioMetabolite v : graph.vertexSet()) {
             degreeStats.addValue(graph.degreeOf(v));
         }
-        fw.write("Max degree:\t"+degreeStats.getMax()+"\n");
-        fw.write("Average degree:\t"+degreeStats.getMean()+"\n");
+        fw.write("Max degree:\t" + degreeStats.getMax() + "\n");
+        fw.write("Average degree:\t" + degreeStats.getMean() + "\n");
 
         //distances statistics
-        if(!skipdist) {
+        if (!skipdist) {
             System.err.println("Compute distances...");
             //  compute distance matrix
             ComputeAdjacencyMatrix adjBuilder = new ComputeAdjacencyMatrix(graph);
@@ -160,11 +163,11 @@ public class NetworkSummary extends AbstractMet4jApplication {
             System.err.println("Compute distances statistics...");
             DescriptiveStatistics distStats = new DescriptiveStatistics();
             //  gather all elements in matrix, remove infinity
-            for(int i=0; i<distM.numRows(); i++){
-                for(int j=0; j<distM.numCols(); j++){
-                    if(i!=j){
-                        Double d=distM.get(i,j);
-                        if(!d.equals(Double.POSITIVE_INFINITY)){
+            for (int i = 0; i < distM.numRows(); i++) {
+                for (int j = 0; j < distM.numCols(); j++) {
+                    if (i != j) {
+                        Double d = distM.get(i, j);
+                        if (!d.equals(Double.POSITIVE_INFINITY)) {
                             distStats.addValue(d);
                         }
                     }
@@ -172,8 +175,8 @@ public class NetworkSummary extends AbstractMet4jApplication {
             }
 
             int diameter = (int) distStats.getMax();
-                fw.write("Diameter:\t"+diameter+"\n");
-                fw.write("Average shortest path length:\t"+distStats.getMean()+"\n");
+            fw.write("Diameter:\t" + diameter + "\n");
+            fw.write("Average shortest path length:\t" + distStats.getMean() + "\n");
 
             //Centrality analysis
             System.err.println("Compute centrality...");
@@ -193,7 +196,7 @@ public class NetworkSummary extends AbstractMet4jApplication {
             fw.write("Top Closeness:\n");
             for (int i = 0; i < 20; i++) {
                 Map.Entry<BioMetabolite, Integer> e = it.next();
-                fw.write("\t"+(e.getValue()+1)+"\t"+e.getKey().getName()+"\t"+(closenessRaw.get(e.getKey())*graph.vertexSet().size())+"\n");
+                fw.write("\t" + (e.getValue() + 1) + "\t" + e.getKey().getName() + "\t" + (closenessRaw.get(e.getKey()) * graph.vertexSet().size()) + "\n");
 
             }
 
@@ -207,13 +210,18 @@ public class NetworkSummary extends AbstractMet4jApplication {
         System.err.println("Done.");
         fw.close();
     }
+
     @Override
-    public String getLabel() {return this.getClass().getSimpleName();}
+    public String getLabel() {
+        return this.getClass().getSimpleName();
+    }
 
     @Override
-    public String getLongDescription() {return "Use a metabolic network in SBML file and an optional list of side compounds, " +
-            "and produce a report summarizing several graph measures characterising the structure of the network." +
-            "This includes (non-exhaustive list): size and order, connectivity, density, degree distribution, shortest paths length, top centrality nodes...";}
+    public String getLongDescription() {
+        return "Use a metabolic network in SBML file and an optional list of side compounds, " +
+                "and produce a report summarizing several graph measures characterising the structure of the network." +
+                "This includes (non-exhaustive list): size and order, connectivity, density, degree distribution, shortest paths length, top centrality nodes...";
+    }
 
     @Override
     public String getShortDescription() {
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java
index 309df8551..43e0ee29c 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java
@@ -12,28 +12,32 @@ import fr.inrae.toulouse.metexplore.met4j_graph.io.NodeMapping;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Gml;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
 
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Gml;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile;
+
 public class PrecursorNetwork extends AbstractMet4jApplication {
 
     //arguments
-    @Input
-    @Sbml
+    @Format(name = Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-i", usage = "input SBML file: path to network used for computing scope, in sbml format.", required = true)
     public String sbmlFilePath;
 
-    @Input
+    @ParameterType(name = InputFile)
     @Option(name = "-t", aliases = {"--targets"}, usage = "input target file: tabulated file containing node of interest ids", required = true)
     public String targetsFilePath;
 
-    @Output
-    @Gml
+    @Format(name = Gml)
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output file: path to the .gml file where the results precursor network will be exported", required = true)
     public String output;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java
index 35211a2c9..2ad3ef47d 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ScopeNetwork.java
@@ -13,40 +13,44 @@ import fr.inrae.toulouse.metexplore.met4j_graph.io.NodeMapping;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Gml;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
 
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Gml;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile;
+
 public class ScopeNetwork extends AbstractMet4jApplication {
 
     //arguments
-    @Input
-    @Sbml
+    @Format(name = Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-i", usage = "input SBML file: path to network used for computing scope, in sbml format.", required = true)
     public String sbmlFilePath;
 
-    @Input
+    @ParameterType(name = InputFile)
     @Option(name = "-s", aliases = {"--seeds"}, usage = "input seeds file: tabulated file containing node of interest ids", required = true)
     public String seedsFilePath;
 
-    @Output
-    @Gml
+    @Format(name = Gml)
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output file: path to the .gml file where the results scope network will be exported", required = true)
     public String output;
 
     //options
-    @Input
+    @ParameterType(name = InputFile)
     @Option(name = "-sc", aliases = {"--sides"}, usage = "an optional file containing list of ubiquitous side compounds to be considered available by default but ignored during expansion")
     public String sideCompoundFile = null;
 
     @Option(name = "-ssc", aliases = {"--showsides"}, usage = "show side compounds in output network", depends = {"-sc"})
     public boolean includeSides = false;
 
-    @Input
+    @ParameterType(name = InputFile)
     @Option(name = "-ir", aliases = {"--ignore"}, usage = "an optional file containing list of reaction to ignore (forbid inclusion in scope")
     public String reactionToIgnoreFile = null;
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java
index 0d815797e..155c7a0b8 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java
@@ -9,31 +9,32 @@ import fr.inrae.toulouse.metexplore.met4j_graph.core.compound.CompoundGraph;
 import fr.inrae.toulouse.metexplore.met4j_graph.io.Bionetwork2BioGraph;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
-import fr.inrae.toulouse.metexplore.met4j_core.utils.StringUtils;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Input;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Output;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Sbml;
-import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Tsv;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
 import org.kohsuke.args4j.Option;
 
 import java.io.FileWriter;
 import java.io.IOException;
-import java.util.regex.Pattern;
+
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Sbml;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats.Tsv;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.InputFile;
+import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes.OutputFile;
 
 /**
  *
  */
 public class SideCompoundsScan extends AbstractMet4jApplication {
 
-    @Sbml
-    @Input
+    @Format(name = Sbml)
+    @ParameterType(name = InputFile)
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
-    @Output
-    @Tsv
+    @Format(name = Tsv)
+    @ParameterType(name = OutputFile)
     @Option(name = "-o", usage = "output Side-Compounds file", required = true)
     public String outputPath = null;
 
@@ -146,26 +147,26 @@ public class SideCompoundsScan extends AbstractMet4jApplication {
                 String formula = v.getChemicalFormula();
                 String inorganic = "?";
                 String validForumla = "true";
-                try{
+                try {
                     FormulaParser fp = new FormulaParser(formula);
-                    if(flagInorganic){
-                        if(fp.isExpectedInorganic()){
+                    if (flagInorganic) {
+                        if (fp.isExpectedInorganic()) {
                             inorganic = "true";
                             side = true;
-                        }else{
+                        } else {
                             inorganic = "false";
                         }
                     }
-                }catch(IllegalArgumentException e){
-                    if(flagNoFormula){
+                } catch (IllegalArgumentException e) {
+                    if (flagNoFormula) {
                         validForumla = "false";
                         side = true;
                     }
 
                 }
-                if (reportValue){
-                    if(flagInorganic) l.append("\t" + inorganic);
-                    if(flagNoFormula) l.append("\t" + validForumla);
+                if (reportValue) {
+                    if (flagInorganic) l.append("\t" + inorganic);
+                    if (flagNoFormula) l.append("\t" + validForumla);
                 }
             }
 
-- 
GitLab


From 388aab565f07ce16d29bff2381171c318a106992 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 21 Apr 2022 13:35:32 +0200
Subject: [PATCH 09/83] Add missing parameter decorators

---
 .../met4j_toolbox/networkAnalysis/PrecursorNetwork.java         | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java
index 43e0ee29c..758dc41a0 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/PrecursorNetwork.java
@@ -42,8 +42,10 @@ public class PrecursorNetwork extends AbstractMet4jApplication {
     public String output;
 
     //oprtions
+    @ParameterType(name = InputFile)
     @Option(name = "-sc", aliases = {"--sides"}, usage = "an optional file containing list of ubiquitous compounds to be considered already available")
     public String sideCompoundFile = null;
+    @ParameterType(name = InputFile)
     @Option(name = "-ir", aliases = {"--ignore"}, usage = "an optional file containing list of reaction to ignore (forbid inclusion in scope")
     public String reactionToIgnoreFile = null;
 
-- 
GitLab


From ae931390b98b5d387c6ea5d7da08991d1641965d Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 21 Apr 2022 13:36:00 +0200
Subject: [PATCH 10/83] debug parameter annotations

---
 .../met4j_toolbox/attributes/SbmlToMetaboliteTable.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
index fca3fcc36..184bf7b56 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
@@ -41,7 +41,9 @@ import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
@@ -57,11 +59,13 @@ import java.io.PrintWriter;
  */
 public class SbmlToMetaboliteTable extends AbstractMet4jApplication {
 
-    @ParameterType(name= EnumParameterTypes.Integer)
+    @ParameterType(name= EnumParameterTypes.InputFile)
+    @Format(name= EnumFormats.Sbml)
     @Option(name = "-s", usage = "Sbml file", required = true)
     public String sbml;
 
-    @ParameterType(name= EnumParameterTypes.Integer)
+    @ParameterType(name= EnumParameterTypes.InputFile)
+    @Format(name= EnumFormats.Tsv)
     @Option(name = "-o", usage = "Output file", required=true)
     public String outputFile;
 
-- 
GitLab


From 724acd84cf7a3e65117ff7b2fba76b86b97332a8 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 21 Apr 2022 13:36:13 +0200
Subject: [PATCH 11/83] Add strategy.no

---
 .../met4j_toolbox/networkAnalysis/SideCompoundsScan.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java
index 05996ff51..197ba1edd 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/SideCompoundsScan.java
@@ -64,10 +64,10 @@ public class SideCompoundsScan extends AbstractMet4jApplication {
     @Option(name = "-er", aliases = {"--edgeRedundancy"}, usage = "flag as side compound any compound with a number of redundancy in incident edges (parallel edges connecting to the same neighbor) above the given threshold")
     public double parallelEdge = Double.NaN;
 
-    enum strategy {by_name,by_id}
+    enum strategy {no, by_name,by_id}
     @Option(name = "-m", aliases = {"--merge"}, usage = "Degree is shared between compounds in different compartments. " +
             "Use names if consistent and unambiguous across compartments, or identifiers if compartment suffix is present (id in form \"xxx_y\" with xxx as base identifier and y as compartment label).")
-    public strategy mergingStrat = null;
+    public strategy mergingStrat = strategy.no;
 
 
     public static void main(String[] args) throws IOException, Met4jSbmlReaderException {
@@ -108,7 +108,7 @@ public class SideCompoundsScan extends AbstractMet4jApplication {
 
         //if merging compartment
         Map<String, Integer> mergedDegree = new HashMap<>();
-        Boolean merge = (mergingStrat!=null);
+        Boolean merge = (mergingStrat!=strategy.no);
         Function<BioMetabolite,String> getSharedId = BioMetabolite::getName;
         if(merge){
             if(mergingStrat.equals(strategy.by_id)) getSharedId = (new VertexContraction.MapByIdSubString("^(\\w+)_\\w$"))::commonField;
-- 
GitLab


From 6b4dbf0d64a4ab94c9c3d8bbac22242ef402c948 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 21 Apr 2022 13:36:33 +0200
Subject: [PATCH 12/83] method to generate galaxy xml wrappers

---
 .../generic/AbstractMet4jApplication.java     | 100 ++++++++++++------
 1 file changed, 68 insertions(+), 32 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index 9b2a3cd5b..79f39af65 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -55,6 +55,9 @@ import org.w3c.dom.Node;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
 import java.io.*;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
@@ -95,9 +98,11 @@ public abstract class AbstractMet4jApplication {
 
                 map.put("name", f.getName());
 
+
                 if (f.getType().isEnum()) {
 
                     Enum<?> enumValue = (Enum<?>) f.get(this);
+
                     Object[] possibleValues = enumValue.getDeclaringClass().getEnumConstants();
 
                     String choices = "";
@@ -137,18 +142,21 @@ public abstract class AbstractMet4jApplication {
                     if (a instanceof Option) {
                         Option option = (Option) a;
 
-                        map.put("description", option.usage());
+                        map.put("label", option.usage());
+
                         if (!option.metaVar().equals("")) {
                             map.put("metaVar", option.metaVar());
                         } else {
                             map.put("metaVar", "");
                         }
 
-                        String required = "false";
+                        map.put("argument", option.name());
+
+                        String optional = "true";
                         if (option.required()) {
-                            required = "true";
+                            optional = "false";
                         }
-                        map.put("required", required);
+                        map.put("optional", optional);
                     } else if (a instanceof Range) {
                         Range option = (Range) a;
 
@@ -209,7 +217,15 @@ public abstract class AbstractMet4jApplication {
         return simplePackageName;
     }
 
-    public void xmlGalaxyWrapper(String filename, String baseCommand) throws ParserConfigurationException, XmlPullParserException, IOException, IllegalAccessException {
+    public void xmlGalaxyWrapper(String outputDirectory, String baseCommand) throws ParserConfigurationException, XmlPullParserException, IOException, IllegalAccessException, TransformerException {
+
+        String packageName = this.getSimplePackageName();
+
+        File packageDirectory = new File(outputDirectory + "/" + packageName);
+
+        if (!packageDirectory.exists()) {
+            packageDirectory.mkdirs();
+        }
 
         this.initOptions();
 
@@ -229,9 +245,8 @@ public abstract class AbstractMet4jApplication {
         root.appendChild(description);
 
         Element command = document.createElement("command");
-        String packageName = this.getSimplePackageName();
         String className = this.getClass().getSimpleName();
-        String commandText = baseCommand + packageName + "." + className;
+        String commandText = baseCommand + " "+ packageName + "." + className;
         Node cDataDescription = document.createCDATASection(commandText);
         command.appendChild(cDataDescription);
         root.appendChild(command);
@@ -239,44 +254,65 @@ public abstract class AbstractMet4jApplication {
         Element inputElements = document.createElement("inputs");
         List<HashMap<String, String>> inputOptions = getInputOptions();
         inputOptions.forEach(o -> {
-            if (o.get("paramType").equals("parameter")) {
-                Element param = document.createElement("param");
-                param.setAttribute("name", o.get("name"));
-
-                String javaType = o.get("type");
-                String galaxyType = "text";
-
-                String format = "text";
-
-                if (javaType.equalsIgnoreCase("Double")) {
-                    galaxyType = "float";
-                } else if (javaType.equalsIgnoreCase("Integer")) {
-                    galaxyType = "integer";
-                } else if (javaType.equalsIgnoreCase("Boolean")) {
-                    galaxyType = "boolean";
-                } else if (o.get("paramType").equals("input")) {
-                    galaxyType = "data";
-                    if (o.get("additionalTypes").contains("Tsv")) {
-                        format = "tabular";
-                    } else if (o.get("additionalTypes").contains("Csv")) {
-
-                    }
-                }
 
+            Element param = getParamFromOption(document, o);
+            inputElements.appendChild(param);
 
-                param.setAttribute("type", o.get("name"));
+            if (o.get("type").startsWith("input")) {
+                param.setAttribute("type", "data");
+            } else {
+                param.setAttribute("type", o.get("type"));
             }
 
+        });
+
+        root.appendChild(inputElements);
+
+        Element outputElements = document.createElement("outputs");
+        List<HashMap<String, String>> outputOptions = getOutputOptions();
+
+        outputOptions.forEach(o -> {
 
+            Element param = getParamFromOption(document, o);
+            outputElements.appendChild(param);
+
+            if (o.get("type").startsWith("output")) {
+                param.setAttribute("type", "data");
+            } else {
+                param.setAttribute("type", o.get("type"));
+            }
         });
 
+        root.appendChild(outputElements);
 
         document.appendChild(root);
+
+        TransformerFactory transformerFactory = TransformerFactory.newInstance();
+        Transformer transformer = transformerFactory.newTransformer();
+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+        DOMSource domSource = new DOMSource(document);
+        StreamResult streamResult = new StreamResult(new File(packageDirectory.getAbsolutePath() + "/" + className + ".xml"));
+
+        transformer.transform(domSource, streamResult);
+    }
+
+    private Element getParamFromOption(Document document, HashMap<String, String> o) {
+        Element param = document.createElement("param");
+        param.setAttribute("name", o.get("name"));
+        param.setAttribute("label", o.get("label"));
+        param.setAttribute("optional", o.get("optional"));
+        param.setAttribute("argument", o.get("argument"));
+        return param;
     }
 
 
     private List<HashMap<String, String>> getInputOptions() {
-        return this.options.stream().filter(o -> !o.get("paramType").equals("output")).collect(Collectors.toList());
+        return this.options.stream().filter(o -> !o.containsKey("paramType") || !o.get("paramType").equals("output")).collect(Collectors.toList());
+    }
+
+    private List<HashMap<String, String>> getOutputOptions() {
+        return this.options.stream().filter(o -> !o.containsKey("paramType") || o.get("paramType").equals("output")).collect(Collectors.toList());
     }
 
     private String getVersion() throws IOException, XmlPullParserException {
-- 
GitLab


From 0bec6a6c084ed1aa11e88eae7a472abb302ab782 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 21 Apr 2022 13:36:47 +0200
Subject: [PATCH 13/83] Class to generate all the galaxy xml wrappers

---
 .../met4j_toolbox/GenerateGalaxyFiles.java    | 153 ++++++++++++++++++
 1 file changed, 153 insertions(+)
 create mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
new file mode 100644
index 000000000..eb9112727
--- /dev/null
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright INRAE (2022)
+ *
+ * contact-metexplore@inrae.fr
+ *
+ * This software is a computer program whose purpose is to [describe
+ * functionalities and technical features of your software].
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ */
+package fr.inrae.toulouse.metexplore.met4j_toolbox;
+
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.ResourceURLFilter;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Resources;
+import org.kohsuke.args4j.Option;
+
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URL;
+
+public class GenerateGalaxyFiles extends AbstractMet4jApplication {
+
+
+    @Option(name = "-o", usage = "output directory where the galaxy wrappers will be written", required = true)
+    public String outputDirectory;
+
+    @Option(name = "-c", usage = "full path of the command line to launch met4j ", required = true)
+    public String command;
+
+    public static void main(String[] args) {
+
+        GenerateGalaxyFiles app = new GenerateGalaxyFiles();
+        app.parseArguments(args);
+        app.run();
+    }
+
+    private void run() {
+
+        try {
+            ResourceURLFilter filter = u -> {
+
+                String path = GenerateGalaxyFiles.class.getPackage().getName()
+                        .replace(".", "/");
+
+                String s = u.getFile();
+                return s.endsWith(".class") && !s.contains("$")
+                        && s.contains(path);
+            };
+
+
+            File rep = new File(this.outputDirectory);
+
+            if(rep.exists() && ! rep.isDirectory()) {
+                System.err.println(this.outputDirectory+" already exists and it's a file not a directory...");
+                System.exit(1);
+            }
+
+            if(!rep.exists()) {
+                if (!rep.mkdir()) {
+                    System.err.println("Impossible to create the directory " + this.outputDirectory);
+                    System.exit(1);
+                }
+            }
+
+            String path = GenerateGalaxyFiles.class.getPackage().getName()
+                    .replace(".", "/");
+
+            int n = 0;
+
+            for (URL u : Resources.getResourceURLs(Resources.class, filter)) {
+
+                String entry = u.getFile();
+                int idx = entry.indexOf(path);
+
+                entry = entry.substring(idx, entry.length() - ".class".length());
+
+                Class<?> myClass = Class.forName(entry.replace('/', '.'));
+
+                if (myClass != this.getClass()
+                        && myClass.getSuperclass() != null
+                        && myClass.getSuperclass().equals(AbstractMet4jApplication.class)) {
+
+                    Constructor<?> ctor = myClass.getConstructor();
+
+                    try {
+                        Object obj = ctor.newInstance();
+
+                        Class methodArgs[] =  new Class[2];
+                        methodArgs[0] = String.class;
+                        methodArgs[1] = String.class;
+
+                        System.err.println(obj.getClass().getName());
+
+                        Method method = obj.getClass().getMethod("xmlGalaxyWrapper", methodArgs);
+                        method.invoke(obj, this.outputDirectory, this.command);
+                        n++;
+                    } catch (InstantiationException e) {
+                        // It's not a class that can be instantiated
+                    }
+
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.err.println("Problem while creating galaxy file tree");
+            System.exit(1);
+        }
+    }
+
+    @Override
+    public String getLabel() {
+        return this.getClass().getSimpleName();
+    }
+
+    @Override
+    public String getLongDescription() {
+        return this.getShortDescription()+"\n" +
+                "Creates a directory for each app with inside the galaxy xml wrapper.";
+    }
+
+    @Override
+    public String getShortDescription() {
+        return "Create the galaxy file tree containing met4j-toolbox app wrappers";
+    }
+}
\ No newline at end of file
-- 
GitLab


From cd94ac61997c2f9e17ab1e162dd67c3a309ad484 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 22 Apr 2022 15:36:34 +0200
Subject: [PATCH 14/83] Generation of the xml wrappers and the tool_conf.xml
 file

---
 .../met4j_toolbox/GenerateGalaxyFiles.java    | 52 ++++++++++++++++++-
 .../generic/AbstractMet4jApplication.java     | 52 ++++++++++++-------
 2 files changed, 84 insertions(+), 20 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
index eb9112727..68b5eb2b5 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
@@ -39,7 +39,16 @@ import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplicati
 import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.ResourceURLFilter;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Resources;
 import org.kohsuke.args4j.Option;
-
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
 import java.io.File;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
@@ -48,7 +57,7 @@ import java.net.URL;
 public class GenerateGalaxyFiles extends AbstractMet4jApplication {
 
 
-    @Option(name = "-o", usage = "output directory where the galaxy wrappers will be written", required = true)
+    @Option(name = "-o", usage = "output directory where the galaxy wrappers and the tool_conf.xml will be written", required = true)
     public String outputDirectory;
 
     @Option(name = "-c", usage = "full path of the command line to launch met4j ", required = true)
@@ -64,6 +73,24 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
     private void run() {
 
         try {
+
+            DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
+
+            DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder();
+
+            Document toolConf = documentBuilder.newDocument();
+
+            Element root = toolConf.createElement("toolbox");
+
+            root.setAttribute("monitor", "true");
+            toolConf.appendChild(root);
+
+            Element section = toolConf.createElement("section");
+            section.setAttribute("id", "met4j");
+            section.setAttribute("name", "met4j apps");
+
+            root.appendChild(section);
+
             ResourceURLFilter filter = u -> {
 
                 String path = GenerateGalaxyFiles.class.getPackage().getName()
@@ -120,6 +147,16 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
 
                         Method method = obj.getClass().getMethod("xmlGalaxyWrapper", methodArgs);
                         method.invoke(obj, this.outputDirectory, this.command);
+
+                        Element tool = toolConf.createElement("tool");
+
+                        Method getPackageName = obj.getClass().getMethod("getSimplePackageName");
+                        String packageName = (String) getPackageName.invoke(obj);
+
+                        tool.setAttribute("file", "met4j/"+packageName+"/"+obj.getClass().getSimpleName()+".xml");
+
+                        section.appendChild(tool);
+
                         n++;
                     } catch (InstantiationException e) {
                         // It's not a class that can be instantiated
@@ -128,11 +165,22 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
                 }
             }
 
+            TransformerFactory transformerFactory = TransformerFactory.newInstance();
+            Transformer transformer = transformerFactory.newTransformer();
+            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+            DOMSource domSource = new DOMSource(toolConf);
+            StreamResult streamResult = new StreamResult(new File(outputDirectory+"/tool_conf.xml"));
+
+            transformer.transform(domSource, streamResult);
+
         } catch (Exception e) {
             e.printStackTrace();
             System.err.println("Problem while creating galaxy file tree");
             System.exit(1);
         }
+
+
     }
 
     @Override
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index 79f39af65..40f49755a 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -208,7 +208,7 @@ public abstract class AbstractMet4jApplication {
         return json;
     }
 
-    private String getSimplePackageName() {
+    public String getSimplePackageName() {
         String packageName = this.getClass().getPackage().getName();
 
         String tab[] = packageName.split("\\.");
@@ -247,24 +247,32 @@ public abstract class AbstractMet4jApplication {
         Element command = document.createElement("command");
         String className = this.getClass().getSimpleName();
         String commandText = baseCommand + " "+ packageName + "." + className;
-        Node cDataDescription = document.createCDATASection(commandText);
-        command.appendChild(cDataDescription);
-        root.appendChild(command);
 
         Element inputElements = document.createElement("inputs");
         List<HashMap<String, String>> inputOptions = getInputOptions();
-        inputOptions.forEach(o -> {
+        for(HashMap<String, String> o : inputOptions) {
 
             Element param = getParamFromOption(document, o);
             inputElements.appendChild(param);
 
+            if(o.get("type").equals("optional")) {
+                commandText += "#if str($"+o.get("argument").substring(1)+"):\n";
+            }
+
+            commandText += " "+o.get("argument")+" "+"$"+o.get("name");
+
+            if(o.get("type").equals("optional")) {
+                commandText += "end if\n";
+            }
+
             if (o.get("type").startsWith("input")) {
                 param.setAttribute("type", "data");
+                param.setAttribute("format", "format");
             } else {
                 param.setAttribute("type", o.get("type"));
             }
 
-        });
+        }
 
         root.appendChild(inputElements);
 
@@ -276,13 +284,12 @@ public abstract class AbstractMet4jApplication {
             Element param = getParamFromOption(document, o);
             outputElements.appendChild(param);
 
-            if (o.get("type").startsWith("output")) {
-                param.setAttribute("type", "data");
-            } else {
-                param.setAttribute("type", o.get("type"));
-            }
         });
 
+        Node cDataDescription = document.createCDATASection(commandText);
+        command.appendChild(cDataDescription);
+        root.appendChild(command);
+
         root.appendChild(outputElements);
 
         document.appendChild(root);
@@ -298,21 +305,30 @@ public abstract class AbstractMet4jApplication {
     }
 
     private Element getParamFromOption(Document document, HashMap<String, String> o) {
-        Element param = document.createElement("param");
-        param.setAttribute("name", o.get("name"));
-        param.setAttribute("label", o.get("label"));
-        param.setAttribute("optional", o.get("optional"));
-        param.setAttribute("argument", o.get("argument"));
+
+        Element param;
+        if(o.get("type").equals("outputfile")) {
+            param = document.createElement("data");
+            param.setAttribute("name", o.get("name"));
+            param.setAttribute("format", o.get("format"));
+        }
+        else {
+            param = document.createElement("param");
+            param.setAttribute("name", o.get("name"));
+            param.setAttribute("label", o.get("label"));
+            param.setAttribute("optional", o.get("optional"));
+            param.setAttribute("argument", o.get("argument"));
+        }
         return param;
     }
 
 
     private List<HashMap<String, String>> getInputOptions() {
-        return this.options.stream().filter(o -> !o.containsKey("paramType") || !o.get("paramType").equals("output")).collect(Collectors.toList());
+        return this.options.stream().filter(o -> !o.containsKey("type") || !o.get("type").equals("outputfile")).collect(Collectors.toList());
     }
 
     private List<HashMap<String, String>> getOutputOptions() {
-        return this.options.stream().filter(o -> !o.containsKey("paramType") || o.get("paramType").equals("output")).collect(Collectors.toList());
+        return this.options.stream().filter(o -> !o.containsKey("type") || o.get("type").equals("outputfile")).collect(Collectors.toList());
     }
 
     private String getVersion() throws IOException, XmlPullParserException {
-- 
GitLab


From 00d4ca8942bf1db957235ef41e74cfa18175546c Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 22 Apr 2022 16:49:22 +0200
Subject: [PATCH 15/83] Add parameter decorators

---
 .../met4j_toolbox/attributes/ExtractPathways.java         | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractPathways.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractPathways.java
index fdac95895..a15279db5 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractPathways.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractPathways.java
@@ -7,15 +7,23 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderExcepti
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.JsbmlWriter;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.writer.Met4jSbmlWriterException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
 
 public class ExtractPathways extends AbstractMet4jApplication {
 
+    @Format(name= EnumFormats.Sbml)
+    @ParameterType(name= EnumParameterTypes.InputFile)
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
+    @Format(name= EnumFormats.Sbml)
+    @ParameterType(name= EnumParameterTypes.OutputFile)
     @Option(name = "-o", usage = "output SBML file", required = true)
     public String outputPath = null;
 
-- 
GitLab


From dbf4353c8a24ce1f9207a8c353c99fab3e404a4f Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 22 Apr 2022 16:50:53 +0200
Subject: [PATCH 16/83] Add parameter decorators

---
 .../met4j_toolbox/attributes/ExtractSbmlAnnot.java        | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java
index 34a659f17..34a214ed6 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java
@@ -7,6 +7,10 @@ import fr.inrae.toulouse.metexplore.met4j_core.biodata.collection.BioCollection;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.JsbmlReader;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.Met4jSbmlReaderException;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 import java.io.FileWriter;
@@ -15,9 +19,13 @@ import java.util.*;
 
 public class ExtractSbmlAnnot extends AbstractMet4jApplication {
 
+    @Format(name= EnumFormats.Sbml)
+    @ParameterType(name= EnumParameterTypes.InputFile)
     @Option(name = "-i", usage = "input SBML file", required = true)
     public String inputPath = null;
 
+    @Format(name= EnumFormats.Tsv)
+    @ParameterType(name= EnumParameterTypes.OutputFile)
     @Option(name = "-o", usage = "output file path", required = true)
     public String outputPath = null;
 
-- 
GitLab


From 474c99b9341f0b53a64579aa80be8940e74fa8dc Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 22 Apr 2022 16:59:32 +0200
Subject: [PATCH 17/83] Add parameter decorators and add default value for enum

---
 .../networkAnalysis/CompoundNet.java            | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java
index c09ef4d57..519a667c2 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java
@@ -21,6 +21,10 @@ import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.plugin.NotesParser;
 import fr.inrae.toulouse.metexplore.met4j_io.jsbml.reader.plugin.PackageParser;
 import fr.inrae.toulouse.metexplore.met4j_mathUtils.matrix.ExportMatrix;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumFormats;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.EnumParameterTypes;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Format;
+import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.ParameterType;
 import org.kohsuke.args4j.Option;
 
 import java.io.IOException;
@@ -31,19 +35,23 @@ import java.util.function.Function;
 
 public class CompoundNet extends AbstractMet4jApplication {
 
+    @Format(name= EnumFormats.Sbml)
+    @ParameterType(name= EnumParameterTypes.InputFile)
     @Option(name = "-s", usage = "input SBML file", required = true)
     public String inputPath = null;
 
+    @ParameterType(name= EnumParameterTypes.InputFile)
     @Option(name = "-sc", usage = "input Side compound file", required = false)
     public String inputSide = null;
 
+    @ParameterType(name= EnumParameterTypes.OutputFile)
     @Option(name = "-o", usage = "output Graph file", required = true)
     public String outputPath = null;
 
-    enum strategy {by_name,by_id}
+    enum strategy {no, by_name,by_id}
     @Option(name = "-mc", aliases = {"--mergecomp"}, usage = "merge compartments. " +
             "Use names if consistent and unambiguous across compartments, or identifiers if compartment suffix is present (id in form \"xxx_y\" with xxx as base identifier and y as compartment label).")
-    public strategy mergingStrat = null;
+    public strategy mergingStrat = strategy.no;
     public String idRegex = "^(\\w+)_\\w$";
 
     @Option(name = "-me", aliases = {"--simple"}, usage = "merge parallel edges to produce a simple graph", required = false)
@@ -54,6 +62,9 @@ public class CompoundNet extends AbstractMet4jApplication {
 
     @Option(name = "-dw", aliases = {"--degreeWeights"}, usage = "penalize traversal of hubs by using degree square weighting", forbids = {"-cw", "-sw"})
     public Boolean degree = false;
+
+    @ParameterType(name=EnumParameterTypes.InputFile)
+    @Format(name=EnumFormats.Tsv)
     @Option(name = "-cw", aliases = {"--customWeights"}, usage = "an optional file containing weights for compound pairs", forbids = {"-dw", "-sw"})
     public String weightFile = null;
 
@@ -120,7 +131,7 @@ public class CompoundNet extends AbstractMet4jApplication {
        }
 
         //merge compartment
-        if(mergingStrat!=null){
+        if(mergingStrat!=strategy.no){
             System.out.print("Merging compartments...");
             VertexContraction vc = new VertexContraction();
             VertexContraction.Mapper merger = mergingStrat.equals(strategy.by_name) ? new VertexContraction.MapByName() : new VertexContraction.MapByIdSubString(idRegex);
-- 
GitLab


From 8d5e1b60dfc6a96fc7432da13001a1165a69e0b1 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 22 Apr 2022 17:01:29 +0200
Subject: [PATCH 18/83] Add default value for enum

---
 .../metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java
index 34a214ed6..af1f01fa7 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/ExtractSbmlAnnot.java
@@ -32,7 +32,7 @@ public class ExtractSbmlAnnot extends AbstractMet4jApplication {
     enum entity { METABOLITE,REACTION,GENE}
 
     @Option(name="-export", usage = "the type of entity to extract annotation, either metabolite, reaction, or gene", required = true)
-    public entity export;
+    public entity export = entity.METABOLITE;
 
     @Option(name="-db", usage = "name of the referenced database to export annotations from, as listed in notes or identifiers.org base uri", required = true)
     public String db;
-- 
GitLab


From f9e6f4a8e20267d7c52212be8f62b000832f79aa Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 22 Apr 2022 17:23:15 +0200
Subject: [PATCH 19/83] sort apps by package and name

---
 .../met4j_toolbox/GenerateGalaxyFiles.java    | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
index 68b5eb2b5..839e2cf90 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
@@ -53,6 +53,10 @@ import java.io.File;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.net.URL;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 public class GenerateGalaxyFiles extends AbstractMet4jApplication {
 
@@ -104,12 +108,12 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
 
             File rep = new File(this.outputDirectory);
 
-            if(rep.exists() && ! rep.isDirectory()) {
-                System.err.println(this.outputDirectory+" already exists and it's a file not a directory...");
+            if (rep.exists() && !rep.isDirectory()) {
+                System.err.println(this.outputDirectory + " already exists and it's a file not a directory...");
                 System.exit(1);
             }
 
-            if(!rep.exists()) {
+            if (!rep.exists()) {
                 if (!rep.mkdir()) {
                     System.err.println("Impossible to create the directory " + this.outputDirectory);
                     System.exit(1);
@@ -121,7 +125,9 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
 
             int n = 0;
 
-            for (URL u : Resources.getResourceURLs(Resources.class, filter)) {
+            List<URL> sortedUrls = Resources.getResourceURLs(Resources.class, filter).stream().sorted(Comparator.comparing(URL::getPath)).collect(Collectors.toList());
+
+            for (URL u : sortedUrls){
 
                 String entry = u.getFile();
                 int idx = entry.indexOf(path);
@@ -139,7 +145,7 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
                     try {
                         Object obj = ctor.newInstance();
 
-                        Class methodArgs[] =  new Class[2];
+                        Class methodArgs[] = new Class[2];
                         methodArgs[0] = String.class;
                         methodArgs[1] = String.class;
 
@@ -153,7 +159,7 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
                         Method getPackageName = obj.getClass().getMethod("getSimplePackageName");
                         String packageName = (String) getPackageName.invoke(obj);
 
-                        tool.setAttribute("file", "met4j/"+packageName+"/"+obj.getClass().getSimpleName()+".xml");
+                        tool.setAttribute("file", "met4j/" + packageName + "/" + obj.getClass().getSimpleName() + ".xml");
 
                         section.appendChild(tool);
 
@@ -170,7 +176,7 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
             transformer.setOutputProperty(OutputKeys.INDENT, "yes");
             transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
             DOMSource domSource = new DOMSource(toolConf);
-            StreamResult streamResult = new StreamResult(new File(outputDirectory+"/tool_conf.xml"));
+            StreamResult streamResult = new StreamResult(new File(outputDirectory + "/tool_conf.xml"));
 
             transformer.transform(domSource, streamResult);
 
@@ -190,7 +196,7 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
 
     @Override
     public String getLongDescription() {
-        return this.getShortDescription()+"\n" +
+        return this.getShortDescription() + "\n" +
                 "Creates a directory for each app with inside the galaxy xml wrapper.";
     }
 
-- 
GitLab


From 22b6985c79e28819f549ef0fc808495ccb9b598e Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 22 Apr 2022 18:28:51 +0200
Subject: [PATCH 20/83] debug parameter annotation

---
 .../met4j_toolbox/attributes/SbmlToMetaboliteTable.java         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
index 184bf7b56..591e9787f 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
@@ -64,7 +64,7 @@ public class SbmlToMetaboliteTable extends AbstractMet4jApplication {
     @Option(name = "-s", usage = "Sbml file", required = true)
     public String sbml;
 
-    @ParameterType(name= EnumParameterTypes.InputFile)
+    @ParameterType(name= EnumParameterTypes.OutputFile)
     @Format(name= EnumFormats.Tsv)
     @Option(name = "-o", usage = "Output file", required=true)
     public String outputFile;
-- 
GitLab


From 20ee8acc03109f13cecda6efa47719d0dfa8fe13 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 26 Apr 2022 10:51:43 +0200
Subject: [PATCH 21/83] wrapper calls dockerhub met4j image

---
 .../generic/AbstractMet4jApplication.java     | 33 +++++++++++--------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index 40f49755a..bb79e1a79 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -244,25 +244,33 @@ public abstract class AbstractMet4jApplication {
         description.setTextContent(this.getShortDescription());
         root.appendChild(description);
 
+        Element requirements = document.createElement("requirements");
+        root.appendChild(requirements);
+        Element container = document.createElement("container");
+        container.setAttribute("type", "docker");
+        container.setTextContent("metexplore/met4j:latest");
+        requirements.appendChild(container);
+
         Element command = document.createElement("command");
+        command.setAttribute("detect_errors", "exit_code");
         String className = this.getClass().getSimpleName();
-        String commandText = baseCommand + " "+ packageName + "." + className;
+        String commandText = "sh /usr/bin/met4j.sh " + packageName + "." + className;
 
         Element inputElements = document.createElement("inputs");
         List<HashMap<String, String>> inputOptions = getInputOptions();
-        for(HashMap<String, String> o : inputOptions) {
+        for (HashMap<String, String> o : inputOptions) {
 
             Element param = getParamFromOption(document, o);
             inputElements.appendChild(param);
 
-            if(o.get("type").equals("optional")) {
-                commandText += "#if str($"+o.get("argument").substring(1)+"):\n";
+            if (o.get("optional").equals("true")) {
+                commandText += "#if str($" + o.get("argument").substring(1) + "):\n";
             }
 
-            commandText += " "+o.get("argument")+" "+"$"+o.get("name");
+            commandText += " " + o.get("argument") + " " + "$" + o.get("name") + "\n";
 
-            if(o.get("type").equals("optional")) {
-                commandText += "end if\n";
+            if (o.get("optional").equals("true")) {
+                commandText += "#end if\n";
             }
 
             if (o.get("type").startsWith("input")) {
@@ -279,12 +287,12 @@ public abstract class AbstractMet4jApplication {
         Element outputElements = document.createElement("outputs");
         List<HashMap<String, String>> outputOptions = getOutputOptions();
 
-        outputOptions.forEach(o -> {
+        for (HashMap<String, String> o : outputOptions) {
 
             Element param = getParamFromOption(document, o);
             outputElements.appendChild(param);
-
-        });
+            commandText += " " + o.get("argument") + " " + "$" + o.get("name") + "\n";
+        }
 
         Node cDataDescription = document.createCDATASection(commandText);
         command.appendChild(cDataDescription);
@@ -307,12 +315,11 @@ public abstract class AbstractMet4jApplication {
     private Element getParamFromOption(Document document, HashMap<String, String> o) {
 
         Element param;
-        if(o.get("type").equals("outputfile")) {
+        if (o.get("type").equals("outputfile")) {
             param = document.createElement("data");
             param.setAttribute("name", o.get("name"));
             param.setAttribute("format", o.get("format"));
-        }
-        else {
+        } else {
             param = document.createElement("param");
             param.setAttribute("name", o.get("name"));
             param.setAttribute("label", o.get("label"));
-- 
GitLab


From d4a8059ce9f334f5fb0f0d8c6783a0590e5916af Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 26 Apr 2022 11:04:43 +0200
Subject: [PATCH 22/83] remove the entrypoint

---
 Dockerfile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Dockerfile b/Dockerfile
index 50f8cf1aa..fe097dfea 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -24,5 +24,7 @@ RUN mkdir -p /opt/bin \
 
 COPY ./docker_files/met4j.sh /opt/bin
 
-ENTRYPOINT ["/opt/bin/met4j.sh"]
+RUN chmod a+x /opt/bin/met4j.sh
+
+RUN cd /usr/bin && ln -s /opt/bin/met4j.sh
 
-- 
GitLab


From ff45ce3a98a72b577abf03550028cd58b20f3adb Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 26 Apr 2022 11:05:14 +0200
Subject: [PATCH 23/83] typo

---
 docker_files/met4j.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docker_files/met4j.sh b/docker_files/met4j.sh
index 23a5411e0..6369824ab 100644
--- a/docker_files/met4j.sh
+++ b/docker_files/met4j.sh
@@ -44,6 +44,6 @@ if [ $# -lt 1 ]
         echo "display Help"
         exec java -jar $path_jar
     else
-        echo "Lauch met4j-toolbox"
+        echo "Launch met4j-toolbox"
 	      exec java -Dlog4j.configuration= -cp $path_jar fr.inrae.toulouse.metexplore.met4j_toolbox."$@"
 fi
\ No newline at end of file
-- 
GitLab


From 3cffd28f23e3540d7d5a3b47b3ff63b8bb8280d9 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 26 Apr 2022 16:28:46 +0200
Subject: [PATCH 24/83] debug wrapper generation

---
 .../generic/AbstractMet4jApplication.java     | 37 ++++++++++++++++---
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index bb79e1a79..2571a320b 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -236,7 +236,7 @@ public abstract class AbstractMet4jApplication {
         Document document = documentBuilder.newDocument();
 
         Element root = document.createElement("tool");
-        root.setAttribute("id", this.getLabel());
+        root.setAttribute("id", "met4j_"+this.getLabel());
         root.setAttribute("name", this.getLabel());
         root.setAttribute("version", this.getVersion());
 
@@ -244,6 +244,13 @@ public abstract class AbstractMet4jApplication {
         description.setTextContent(this.getShortDescription());
         root.appendChild(description);
 
+        Element xrefs = document.createElement("xrefs");
+        Element xref = document.createElement("xref");
+        xref.setAttribute("type", "bio.tools");
+        xref.setTextContent("met4j");
+        xrefs.appendChild(xref);
+        root.appendChild(xrefs);
+
         Element requirements = document.createElement("requirements");
         root.appendChild(requirements);
         Element container = document.createElement("container");
@@ -280,9 +287,23 @@ public abstract class AbstractMet4jApplication {
                 param.setAttribute("type", o.get("type"));
             }
 
+            if(o.get("type").equals("select")) {
+                String choices = o.get("choices");
+                String[] tabChoices = choices.split(",");
+                for(int i=0; i<tabChoices.length;i++) {
+                    String choice = tabChoices[i];
+                    Element option = document.createElement("option");
+                    option.setAttribute("value", choice);
+                    if(choice.equals(o.get("default"))) {
+                        option.setAttribute("selected", "true");
+                    }
+                    option.setTextContent(choice);
+                    param.appendChild(option);
+                }
+            }
+
         }
 
-        root.appendChild(inputElements);
 
         Element outputElements = document.createElement("outputs");
         List<HashMap<String, String>> outputOptions = getOutputOptions();
@@ -296,10 +317,16 @@ public abstract class AbstractMet4jApplication {
 
         Node cDataDescription = document.createCDATASection(commandText);
         command.appendChild(cDataDescription);
-        root.appendChild(command);
 
+        root.appendChild(command);
+        root.appendChild(inputElements);
         root.appendChild(outputElements);
 
+        Element help = document.createElement("help");
+        Node cHelp = document.createCDATASection(this.getLongDescription());
+        help.appendChild(cHelp);
+        root.appendChild(help);
+
         document.appendChild(root);
 
         TransformerFactory transformerFactory = TransformerFactory.newInstance();
@@ -338,7 +365,7 @@ public abstract class AbstractMet4jApplication {
         return this.options.stream().filter(o -> !o.containsKey("type") || o.get("type").equals("outputfile")).collect(Collectors.toList());
     }
 
-    private String getVersion() throws IOException, XmlPullParserException {
+    public static String getVersion() throws IOException, XmlPullParserException {
         MavenXpp3Reader reader = new MavenXpp3Reader();
         Model model;
         if ((new File("pom.xml")).exists())
@@ -352,7 +379,7 @@ public abstract class AbstractMet4jApplication {
                     )
             );
 
-        return model.getVersion();
+        return model.getVersion().replace("-SNAPSHOT","");
     }
 
     /**
-- 
GitLab


From 447ca32b8b6103f1a8f691529c995920f9ce710d Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 26 Apr 2022 16:29:41 +0200
Subject: [PATCH 25/83] add package label

But looks unused...
---
 .../metexplore/met4j_toolbox/GenerateGalaxyFiles.java | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
index 839e2cf90..4210c8cb0 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
@@ -127,6 +127,8 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
 
             List<URL> sortedUrls = Resources.getResourceURLs(Resources.class, filter).stream().sorted(Comparator.comparing(URL::getPath)).collect(Collectors.toList());
 
+            String toolPackage = "";
+
             for (URL u : sortedUrls){
 
                 String entry = u.getFile();
@@ -159,6 +161,15 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
                         Method getPackageName = obj.getClass().getMethod("getSimplePackageName");
                         String packageName = (String) getPackageName.invoke(obj);
 
+                        if(! packageName.equals(toolPackage)) {
+                            Element label = toolConf.createElement("label");
+                            label.setAttribute("id", packageName);
+                            label.setAttribute("text", "met4j "+packageName);
+                            label.setAttribute("version", "");
+                            section.appendChild(label);
+                            toolPackage = packageName;
+                        }
+
                         tool.setAttribute("file", "met4j/" + packageName + "/" + obj.getClass().getSimpleName() + ".xml");
 
                         section.appendChild(tool);
-- 
GitLab


From 4009d85f442ff26123528f3885f250300822c9c6 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 28 Apr 2022 13:07:19 +0200
Subject: [PATCH 26/83] Update docs

---
 README.md               | 38 +++++---------------
 met4j-toolbox/README.md | 77 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 82 insertions(+), 33 deletions(-)

diff --git a/README.md b/README.md
index 743e1f957..d6b0a92b4 100644
--- a/README.md
+++ b/README.md
@@ -10,17 +10,14 @@
 **Met4J is an open-source Java library dedicated to the structural analysis of metabolic networks. It also came with a toolbox gathering CLI for several analyses relevant to metabolism-related research.**
 
 
-Met4j is composed by several modules:
+Met4j is composed by three main modules:
 - [met4j-core](met4j-core/README.md): it's the key module which contains all the core 
 classes for handling metabolic networks
 - [met4j-io](met4j-io/README.md): for importing/exporting metabolic networks in several 
 formats (SBML, MetExploreXml, KEGG)
 - [met4j-graph](met4j-graph/README.md): for performing graph-based topological analysis of metabolic networks.  
 
-The other modules contains utilities to serve the main modules listed here.  
-
-The full list of implemented metabolic network analysis can be found in the [met4j-toolbox](met4j-toolbox/README.md) 
-
+The package [met4j-toolbox](met4j-toolbox/README.md) contains high-level apps that can be run in command line by using either jar file or Singularity or Docker containers.
 
 
 ## Installation
@@ -52,41 +49,22 @@ git clone https://forgemia.inra.fr/metexplore/met4j.git;
 cd met4j;
 mvn clean install 
 ```
-to build the executable toolbox jar:
-```
-cd met4j-toolbox
-mvn clean compile assembly:single
-mv ./target/*-jar-with-dependencies.jar ../../../
-```
 
 ## Usage
 
 Documentation for the library modules can be found in each module's own README.  
-Detailed code examples can be found at [here](https://forgemia.inra.fr/metexplore/tutorialmet4j).  
-
-The toolbox can be launched using
-```
-java -jar met4j-toolbox-0.8.0-jar-with-dependencies.jar
-```
-which will list all the contained applications that can be called using
-
-```
-java -cp met4j-toolbox-0.8.0-jar-with-dependencies.jar <App full name> -h
-```
-
-### With singularity
-
-You need at least [singularity](https://sylabs.io/guides/3.5/user-guide/quick_start.html) v3.5.
-
-```console
-singularity pull met4j-toolbox.sif oras://registry.forgemia.inra.fr/metexplore/met4j/met4j-singularity:latest
-```
+Detailed code examples can be found at [here](https://forgemia.inra.fr/metexplore/tutorialmet4j).
 
 ## Contributing
+
 Pull requests are welcome **on the gitlab repo** ([https://forgemia.inra.fr/metexplore/met4j](https://forgemia.inra.fr/metexplore/met4j)). For major changes, please open an issue first to discuss what you would like to change.  
 
 Please make sure to update tests as appropriate.  
 
+## Issues
+
+Issues or suggestions can be posted [here](https://forgemia.inra.fr/metexplore/met4j/-/issues).
+
 ## License
 Met4J is distributed under the open license [CeCILL-2.1](https://cecill.info/licences/Licence_CeCILL_V2.1-en.html) (compatible GNU-GPL).  
 
diff --git a/met4j-toolbox/README.md b/met4j-toolbox/README.md
index 4d51cca3d..f99b20adc 100644
--- a/met4j-toolbox/README.md
+++ b/met4j-toolbox/README.md
@@ -1,8 +1,13 @@
 # met4j-toolbox
 **Met4j command-line toolbox for metabolic networks**
 
-## Installation
+## Installation from source
+
 ```
+git clone https://forgemia.inra.fr/metexplore/met4j.git;
+cd met4j;
+mvn clean install 
+
 cd met4j-toolbox
 mvn clean package
 ```
@@ -10,14 +15,80 @@ mvn clean package
 ## Usage
 The toolbox can be launched using
 ```
-java -jar met4j-toolbox-<version>.jar
+java -jar target/met4j-toolbox-<version>.jar
 ```
 which will list all the contained applications that can be called using
 
 ```
-java -cp met4j-toolbox-<version>.jar <Package>.<App name> -h
+java -cp target/met4j-toolbox-<version>.jar <Package>.<App name> -h
+```
+
+
+## From singularity
+
+You need at least [singularity](https://sylabs.io/guides/3.5/user-guide/quick_start.html) v3.5.
+
+```console
+singularity pull met4j-toolbox.sif oras://registry.forgemia.inra.fr/metexplore/met4j/met4j-singularity:latest
+```
+
+This will download a singularity container met4j-toolbox.sif that you can directly launch.
+
+To list all the apps.
+```console
+met4j-toolbox.sif 
+```
+
+To launch a specific app, prefix its name with the last component of its package name. For instance:
+
+```console
+met4j-toolbox.sif convert.Tab2Sbml -h -in fic.tsv -sbml fic.sbml
+```
+
+By default, singularity does not see the directories that are not descendants of your home directory. To get the directories outside your home directory, you have to specify the SINGULARITY_BIND environment variable.
+At least, to get the data in the default reference directory, you have to specify:
+In bash:
+```console
+export SINGULARITY_BIND=/db
+```
+In csh or in tcsh
+```console
+setenv SINGULARITY_BIND /db
+```
+
+## From docker
+
+First install [Docker](https://www.docker.com/).
+
+Pull the latest met4j image:
+
+```console
+sudo docker pull metexplore/met4j:latest
+```
+
+To list all the apps:
+```console
+sudo docker run metexplore/met4j:latest met4j.sh
 ```
 
+Don't forget to map volumes when you want to process local files.
+Example:
+
+```console
+sudo docker run -v /home/lcottret/work:/work \
+ metexplore/met4j:latest met4j.sh convert.Sbml2Tab \
+ -in /work/toy_model.xml -out /work/toy_model.tsv
+```
+
+If you change the working directory, you have to specify "sh /usr/bin/met4j.sh":
+
+```console
+sudo docker run -w /work -v /home/lcottret/work:/work \
+ metexplore/met4j:latest sh /usr/bin/met4j.sh convert.Sbml2Tab \
+ -in toy_model.xml -out toy_model.tsv
+```
+
+
 ## Features
 <table>
 <thead><tr><th colspan="2">Package fr.inrae.toulouse.metexplore.met4j_toolbox.attributes</th></tr></thead>
-- 
GitLab


From 6a29e2007928b58963308ce0f6587f906639e844 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 5 May 2022 09:28:06 +0200
Subject: [PATCH 27/83] Add .sif in .gitignore

---
 .gitignore | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 5d04b3568..c121512a9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,4 +18,5 @@ met4j-core/src/main/java/fr/inra/toulouse/metexplore/met4j_core/Test\.java
 /met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/sandbox/
 
 
-dependency-reduced-pom.xml
\ No newline at end of file
+dependency-reduced-pom.xml
+*.sif
-- 
GitLab


From b7a3c130ca653251dccdff7e5bc65dcae563f9d1 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 5 May 2022 09:41:48 +0200
Subject: [PATCH 28/83] Copy met4j.sh in singularity container

---
 met4j.singularity | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/met4j.singularity b/met4j.singularity
index 109a877b2..cf52b19ae 100644
--- a/met4j.singularity
+++ b/met4j.singularity
@@ -5,10 +5,10 @@ From: debian:stable-slim
     if [ $# -lt 1 ] 
     then
         echo "display Help"
-        exec java -jar /opt/bin/met4j.jar
+        exec sh /opt/bin/met4j.sh
     else
         echo "Lauch met4j-toolbox"
-	    exec java -Dlog4j.configuration= -cp /opt/bin/met4j.jar fr.inrae.toulouse.metexplore.met4j_toolbox."$@"
+	    exec sh /opt/bin/met4j.sh "$@"
     fi
 
 %help
@@ -59,5 +59,10 @@ This is singularity container for met4j
 
     apt-get autoremove -y
 
+    cd /usr/bin && ln -s /opt/bin/met4j.sh
+
 %environment
     export LC_ALL=C
+
+%files
+    ./docker_files/met4j.sh /opt/bin/met4j.sh
-- 
GitLab


From fd46ece28ecad926f022186fae1fc5bab3c82a12 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 10:04:26 +0200
Subject: [PATCH 29/83] Improve galaxy wrapper

Two modes : Docker and Singularity
One directory per app
---
 .../generic/AbstractMet4jApplication.java     | 55 +++++++++++++++----
 1 file changed, 44 insertions(+), 11 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index 2571a320b..8ab337905 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -217,14 +217,19 @@ public abstract class AbstractMet4jApplication {
         return simplePackageName;
     }
 
-    public void xmlGalaxyWrapper(String outputDirectory, String baseCommand) throws ParserConfigurationException, XmlPullParserException, IOException, IllegalAccessException, TransformerException {
+
+
+
+    public void xmlGalaxyWrapper(String outputDirectory, GalaxyPackageType packageType) throws ParserConfigurationException, XmlPullParserException, IOException, IllegalAccessException, TransformerException {
 
         String packageName = this.getSimplePackageName();
 
-        File packageDirectory = new File(outputDirectory + "/" + packageName);
+        String className = this.getClass().getSimpleName();
+
+        File wrapperDirectory = new File(outputDirectory + "/" + packageName+ "/" + className);
 
-        if (!packageDirectory.exists()) {
-            packageDirectory.mkdirs();
+        if (!wrapperDirectory.exists()) {
+            wrapperDirectory.mkdirs();
         }
 
         this.initOptions();
@@ -254,15 +259,30 @@ public abstract class AbstractMet4jApplication {
         Element requirements = document.createElement("requirements");
         root.appendChild(requirements);
         Element container = document.createElement("container");
-        container.setAttribute("type", "docker");
-        container.setTextContent("metexplore/met4j:latest");
+
+        if(packageType.equals(GalaxyPackageType.Docker)) {
+            container.setAttribute("type", "docker");
+            container.setTextContent("metexplore/met4j:latest");
+        }
+        else if(packageType.equals(GalaxyPackageType.Singularity)) {
+            container.setAttribute("type", "singularity");
+            container.setTextContent("oras://registry.forgemia.inra.fr/metexplore/met4j/met4j-singularity:latest");
+        }
         requirements.appendChild(container);
 
         Element command = document.createElement("command");
         command.setAttribute("detect_errors", "exit_code");
-        String className = this.getClass().getSimpleName();
-        String commandText = "sh /usr/bin/met4j.sh " + packageName + "." + className;
 
+        String commandText = "";
+
+        commandText = "sh /usr/bin/met4j.sh " + packageName + "." + className;
+       /* if(packageType.equals(GalaxyPackageType.Docker)) {
+            commandText = "sh /usr/bin/met4j.sh " + packageName + "." + className;
+        }
+        else if(packageType.equals(GalaxyPackageType.Singularity)) {
+
+        }
+*/
         Element inputElements = document.createElement("inputs");
         List<HashMap<String, String>> inputOptions = getInputOptions();
         for (HashMap<String, String> o : inputOptions) {
@@ -274,7 +294,7 @@ public abstract class AbstractMet4jApplication {
                 commandText += "#if str($" + o.get("argument").substring(1) + "):\n";
             }
 
-            commandText += " " + o.get("argument") + " " + "$" + o.get("name") + "\n";
+            commandText += " " + o.get("argument") + " " + "\"$" + o.get("name") + "\"\n";
 
             if (o.get("optional").equals("true")) {
                 commandText += "#end if\n";
@@ -287,6 +307,15 @@ public abstract class AbstractMet4jApplication {
                 param.setAttribute("type", o.get("type"));
             }
 
+            if(o.get("type").equals("text")) {
+                Element sanitizer = document.createElement("sanitizer");
+                sanitizer.setAttribute("invalid_char", "_");
+                Element valid = document.createElement("valid");
+                valid.setAttribute("initial", "string.printable");
+                sanitizer.appendChild(valid);
+                param.appendChild(sanitizer);
+            }
+
             if(o.get("type").equals("select")) {
                 String choices = o.get("choices");
                 String[] tabChoices = choices.split(",");
@@ -312,7 +341,7 @@ public abstract class AbstractMet4jApplication {
 
             Element param = getParamFromOption(document, o);
             outputElements.appendChild(param);
-            commandText += " " + o.get("argument") + " " + "$" + o.get("name") + "\n";
+            commandText += " " + o.get("argument") + " " + "\"$" + o.get("name") + "\"\n";
         }
 
         Node cDataDescription = document.createCDATASection(commandText);
@@ -334,7 +363,7 @@ public abstract class AbstractMet4jApplication {
         transformer.setOutputProperty(OutputKeys.INDENT, "yes");
         transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
         DOMSource domSource = new DOMSource(document);
-        StreamResult streamResult = new StreamResult(new File(packageDirectory.getAbsolutePath() + "/" + className + ".xml"));
+        StreamResult streamResult = new StreamResult(new File(wrapperDirectory.getAbsolutePath() + "/" + className + ".xml"));
 
         transformer.transform(domSource, streamResult);
     }
@@ -464,4 +493,8 @@ public abstract class AbstractMet4jApplication {
         }
     }
 
+    public enum GalaxyPackageType {
+        Docker, Singularity
+    }
+
 }
-- 
GitLab


From 5b5c41c27ea1b6ec2fb3942387df919a05cf6025 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 10:05:07 +0200
Subject: [PATCH 30/83] New class for handling classes

---
 .../met4j_toolbox/utils/ClassUtils.java       | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/utils/ClassUtils.java

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/utils/ClassUtils.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/utils/ClassUtils.java
new file mode 100644
index 000000000..d036e8a0f
--- /dev/null
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/utils/ClassUtils.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright INRAE (2022)
+ *
+ * contact-metexplore@inrae.fr
+ *
+ * This software is a computer program whose purpose is to [describe
+ * functionalities and technical features of your software].
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ */
+package fr.inrae.toulouse.metexplore.met4j_toolbox.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ClassUtils {
+
+    public List<Class<?>> getAllSuperClasses(Class c) {
+        if(c == null)
+        {
+            return null;
+        }
+
+        List<Class<?>> classes = new ArrayList<>();
+        Class<?> superclass = c.getSuperclass();
+
+        while (superclass != null && superclass != Object.class) {
+            classes.add(superclass);
+            superclass = superclass.getSuperclass();
+        }
+
+        return classes;
+
+    }
+
+}
-- 
GitLab


From 3cc17ffdb4cd38a1c8fda959a8fb67d2ae12009e Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 10:05:33 +0200
Subject: [PATCH 31/83] Check superclasses instead of classes

---
 .../met4j_toolbox/GenerateGalaxyFiles.java     | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
index 4210c8cb0..15c4a3a2f 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
@@ -38,6 +38,7 @@ package fr.inrae.toulouse.metexplore.met4j_toolbox;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.ResourceURLFilter;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Resources;
+import org.apache.commons.lang3.ClassUtils;
 import org.kohsuke.args4j.Option;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -64,8 +65,8 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
     @Option(name = "-o", usage = "output directory where the galaxy wrappers and the tool_conf.xml will be written", required = true)
     public String outputDirectory;
 
-    @Option(name = "-c", usage = "full path of the command line to launch met4j ", required = true)
-    public String command;
+    @Option(name = "-p", usage = "Package type", required = false)
+    public GalaxyPackageType packageType = GalaxyPackageType.Singularity;
 
     public static void main(String[] args) {
 
@@ -138,9 +139,10 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
 
                 Class<?> myClass = Class.forName(entry.replace('/', '.'));
 
+                List<Class<?>> allSuperclasses = ClassUtils.getAllSuperclasses(myClass);
+
                 if (myClass != this.getClass()
-                        && myClass.getSuperclass() != null
-                        && myClass.getSuperclass().equals(AbstractMet4jApplication.class)) {
+                        && allSuperclasses.contains(AbstractMet4jApplication.class)) {
 
                     Constructor<?> ctor = myClass.getConstructor();
 
@@ -149,12 +151,12 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
 
                         Class methodArgs[] = new Class[2];
                         methodArgs[0] = String.class;
-                        methodArgs[1] = String.class;
+                        methodArgs[1] = GalaxyPackageType.class;
 
                         System.err.println(obj.getClass().getName());
 
                         Method method = obj.getClass().getMethod("xmlGalaxyWrapper", methodArgs);
-                        method.invoke(obj, this.outputDirectory, this.command);
+                        method.invoke(obj, this.outputDirectory, this.packageType);
 
                         Element tool = toolConf.createElement("tool");
 
@@ -170,7 +172,9 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
                             toolPackage = packageName;
                         }
 
-                        tool.setAttribute("file", "met4j/" + packageName + "/" + obj.getClass().getSimpleName() + ".xml");
+                        String className = obj.getClass().getSimpleName();
+
+                        tool.setAttribute("file", "met4j/" + packageName + "/" + className + "/" + className + ".xml");
 
                         section.appendChild(tool);
 
-- 
GitLab


From e41b8bab20e4206d1708dc31cddc0605250bda85 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 10:05:40 +0200
Subject: [PATCH 32/83] Check superclasses instead of classes

---
 .../toulouse/metexplore/met4j_toolbox/GenerateJson.java     | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateJson.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateJson.java
index 78e0d4a94..6d679244e 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateJson.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateJson.java
@@ -38,10 +38,12 @@ package fr.inrae.toulouse.metexplore.met4j_toolbox;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.generic.AbstractMet4jApplication;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.ResourceURLFilter;
 import fr.inrae.toulouse.metexplore.met4j_toolbox.utils.Resources;
+import org.apache.commons.lang3.ClassUtils;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.net.URL;
+import java.util.List;
 
 public class GenerateJson {
 
@@ -81,7 +83,9 @@ public class GenerateJson {
 
                 Class<?> myClass = Class.forName(entry.replace('/', '.'));
 
-                if (myClass.getSuperclass() != null && myClass.getSuperclass().equals(AbstractMet4jApplication.class)) {
+                List<Class<?>> allSuperclasses = ClassUtils.getAllSuperclasses(myClass);
+
+                if (allSuperclasses.contains(AbstractMet4jApplication.class)) {
 
                     Constructor<?> ctor = myClass.getConstructor();
 
-- 
GitLab


From 29e6f2168f410d2a4fbc08e206b6a5dbcb7372f4 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 10:06:08 +0200
Subject: [PATCH 33/83] set decorators for integer params

---
 .../toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java   | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java
index 5da1181c5..fc54e30c8 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/Tab2Sbml.java
@@ -57,9 +57,11 @@ import java.io.IOException;
  */
 public class Tab2Sbml extends AbstractMet4jApplication {
 
+    @ParameterType(name = EnumParameterTypes.Integer)
     @Option(name = "-ci", usage = "[1] number of the column where are the reaction ids")
     public int colid = 1;
 
+    @ParameterType(name = EnumParameterTypes.Integer)
     @Option(name = "-cf", usage = "[2] number of the column where are the reaction formulas")
     public int colformula = 2;
 
@@ -97,6 +99,8 @@ public class Tab2Sbml extends AbstractMet4jApplication {
     @Option(name = "-dcpt", usage = "[c] Default compartment")
     public String defaultCompartment = "c";
 
+
+    @ParameterType(name = EnumParameterTypes.Integer)
     @Option(name = "-n", usage = "[0] Number of lines to skip at the beginning of the tabulated file")
     public int nSkip = 0;
 
-- 
GitLab


From 4a35a4215e445020e65f66734264d66b6c26a30e Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 10:06:19 +0200
Subject: [PATCH 34/83] private members to public

---
 .../met4j_toolbox/attributes/SbmlSetChargesFromFile.java      | 2 +-
 .../met4j_toolbox/attributes/SbmlSetEcsFromFile.java          | 2 +-
 .../met4j_toolbox/attributes/SbmlSetFormulasFromFile.java     | 2 +-
 .../met4j_toolbox/attributes/SbmlSetGprsFromFile.java         | 2 +-
 .../met4j_toolbox/attributes/SbmlSetNamesFromFile.java        | 2 +-
 .../met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java     | 4 ++--
 .../met4j_toolbox/attributes/SbmlSetRefsFromFile.java         | 4 ++--
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java
index 640ab6965..ded9a4d4f 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java
@@ -52,7 +52,7 @@ public class SbmlSetChargesFromFile extends AbstractSbmlSetMetabolite {
 
     @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cc", usage="[2] number of the column where are the charges")
-    private int colcharge=2;
+    public int colcharge=2;
 
     /** {@inheritDoc} */
     @Override
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java
index ff6bb992a..91445fe12 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java
@@ -52,7 +52,7 @@ public class SbmlSetEcsFromFile extends AbstractSbmlSetReaction {
 
     @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cec", usage="[2] number of the column where are the ecs")
-    private int colec=2;
+    public int colec=2;
 
 
     /** {@inheritDoc} */
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java
index c13d4e14e..c89e9871f 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java
@@ -52,7 +52,7 @@ public class SbmlSetFormulasFromFile extends AbstractSbmlSetMetabolite {
 
     @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cf", usage="[2] number of the column where are the formulas")
-    private int colformula=2;
+    public int colformula=2;
 
     /** {@inheritDoc} */
     @Override
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java
index bea4d49fc..ba657bb8d 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java
@@ -54,7 +54,7 @@ public class SbmlSetGprsFromFile  extends AbstractSbmlSetReaction {
 
     @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cgpr", usage="[2] number of the column where are the gprs")
-    private int colgpr=2;
+    public int colgpr=2;
 
     /** {@inheritDoc} */
     @Override
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java
index cd33a2e23..936a7358e 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java
@@ -53,7 +53,7 @@ public class SbmlSetNamesFromFile extends AbstractSbmlSetAny {
 
     @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cname", usage="[2] number of the column where are the names")
-    private int colname=2;
+    public int colname=2;
 
     /** {@inheritDoc} */
     @Override
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java
index f05d7fce6..c8ef8a1f8 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java
@@ -52,11 +52,11 @@ public class SbmlSetPathwaysFromFile extends AbstractSbmlSetReaction {
 
     @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cp", usage="[2] number of the column where are the pathways")
-    private int colp=2;
+    public int colp=2;
 
     @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-sep", usage="[|] Separator of pathways in the tabulated file")
-    private String sep = "|";
+    public String sep = "|";
 
 
     /** {@inheritDoc} */
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java
index aea95a02c..6c7b88321 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java
@@ -53,11 +53,11 @@ public class SbmlSetRefsFromFile extends AbstractSbmlSetAny {
 
     @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-cr", usage="[2] number of the column where are the references")
-    private int colRef=2;
+    public int colRef=2;
 
     @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-ref", usage="Name of the ref. Must exist in identifiers.org", required = true)
-    private String ref=null;
+    public String ref=null;
 
     /** {@inheritDoc} */
     @Override
-- 
GitLab


From 15781b58d217d0c376a56ed93e6b19fa4ff41031 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 10:47:41 +0200
Subject: [PATCH 35/83] singularity Starts from jar built locally

---
 met4j.singularity | 38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/met4j.singularity b/met4j.singularity
index cf52b19ae..190e39821 100644
--- a/met4j.singularity
+++ b/met4j.singularity
@@ -4,10 +4,8 @@ From: debian:stable-slim
 %runscript
     if [ $# -lt 1 ] 
     then
-        echo "display Help"
         exec sh /opt/bin/met4j.sh
     else
-        echo "Lauch met4j-toolbox"
 	    exec sh /opt/bin/met4j.sh "$@"
     fi
 
@@ -17,7 +15,10 @@ Usage: met4j.sif
 
 This is singularity container for met4j
 
+First launch :
 
+cd met4j-toolbox
+mvn package
 
 %labels
     Maintainer Ludovic.Cottret@inrae.fr
@@ -27,37 +28,9 @@ This is singularity container for met4j
 	apt-get update && \
     apt-get upgrade -y && \
     apt-get install -y \
-        openjdk-11-jre   \
-        git \
-        maven
+        openjdk-11-jre
     apt-get clean && \
-    apt-get purge 
-
-	mkdir -p /opt
-
-    cd /opt
-
-    git clone https://forgemia.inra.fr/metexplore/met4j.git
-
-    cd met4j/
-    
-    mvn install
-
-    cd met4j-toolbox
-
-    mvn package
-
-    mkdir -p /opt/bin
-
-    cp target/met4j*.jar /opt/bin/met4j.jar
-
-    cd /opt 
-
-    rm -rf met4j ~/.m2
-
-    apt-get remove -y maven git
-
-    apt-get autoremove -y
+    apt-get purge
 
     cd /usr/bin && ln -s /opt/bin/met4j.sh
 
@@ -66,3 +39,4 @@ This is singularity container for met4j
 
 %files
     ./docker_files/met4j.sh /opt/bin/met4j.sh
+    ./met4j-toolbox/target/met4j*.jar /opt/bin/met4j.jar
-- 
GitLab


From 8ae86316204fff837ef1177cabf1fb614850bf6c Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 10:47:58 +0200
Subject: [PATCH 36/83] Launch mvn package before singularity

---
 .gitlab-ci.yml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 01f27c9b3..a893ef6df 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -69,9 +69,13 @@ buildSingularity:
   image:
     name: quay.io/singularity/singularity:v3.4.0
     entrypoint: [ "" ]
+  before_script:
+    - cd met4j-toolbox
+    - mvn package
+    - cd ../
   script:
     - singularity build met4j-toolbox.sif met4j.singularity
-    - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$CI_COMMIT_TAG"
+    - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$CI_COMMIT_BRANCH"
   rules:
     - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
       when: always
-- 
GitLab


From a6bf875a56cf64ad6cd6b54521e2b5289379d98a Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 10:52:51 +0200
Subject: [PATCH 37/83] debug ci

---
 .gitlab-ci.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a893ef6df..43799117d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -70,6 +70,8 @@ buildSingularity:
     name: quay.io/singularity/singularity:v3.4.0
     entrypoint: [ "" ]
   before_script:
+    - apk add maven
+    - apk add openjdk11
     - cd met4j-toolbox
     - mvn package
     - cd ../
-- 
GitLab


From ba3a1e393cf1b1ecddbef6b31b71cbbc6034d4dd Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 11:01:36 +0200
Subject: [PATCH 38/83] debug ci

---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 43799117d..534ba5394 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -72,6 +72,7 @@ buildSingularity:
   before_script:
     - apk add maven
     - apk add openjdk11
+    - mvn clean install
     - cd met4j-toolbox
     - mvn package
     - cd ../
-- 
GitLab


From fedb2b773b2f8abe21a17076798013b950c2c5fb Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 11:17:31 +0200
Subject: [PATCH 39/83] use artifacts for .class and .jar

---
 .gitlab-ci.yml | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 534ba5394..943080918 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -25,11 +25,21 @@ build:
   stage: build
   script:
     - mvn compile
+    - mvn install
+    - cd met4j-toolbox
+    - mvn package
+    - cd ..
+  artifacts:
+    expire_in: 60 min
+    paths:
+      - target/
+      - "*/target"
 
 test:
   image: maven:3.6-adoptopenjdk-14
   stage: test
   script:
+    - find . -name "*.class" -exec touch {} \+
     - mvn clean test
     - cat coverage/target/site/jacoco-aggregate/index.html | grep -o '<tfoot>.*</tfoot>'
 
@@ -69,13 +79,6 @@ buildSingularity:
   image:
     name: quay.io/singularity/singularity:v3.4.0
     entrypoint: [ "" ]
-  before_script:
-    - apk add maven
-    - apk add openjdk11
-    - mvn clean install
-    - cd met4j-toolbox
-    - mvn package
-    - cd ../
   script:
     - singularity build met4j-toolbox.sif met4j.singularity
     - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$CI_COMMIT_BRANCH"
-- 
GitLab


From 3ad74972ec529815c4ffb6b24e23c15a68379c26 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 11:27:17 +0200
Subject: [PATCH 40/83] debug ci

---
 .gitlab-ci.yml | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 943080918..fd626c400 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,6 +3,7 @@
 stages:
   - build
   - test
+  - package
   - deploy
   - build-containers
 
@@ -24,11 +25,7 @@ build:
   image: maven:3.6-adoptopenjdk-14
   stage: build
   script:
-    - mvn compile
-    - mvn install
-    - cd met4j-toolbox
-    - mvn package
-    - cd ..
+    - mvn $MAVEN_OPTS compile
   artifacts:
     expire_in: 60 min
     paths:
@@ -43,6 +40,19 @@ test:
     - mvn clean test
     - cat coverage/target/site/jacoco-aggregate/index.html | grep -o '<tfoot>.*</tfoot>'
 
+package:
+  image: maven:3.6-adoptopenjdk-14
+  stage: package
+  script:
+    - mvn $MAVEN_OPTS clean install
+    - cd met4j-toolbox
+    - mvn package
+    - cd ..
+  artifacts:
+    expire_in: 60 min
+    paths:
+      - "met4j-toolbox/target"
+
 deploySnapshot:
   image: maven:3.6-adoptopenjdk-14
   stage: deploy
-- 
GitLab


From ce91df2d495269fe5bfe73889af56b1ff2d6f1de Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 11:33:03 +0200
Subject: [PATCH 41/83] debug ci

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fd626c400..42a748a1e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -46,7 +46,7 @@ package:
   script:
     - mvn $MAVEN_OPTS clean install
     - cd met4j-toolbox
-    - mvn package
+    - mvn $MAVEN_OPTS package
     - cd ..
   artifacts:
     expire_in: 60 min
-- 
GitLab


From 5de6d0a193566e12e60a9e9c8f274ecb5bdfa0cf Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 11:51:26 +0200
Subject: [PATCH 42/83] debug ci

---
 .gitlab-ci.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 42a748a1e..996a23138 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,7 +15,7 @@ stages:
 
 variables:
   MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
-  MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
+  MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
 
 cache:
   paths:
@@ -44,9 +44,9 @@ package:
   image: maven:3.6-adoptopenjdk-14
   stage: package
   script:
-    - mvn $MAVEN_OPTS clean install
+    - mvn $MAVEN_OPTS clean install -DskipTests=true
     - cd met4j-toolbox
-    - mvn $MAVEN_OPTS package
+    - mvn $MAVEN_OPTS package -DskipTests=true
     - cd ..
   artifacts:
     expire_in: 60 min
-- 
GitLab


From f04b9d10c8429aaa42d436f1ee302885772243a2 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 14:40:57 +0200
Subject: [PATCH 43/83] put version number in singularity registries

---
 .gitlab-ci.yml | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 996a23138..f243836e2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -26,18 +26,23 @@ build:
   stage: build
   script:
     - mvn $MAVEN_OPTS compile
+    - VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
+    - if [ "$CI_COMMIT_BRANCH" = "master"] then VERSION="${VERSION%"-SNAPSHOT"}" fi
+    - echo "VERSION=$VERSION" >> build.env
   artifacts:
     expire_in: 60 min
     paths:
       - target/
       - "*/target"
+    reports:
+      dotenv: build.env
 
 test:
   image: maven:3.6-adoptopenjdk-14
   stage: test
   script:
     - find . -name "*.class" -exec touch {} \+
-    - mvn clean test
+    - mvn $MAVEN_OPTS clean test
     - cat coverage/target/site/jacoco-aggregate/index.html | grep -o '<tfoot>.*</tfoot>'
 
 package:
@@ -91,12 +96,18 @@ buildSingularity:
     entrypoint: [ "" ]
   script:
     - singularity build met4j-toolbox.sif met4j.singularity
+    - if [ "$CI_COMMIT_BRANCH" = "master" ] then singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"latest" fi
+    - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$VERSION"
     - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$CI_COMMIT_BRANCH"
   rules:
-    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+    - if: $CI_COMMIT_BRANCH == master
+      when: always
+    - if: $CI_COMMIT_BRANCH == develop
       when: always
     - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
       when: manual
+  needs:
+    - build
 
 buildDockerProdGitlab:
   extends: .template_docker
-- 
GitLab


From c7cdac8927c0d3a0e69eecfdf6254e6a759b0a75 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 14:43:28 +0200
Subject: [PATCH 44/83] debug ci

---
 .gitlab-ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f243836e2..94e62e4f9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -100,9 +100,9 @@ buildSingularity:
     - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$VERSION"
     - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$CI_COMMIT_BRANCH"
   rules:
-    - if: $CI_COMMIT_BRANCH == master
+    - if: $CI_COMMIT_BRANCH == "master"
       when: always
-    - if: $CI_COMMIT_BRANCH == develop
+    - if: $CI_COMMIT_BRANCH == "develop"
       when: always
     - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
       when: manual
-- 
GitLab


From 59df68b3a4cd383dcbc9cf68faf0ac771853fbf7 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 14:50:49 +0200
Subject: [PATCH 45/83] debug ci

---
 .gitlab-ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 94e62e4f9..9c485c467 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -27,7 +27,7 @@ build:
   script:
     - mvn $MAVEN_OPTS compile
     - VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
-    - if [ "$CI_COMMIT_BRANCH" = "master"] then VERSION="${VERSION%"-SNAPSHOT"}" fi
+    - if [ "$CI_COMMIT_BRANCH" = "master" ]; then VERSION=${VERSION%"-SNAPSHOT"}; fi
     - echo "VERSION=$VERSION" >> build.env
   artifacts:
     expire_in: 60 min
@@ -96,7 +96,7 @@ buildSingularity:
     entrypoint: [ "" ]
   script:
     - singularity build met4j-toolbox.sif met4j.singularity
-    - if [ "$CI_COMMIT_BRANCH" = "master" ] then singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"latest" fi
+    - if [ "$CI_COMMIT_BRANCH" = "master" ]; then singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"latest"; fi
     - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$VERSION"
     - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$CI_COMMIT_BRANCH"
   rules:
-- 
GitLab


From a3a652ddb3b50b06a9aef5dcba7c2141bce2f584 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 15:05:09 +0200
Subject: [PATCH 46/83] disallow some jobs when MR

---
 .gitlab-ci.yml | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9c485c467..68ce90ed4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -106,6 +106,8 @@ buildSingularity:
       when: always
     - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
       when: manual
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+      when: never
   needs:
     - build
 
@@ -117,10 +119,14 @@ buildDockerProdGitlab:
     - docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:latest" .
     - docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:latest"
   rules:
-    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+    - if: $CI_COMMIT_BRANCH == "master"
+      when: always
+    - if: $CI_COMMIT_BRANCH == "develop"
       when: always
     - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
       when: manual
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+      when: never
 
 buildDockerProdDockerhub:
   extends: .template_docker
@@ -134,6 +140,8 @@ buildDockerProdDockerhub:
       when: always
     - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
       when: manual
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+      when: never
 
 
 
-- 
GitLab


From 45a27b8e28ced44ea998bc4a52fdec444cd2b05a Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 15:13:21 +0200
Subject: [PATCH 47/83] debug ci

---
 .gitlab-ci.yml | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 68ce90ed4..2e7f595b3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -104,10 +104,11 @@ buildSingularity:
       when: always
     - if: $CI_COMMIT_BRANCH == "develop"
       when: always
-    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
-      when: manual
     - if: $CI_PIPELINE_SOURCE == "merge_request_event"
       when: never
+    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
+      when: manual
+
   needs:
     - build
 
@@ -119,14 +120,14 @@ buildDockerProdGitlab:
     - docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:latest" .
     - docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:latest"
   rules:
-    - if: $CI_COMMIT_BRANCH == "master"
+      - if: $CI_COMMIT_BRANCH == "master"
       when: always
-    - if: $CI_COMMIT_BRANCH == "develop"
+      - if: $CI_COMMIT_BRANCH == "develop"
       when: always
-    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
-      when: manual
-    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+      - if: $CI_PIPELINE_SOURCE == "merge_request_event"
       when: never
+      - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
+      when: manual
 
 buildDockerProdDockerhub:
   extends: .template_docker
@@ -138,10 +139,11 @@ buildDockerProdDockerhub:
   rules:
     - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
       when: always
-    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
-      when: manual
     - if: $CI_PIPELINE_SOURCE == "merge_request_event"
       when: never
+    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
+      when: manual
+
 
 
 
-- 
GitLab


From bc25a9f32d4190cfca3897f8aadc6ee1f2103198 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 15:17:05 +0200
Subject: [PATCH 48/83] debug ci

---
 .gitlab-ci.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2e7f595b3..ede73bfb0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -120,13 +120,13 @@ buildDockerProdGitlab:
     - docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:latest" .
     - docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:latest"
   rules:
-      - if: $CI_COMMIT_BRANCH == "master"
+    - if: $CI_COMMIT_BRANCH == "master"
       when: always
-      - if: $CI_COMMIT_BRANCH == "develop"
+    - if: $CI_COMMIT_BRANCH == "develop"
       when: always
-      - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
       when: never
-      - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
+    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
       when: manual
 
 buildDockerProdDockerhub:
-- 
GitLab


From 36781372761198ec774642d8709da8b016929020 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 15:31:16 +0200
Subject: [PATCH 49/83] debug ci

---
 .gitlab-ci.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ede73bfb0..5a5ada33e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -26,9 +26,11 @@ build:
   stage: build
   script:
     - mvn $MAVEN_OPTS compile
-    - VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
+    - TRUEVERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
+    - VERSION=$TRUEVERSION
     - if [ "$CI_COMMIT_BRANCH" = "master" ]; then VERSION=${VERSION%"-SNAPSHOT"}; fi
     - echo "VERSION=$VERSION" >> build.env
+    - echo "TRUEVERSION=$TRUEVERSION" >> build.env
   artifacts:
     expire_in: 60 min
     paths:
@@ -56,7 +58,7 @@ package:
   artifacts:
     expire_in: 60 min
     paths:
-      - "met4j-toolbox/target"
+      - "met4j-toolbox/target/met4j-toolbox-$TRUEVERSION.jar"
 
 deploySnapshot:
   image: maven:3.6-adoptopenjdk-14
-- 
GitLab


From 33d061be04c376d177cebb54ff0fbd0fc1ebb5ba Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 15:52:22 +0200
Subject: [PATCH 50/83] debug ci

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5a5ada33e..b11383997 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -110,9 +110,9 @@ buildSingularity:
       when: never
     - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
       when: manual
-
   needs:
     - build
+    - package
 
 buildDockerProdGitlab:
   extends: .template_docker
-- 
GitLab


From 1bd81ec2d441c0290d73c5f2f7bb250be5c8d4ab Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 16:09:00 +0200
Subject: [PATCH 51/83] set versions to Docker

---
 .gitlab-ci.yml | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b11383997..c70f38df1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -99,7 +99,7 @@ buildSingularity:
   script:
     - singularity build met4j-toolbox.sif met4j.singularity
     - if [ "$CI_COMMIT_BRANCH" = "master" ]; then singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"latest"; fi
-    - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$VERSION"
+    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$VERSION"; fi
     - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$CI_COMMIT_BRANCH"
   rules:
     - if: $CI_COMMIT_BRANCH == "master"
@@ -119,8 +119,12 @@ buildDockerProdGitlab:
   before_script:
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
   script:
-    - docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:latest" .
-    - docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:latest"
+    - if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:latest" .; fi
+    - if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:latest"; fi
+    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:$VERSION" .; fi
+    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:$VERSION"; fi
+    - docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:$CI_COMMIT_BRANCH" .
+    - docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:$CI_COMMIT_BRANCH"
   rules:
     - if: $CI_COMMIT_BRANCH == "master"
       when: always
@@ -130,21 +134,33 @@ buildDockerProdGitlab:
       when: never
     - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
       when: manual
+  needs:
+    - build
+    - package
 
 buildDockerProdDockerhub:
   extends: .template_docker
   before_script:
     - docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_PASSWORD" $DOCKERHUB_REGISTRY
   script:
-    - docker build --pull -t "$DOCKERHUB_IMAGE:latest" .
-    - docker push "$DOCKERHUB_IMAGE:latest"
+    - if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker build -t "$DOCKERHUB_IMAGE:latest" .; fi
+    - if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$DOCKERHUB_IMAGE:latest"; fi
+    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then docker build -t "$DOCKERHUB_IMAGE:$VERSION" .; fi
+    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$DOCKERHUB_IMAGE:$VERSION"; fi
+    - docker build -t "$DOCKERHUB_IMAGE:$CI_COMMIT_BRANCH" .
+    - docker push "$DOCKERHUB_IMAGE:$CI_COMMIT_BRANCH"
   rules:
-    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+    - if: $CI_COMMIT_BRANCH == "master"
+      when: always
+    - if: $CI_COMMIT_BRANCH == "develop"
       when: always
     - if: $CI_PIPELINE_SOURCE == "merge_request_event"
       when: never
     - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
       when: manual
+  needs:
+    - build
+    - package
 
 
 
-- 
GitLab


From c46b61d923c7f308439ab874082dadc9765d876d Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 6 May 2022 16:41:24 +0200
Subject: [PATCH 52/83] Launch mvn package before docker

---
 Dockerfile | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index fe097dfea..b66d8971e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,25 +4,14 @@ RUN export DEBIAN_FRONTEND=noninteractive
 
 RUN apt-get update \
 && apt-get upgrade -y \
-&& apt-get install -y openjdk-11-jre git maven \
+&& apt-get install -y openjdk-11-jre maven \
 && apt-get clean \
 && apt-get purge
 
-RUN mkdir -p /opt && cd /opt \
-&& git clone https://forgemia.inra.fr/metexplore/met4j.git \
-&& cd met4j \
-&& mvn install \
-&& cd met4j-toolbox \
-&& mvn package
-
-RUN mkdir -p /opt/bin \
-&& cd /opt/met4j/met4j-toolbox \
-&& cp target/met4j*.jar /opt/bin/met4j.jar \
-&& cd /opt \
-&& rm -rf met4j ~/.m2  \
-&& apt-get remove -y git && apt-get autoremove -y
+RUN mkdir -p /opt/bin
 
 COPY ./docker_files/met4j.sh /opt/bin
+COPY ./met4j-toolbox/target/met4j*.jar /opt/bin/met4j.jar
 
 RUN chmod a+x /opt/bin/met4j.sh
 
-- 
GitLab


From 8cf79ede2b9f4027166f245ca4c81612ac5fa4dd Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Mon, 9 May 2022 13:57:27 +0200
Subject: [PATCH 53/83] Complete doc about Docker & Singularity

---
 met4j-toolbox/README.md | 44 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/met4j-toolbox/README.md b/met4j-toolbox/README.md
index f99b20adc..1fecda21c 100644
--- a/met4j-toolbox/README.md
+++ b/met4j-toolbox/README.md
@@ -32,6 +32,28 @@ You need at least [singularity](https://sylabs.io/guides/3.5/user-guide/quick_st
 singularity pull met4j-toolbox.sif oras://registry.forgemia.inra.fr/metexplore/met4j/met4j-singularity:latest
 ```
 
+If you want a specific version:
+
+```console
+singularity pull met4j-toolbox.sif oras://registry.forgemia.inra.fr/metexplore/met4j/met4j-singularity:x.y.z
+```
+
+If you want the last develop version:
+
+```console
+singularity pull met4j-toolbox.sif oras://registry.forgemia.inra.fr/metexplore/met4j/met4j-singularity:develop
+```
+
+If you want to build by yourself the singularity image:
+
+```console
+cd met4j-toolbox
+mvn package
+cd ../
+singularity build met4j-toolbox.sif met4j.singularity
+```
+
+
 This will download a singularity container met4j-toolbox.sif that you can directly launch.
 
 To list all the apps.
@@ -66,6 +88,27 @@ Pull the latest met4j image:
 sudo docker pull metexplore/met4j:latest
 ```
 
+If you want a specific version:
+
+```console
+sudo docker pull metexplore/met4j:x.y.z
+```
+
+If you want the develop version:
+```console
+sudo docker pull metexplore/met4j:develop
+```
+
+If you want to build by yourself the docker image:
+
+```console
+cd met4j-toolbox
+mvn package
+cd ../
+sudo docker build -t metexplore/met4j:myversion .
+```
+
+
 To list all the apps:
 ```console
 sudo docker run metexplore/met4j:latest met4j.sh
@@ -88,7 +131,6 @@ sudo docker run -w /work -v /home/lcottret/work:/work \
  -in toy_model.xml -out toy_model.tsv
 ```
 
-
 ## Features
 <table>
 <thead><tr><th colspan="2">Package fr.inrae.toulouse.metexplore.met4j_toolbox.attributes</th></tr></thead>
-- 
GitLab


From e4bbedac7ed53524c881fdd43bd8bbc8ca8df825 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Mon, 9 May 2022 14:50:58 +0200
Subject: [PATCH 54/83] create tag also for branch in lower case

---
 .gitlab-ci.yml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c70f38df1..733ea1f77 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -101,6 +101,8 @@ buildSingularity:
     - if [ "$CI_COMMIT_BRANCH" = "master" ]; then singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"latest"; fi
     - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$VERSION"; fi
     - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$CI_COMMIT_BRANCH"
+    # branch in lower case
+    - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"${CI_COMMIT_BRANCH,,}"
   rules:
     - if: $CI_COMMIT_BRANCH == "master"
       when: always
@@ -125,6 +127,9 @@ buildDockerProdGitlab:
     - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:$VERSION"; fi
     - docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:$CI_COMMIT_BRANCH" .
     - docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:$CI_COMMIT_BRANCH"
+    # branch in lower case
+    - docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:${CI_COMMIT_BRANCH,,}" .
+    - docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:${CI_COMMIT_BRANCH,,}"
   rules:
     - if: $CI_COMMIT_BRANCH == "master"
       when: always
@@ -149,6 +154,10 @@ buildDockerProdDockerhub:
     - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$DOCKERHUB_IMAGE:$VERSION"; fi
     - docker build -t "$DOCKERHUB_IMAGE:$CI_COMMIT_BRANCH" .
     - docker push "$DOCKERHUB_IMAGE:$CI_COMMIT_BRANCH"
+    # branch in lower case
+    - docker build -t "$DOCKERHUB_IMAGE:${CI_COMMIT_BRANCH,,}" .
+    - docker push "$DOCKERHUB_IMAGE:${CI_COMMIT_BRANCH,,}" .
+
   rules:
     - if: $CI_COMMIT_BRANCH == "master"
       when: always
-- 
GitLab


From 374ad638cda2d4f04007a9adafb7fb9a413de608 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Mon, 9 May 2022 16:21:32 +0200
Subject: [PATCH 55/83] keep tests elements if wrapper wml already exists

---
 .../generic/AbstractMet4jApplication.java     | 64 +++++++++++++++----
 1 file changed, 50 insertions(+), 14 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index 8ab337905..cfb4bf23e 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -51,7 +51,10 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
 
+import javax.xml.XMLConstants;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -218,20 +221,46 @@ public abstract class AbstractMet4jApplication {
     }
 
 
-
-
-    public void xmlGalaxyWrapper(String outputDirectory, GalaxyPackageType packageType) throws ParserConfigurationException, XmlPullParserException, IOException, IllegalAccessException, TransformerException {
+    public void xmlGalaxyWrapper(String outputDirectory, GalaxyPackageType packageType) throws ParserConfigurationException, XmlPullParserException, IOException, IllegalAccessException, TransformerException, SAXException {
 
         String packageName = this.getSimplePackageName();
 
         String className = this.getClass().getSimpleName();
 
-        File wrapperDirectory = new File(outputDirectory + "/" + packageName+ "/" + className);
+        File wrapperDirectory = new File(outputDirectory + "/" + packageName + "/" + className);
 
         if (!wrapperDirectory.exists()) {
             wrapperDirectory.mkdirs();
         }
 
+        String fileName = wrapperDirectory.getAbsolutePath() + "/" + className + ".xml";
+
+        File file = new File(fileName);
+
+        Boolean testExists = false;
+
+        NodeList testList = null;
+
+        if (file.exists()) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+
+            // optional, but recommended
+            // process XML securely, avoid attacks like XML External Entities (XXE)
+            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+
+            // parse XML file
+            DocumentBuilder db = dbf.newDocumentBuilder();
+
+            Document doc = db.parse(file);
+
+            testList = doc.getElementsByTagName("test");
+
+            if (testList.getLength() > 0) {
+                testExists = true;
+            }
+        }
+
         this.initOptions();
 
         DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
@@ -241,7 +270,7 @@ public abstract class AbstractMet4jApplication {
         Document document = documentBuilder.newDocument();
 
         Element root = document.createElement("tool");
-        root.setAttribute("id", "met4j_"+this.getLabel());
+        root.setAttribute("id", "met4j_" + this.getLabel());
         root.setAttribute("name", this.getLabel());
         root.setAttribute("version", this.getVersion());
 
@@ -260,11 +289,10 @@ public abstract class AbstractMet4jApplication {
         root.appendChild(requirements);
         Element container = document.createElement("container");
 
-        if(packageType.equals(GalaxyPackageType.Docker)) {
+        if (packageType.equals(GalaxyPackageType.Docker)) {
             container.setAttribute("type", "docker");
             container.setTextContent("metexplore/met4j:latest");
-        }
-        else if(packageType.equals(GalaxyPackageType.Singularity)) {
+        } else if (packageType.equals(GalaxyPackageType.Singularity)) {
             container.setAttribute("type", "singularity");
             container.setTextContent("oras://registry.forgemia.inra.fr/metexplore/met4j/met4j-singularity:latest");
         }
@@ -302,12 +330,12 @@ public abstract class AbstractMet4jApplication {
 
             if (o.get("type").startsWith("input")) {
                 param.setAttribute("type", "data");
-                param.setAttribute("format", "format");
+                param.setAttribute("format", o.get("format"));
             } else {
                 param.setAttribute("type", o.get("type"));
             }
 
-            if(o.get("type").equals("text")) {
+            if (o.get("type").equals("text")) {
                 Element sanitizer = document.createElement("sanitizer");
                 sanitizer.setAttribute("invalid_char", "_");
                 Element valid = document.createElement("valid");
@@ -316,14 +344,14 @@ public abstract class AbstractMet4jApplication {
                 param.appendChild(sanitizer);
             }
 
-            if(o.get("type").equals("select")) {
+            if (o.get("type").equals("select")) {
                 String choices = o.get("choices");
                 String[] tabChoices = choices.split(",");
-                for(int i=0; i<tabChoices.length;i++) {
+                for (int i = 0; i < tabChoices.length; i++) {
                     String choice = tabChoices[i];
                     Element option = document.createElement("option");
                     option.setAttribute("value", choice);
-                    if(choice.equals(o.get("default"))) {
+                    if (choice.equals(o.get("default"))) {
                         option.setAttribute("selected", "true");
                     }
                     option.setTextContent(choice);
@@ -356,6 +384,14 @@ public abstract class AbstractMet4jApplication {
         help.appendChild(cHelp);
         root.appendChild(help);
 
+        if (testExists) {
+            Element tests = document.createElement("tests");
+            root.appendChild(tests);
+            for (int i = 0; i < testList.getLength(); i++) {
+                Node newNode = document.importNode(testList.item(i), true);
+                tests.appendChild(newNode);
+            }
+        }
         document.appendChild(root);
 
         TransformerFactory transformerFactory = TransformerFactory.newInstance();
@@ -408,7 +444,7 @@ public abstract class AbstractMet4jApplication {
                     )
             );
 
-        return model.getVersion().replace("-SNAPSHOT","");
+        return model.getVersion().replace("-SNAPSHOT", "");
     }
 
     /**
-- 
GitLab


From 4ddea297e7b6d4b17bf708ffee124e0499b3cd4a Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Mon, 9 May 2022 16:22:00 +0200
Subject: [PATCH 56/83] lower case tags for singularity & docker

---
 .gitlab-ci.yml | 85 ++++++++++++++++++++------------------------------
 1 file changed, 34 insertions(+), 51 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 733ea1f77..1cc45e880 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,6 +12,30 @@ stages:
   image: docker:latest
   services:
     - docker:dind
+  script:
+    - if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker build -t "$DOCKER_IMAGE:latest" .; fi
+    - if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$DOCKER_IMAGE:latest"; fi
+    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then docker build -t "$DOCKER_IMAGE:$VERSION" .; fi
+    # version in lower case
+    - if [ "- if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" -a "$VERSION" != "$LOWER_CASE_VERSION" ]; then docker build -t "$DOCKER_IMAGE:$LOWER_CASE_VERSION" .; fi
+    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" -a "$VERSION" != "$LOWER_CASE_VERSION" ]; then docker push "$DOCKER_IMAGE:$LOWER_CASE_VERSION"; fi
+    - docker build -t "$DOCKER_IMAGE:$CI_COMMIT_BRANCH" .
+    - docker push "$DOCKER_IMAGE:$CI_COMMIT_BRANCH"
+    # branch in lower case
+    - docker build -t "$DOCKER_IMAGE:$LOWER_CASE_COMMIT_BRANCH" .
+    - docker push "$DOCKER_IMAGE:$LOWER_CASE_COMMIT_BRANCH"
+  rules:
+    - if: $CI_COMMIT_BRANCH == "master"
+      when: always
+    - if: $CI_COMMIT_BRANCH == "develop"
+      when: always
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+      when: never
+    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
+      when: manual
+  needs:
+    - build
+    - package
 
 variables:
   MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
@@ -29,8 +53,12 @@ build:
     - TRUEVERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
     - VERSION=$TRUEVERSION
     - if [ "$CI_COMMIT_BRANCH" = "master" ]; then VERSION=${VERSION%"-SNAPSHOT"}; fi
+    - LOWER_CASE_VERSION=${VERSION,,}
+    - LOWER_CASE_COMMIT_BRANCH=${CI_COMMIT_BRANCH,,}
     - echo "VERSION=$VERSION" >> build.env
     - echo "TRUEVERSION=$TRUEVERSION" >> build.env
+    - echo "LOWER_CASE_VERSION=$LOWER_CASE_VERSION" >> build.env
+    - echo "LOWER_CASE_COMMIT_BRANCH=$LOWER_CASE_COMMIT_BRANCH" >> build.env
   artifacts:
     expire_in: 60 min
     paths:
@@ -100,9 +128,11 @@ buildSingularity:
     - singularity build met4j-toolbox.sif met4j.singularity
     - if [ "$CI_COMMIT_BRANCH" = "master" ]; then singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"latest"; fi
     - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$VERSION"; fi
+    # version in lower case
+    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" -a "$VERSION" != "$LOWER_CASE_VERSION"]; then singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$LOWER_CASE_VERSION"; fi
     - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$CI_COMMIT_BRANCH"
     # branch in lower case
-    - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"${CI_COMMIT_BRANCH,,}"
+    - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" met4j-toolbox.sif oras://"$CI_REGISTRY_IMAGE"/met4j-singularity:"$LOWER_CASE_COMMIT_BRANCH"
   rules:
     - if: $CI_COMMIT_BRANCH == "master"
       when: always
@@ -120,58 +150,11 @@ buildDockerProdGitlab:
   extends: .template_docker
   before_script:
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-  script:
-    - if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:latest" .; fi
-    - if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:latest"; fi
-    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:$VERSION" .; fi
-    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:$VERSION"; fi
-    - docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:$CI_COMMIT_BRANCH" .
-    - docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:$CI_COMMIT_BRANCH"
-    # branch in lower case
-    - docker build -t "$CI_REGISTRY/metexplore/met4j/met4j-docker:${CI_COMMIT_BRANCH,,}" .
-    - docker push "$CI_REGISTRY/metexplore/met4j/met4j-docker:${CI_COMMIT_BRANCH,,}"
-  rules:
-    - if: $CI_COMMIT_BRANCH == "master"
-      when: always
-    - if: $CI_COMMIT_BRANCH == "develop"
-      when: always
-    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
-      when: never
-    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
-      when: manual
-  needs:
-    - build
-    - package
+    - DOCKER_IMAGE="$CI_REGISTRY/metexplore/met4j/met4j-docker"
+
 
 buildDockerProdDockerhub:
   extends: .template_docker
   before_script:
     - docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_PASSWORD" $DOCKERHUB_REGISTRY
-  script:
-    - if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker build -t "$DOCKERHUB_IMAGE:latest" .; fi
-    - if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$DOCKERHUB_IMAGE:latest"; fi
-    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then docker build -t "$DOCKERHUB_IMAGE:$VERSION" .; fi
-    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$DOCKERHUB_IMAGE:$VERSION"; fi
-    - docker build -t "$DOCKERHUB_IMAGE:$CI_COMMIT_BRANCH" .
-    - docker push "$DOCKERHUB_IMAGE:$CI_COMMIT_BRANCH"
-    # branch in lower case
-    - docker build -t "$DOCKERHUB_IMAGE:${CI_COMMIT_BRANCH,,}" .
-    - docker push "$DOCKERHUB_IMAGE:${CI_COMMIT_BRANCH,,}" .
-
-  rules:
-    - if: $CI_COMMIT_BRANCH == "master"
-      when: always
-    - if: $CI_COMMIT_BRANCH == "develop"
-      when: always
-    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
-      when: never
-    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
-      when: manual
-  needs:
-    - build
-    - package
-
-
-
-
-
+    - DOCKER_IMAGE=$DOCKERHUB_IMAGE
\ No newline at end of file
-- 
GitLab


From a5c77919f4d961fb998cdaac9445bf1d07433e2e Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Mon, 9 May 2022 16:26:47 +0200
Subject: [PATCH 57/83] debug ci

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1cc45e880..0e08809cc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,7 +17,7 @@ stages:
     - if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$DOCKER_IMAGE:latest"; fi
     - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" ]; then docker build -t "$DOCKER_IMAGE:$VERSION" .; fi
     # version in lower case
-    - if [ "- if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" -a "$VERSION" != "$LOWER_CASE_VERSION" ]; then docker build -t "$DOCKER_IMAGE:$LOWER_CASE_VERSION" .; fi
+    - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" -a "$VERSION" != "$LOWER_CASE_VERSION" ]; then docker build -t "$DOCKER_IMAGE:$LOWER_CASE_VERSION" .; fi
     - if [ "$CI_COMMIT_BRANCH" = "develop" -o "$CI_COMMIT_BRANCH" = "master" -a "$VERSION" != "$LOWER_CASE_VERSION" ]; then docker push "$DOCKER_IMAGE:$LOWER_CASE_VERSION"; fi
     - docker build -t "$DOCKER_IMAGE:$CI_COMMIT_BRANCH" .
     - docker push "$DOCKER_IMAGE:$CI_COMMIT_BRANCH"
-- 
GitLab


From 3ddff5d6859afba4495a8c89ad4e19d5d5ee3816 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 08:41:05 +0200
Subject: [PATCH 58/83] Precise version for galaxy wrappers

---
 .../met4j_toolbox/GenerateGalaxyFiles.java      |  8 ++++++--
 .../generic/AbstractMet4jApplication.java       | 17 +++++++++++------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
index 15c4a3a2f..ecc44d2ed 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/GenerateGalaxyFiles.java
@@ -68,6 +68,9 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
     @Option(name = "-p", usage = "Package type", required = false)
     public GalaxyPackageType packageType = GalaxyPackageType.Singularity;
 
+    @Option(name = "-v", usage = "Met4j version", required = false)
+    public String version = "latest";
+
     public static void main(String[] args) {
 
         GenerateGalaxyFiles app = new GenerateGalaxyFiles();
@@ -149,14 +152,15 @@ public class GenerateGalaxyFiles extends AbstractMet4jApplication {
                     try {
                         Object obj = ctor.newInstance();
 
-                        Class methodArgs[] = new Class[2];
+                        Class methodArgs[] = new Class[3];
                         methodArgs[0] = String.class;
                         methodArgs[1] = GalaxyPackageType.class;
+                        methodArgs[2] = String.class;
 
                         System.err.println(obj.getClass().getName());
 
                         Method method = obj.getClass().getMethod("xmlGalaxyWrapper", methodArgs);
-                        method.invoke(obj, this.outputDirectory, this.packageType);
+                        method.invoke(obj, this.outputDirectory, this.packageType, this.version);
 
                         Element tool = toolConf.createElement("tool");
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index cfb4bf23e..8afa1484b 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -221,7 +221,7 @@ public abstract class AbstractMet4jApplication {
     }
 
 
-    public void xmlGalaxyWrapper(String outputDirectory, GalaxyPackageType packageType) throws ParserConfigurationException, XmlPullParserException, IOException, IllegalAccessException, TransformerException, SAXException {
+    public void xmlGalaxyWrapper(String outputDirectory, GalaxyPackageType packageType, String version) throws ParserConfigurationException, XmlPullParserException, IOException, IllegalAccessException, TransformerException, SAXException {
 
         String packageName = this.getSimplePackageName();
 
@@ -272,7 +272,7 @@ public abstract class AbstractMet4jApplication {
         Element root = document.createElement("tool");
         root.setAttribute("id", "met4j_" + this.getLabel());
         root.setAttribute("name", this.getLabel());
-        root.setAttribute("version", this.getVersion());
+        root.setAttribute("version", version);
 
         Element description = document.createElement("description");
         description.setTextContent(this.getShortDescription());
@@ -291,10 +291,10 @@ public abstract class AbstractMet4jApplication {
 
         if (packageType.equals(GalaxyPackageType.Docker)) {
             container.setAttribute("type", "docker");
-            container.setTextContent("metexplore/met4j:latest");
+            container.setTextContent("metexplore/met4j:"+version);
         } else if (packageType.equals(GalaxyPackageType.Singularity)) {
             container.setAttribute("type", "singularity");
-            container.setTextContent("oras://registry.forgemia.inra.fr/metexplore/met4j/met4j-singularity:latest");
+            container.setTextContent("oras://registry.forgemia.inra.fr/metexplore/met4j/met4j-singularity:"+version);
         }
         requirements.appendChild(container);
 
@@ -318,11 +318,16 @@ public abstract class AbstractMet4jApplication {
             Element param = getParamFromOption(document, o);
             inputElements.appendChild(param);
 
-            if (o.get("optional").equals("true")) {
+            if (o.get("optional").equals("true") || o.get("type").equalsIgnoreCase("boolean")) {
                 commandText += "#if str($" + o.get("argument").substring(1) + "):\n";
             }
 
-            commandText += " " + o.get("argument") + " " + "\"$" + o.get("name") + "\"\n";
+            if(o.get("type").equalsIgnoreCase("boolean")) {
+                commandText += " " + o.get("argument") + " " + "\"$" + o.get("name") + "\"\n";
+            }
+            else {
+                commandText += " " + o.get("argument") + " " + "\"$" + o.get("name") + "\"\n";
+            }
 
             if (o.get("optional").equals("true")) {
                 commandText += "#end if\n";
-- 
GitLab


From cf283efc7ce45a39a38523f9ee5a5a27a0576f92 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 09:58:14 +0200
Subject: [PATCH 59/83] debug galaxy boolean parameters

---
 .../generic/AbstractMet4jApplication.java     | 88 +++++++++++--------
 1 file changed, 49 insertions(+), 39 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index 8afa1484b..01719a93d 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -131,6 +131,8 @@ public abstract class AbstractMet4jApplication {
                     map.put("type", "text");
                 } else if (f.getType().getSimpleName().equalsIgnoreCase("double")) {
                     map.put("type", "float");
+                } else if (f.getType().getSimpleName().equalsIgnoreCase("boolean")) {
+                    map.put("type", "boolean");
                 } else {
                     map.put("type", f.getType().getSimpleName().toLowerCase());
                 }
@@ -291,10 +293,10 @@ public abstract class AbstractMet4jApplication {
 
         if (packageType.equals(GalaxyPackageType.Docker)) {
             container.setAttribute("type", "docker");
-            container.setTextContent("metexplore/met4j:"+version);
+            container.setTextContent("metexplore/met4j:" + version);
         } else if (packageType.equals(GalaxyPackageType.Singularity)) {
             container.setAttribute("type", "singularity");
-            container.setTextContent("oras://registry.forgemia.inra.fr/metexplore/met4j/met4j-singularity:"+version);
+            container.setTextContent("oras://registry.forgemia.inra.fr/metexplore/met4j/met4j-singularity:" + version);
         }
         requirements.appendChild(container);
 
@@ -318,49 +320,49 @@ public abstract class AbstractMet4jApplication {
             Element param = getParamFromOption(document, o);
             inputElements.appendChild(param);
 
-            if (o.get("optional").equals("true") || o.get("type").equalsIgnoreCase("boolean")) {
-                commandText += "#if str($" + o.get("argument").substring(1) + "):\n";
-            }
+            if (o.get("type").equalsIgnoreCase("boolean")) {
+                commandText += " " + "$" + o.get("name") + "\n";
+            } else {
+
+                if (o.get("optional").equals("true")) {
+                    commandText += "#if str($" + o.get("argument").substring(1) + "):\n";
+                }
 
-            if(o.get("type").equalsIgnoreCase("boolean")) {
-                commandText += " " + o.get("argument") + " " + "\"$" + o.get("name") + "\"\n";
-            }
-            else {
                 commandText += " " + o.get("argument") + " " + "\"$" + o.get("name") + "\"\n";
-            }
 
-            if (o.get("optional").equals("true")) {
-                commandText += "#end if\n";
-            }
+                if (o.get("optional").equals("true")) {
+                    commandText += "#end if\n";
+                }
 
-            if (o.get("type").startsWith("input")) {
-                param.setAttribute("type", "data");
-                param.setAttribute("format", o.get("format"));
-            } else {
-                param.setAttribute("type", o.get("type"));
-            }
+                if (o.get("type").startsWith("input")) {
+                    param.setAttribute("type", "data");
+                    param.setAttribute("format", o.get("format"));
+                } else {
+                    param.setAttribute("type", o.get("type"));
+                }
 
-            if (o.get("type").equals("text")) {
-                Element sanitizer = document.createElement("sanitizer");
-                sanitizer.setAttribute("invalid_char", "_");
-                Element valid = document.createElement("valid");
-                valid.setAttribute("initial", "string.printable");
-                sanitizer.appendChild(valid);
-                param.appendChild(sanitizer);
-            }
+                if (o.get("type").equals("text")) {
+                    Element sanitizer = document.createElement("sanitizer");
+                    sanitizer.setAttribute("invalid_char", "_");
+                    Element valid = document.createElement("valid");
+                    valid.setAttribute("initial", "string.printable");
+                    sanitizer.appendChild(valid);
+                    param.appendChild(sanitizer);
+                }
 
-            if (o.get("type").equals("select")) {
-                String choices = o.get("choices");
-                String[] tabChoices = choices.split(",");
-                for (int i = 0; i < tabChoices.length; i++) {
-                    String choice = tabChoices[i];
-                    Element option = document.createElement("option");
-                    option.setAttribute("value", choice);
-                    if (choice.equals(o.get("default"))) {
-                        option.setAttribute("selected", "true");
+                if (o.get("type").equals("select")) {
+                    String choices = o.get("choices");
+                    String[] tabChoices = choices.split(",");
+                    for (int i = 0; i < tabChoices.length; i++) {
+                        String choice = tabChoices[i];
+                        Element option = document.createElement("option");
+                        option.setAttribute("value", choice);
+                        if (choice.equals(o.get("default"))) {
+                            option.setAttribute("selected", "true");
+                        }
+                        option.setTextContent(choice);
+                        param.appendChild(option);
                     }
-                    option.setTextContent(choice);
-                    param.appendChild(option);
                 }
             }
 
@@ -420,8 +422,16 @@ public abstract class AbstractMet4jApplication {
             param = document.createElement("param");
             param.setAttribute("name", o.get("name"));
             param.setAttribute("label", o.get("label"));
-            param.setAttribute("optional", o.get("optional"));
             param.setAttribute("argument", o.get("argument"));
+
+            if (!o.get("type").equalsIgnoreCase("boolean")) {
+                param.setAttribute("optional", o.get("optional"));
+            } else {
+                param.setAttribute("truevalue", o.get("argument"));
+                param.setAttribute("falsevalue", o.get(""));
+                param.setAttribute("type", "boolean");
+                param.setAttribute("checked", o.get("default"));
+            }
         }
         return param;
     }
-- 
GitLab


From 30ac1a3df57c56f7b3ac1a97261420db3d14b39f Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 10:28:35 +0200
Subject: [PATCH 60/83] doc

---
 .../met4j_toolbox/attributes/SbmlSetChargesFromFile.java        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java
index ded9a4d4f..834c4ecae 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java
@@ -66,7 +66,7 @@ public class SbmlSetChargesFromFile extends AbstractSbmlSetMetabolite {
         return this.getShortDescription()+"\n"+
                 "The charge must be a number. "+ this.setDescription+"\n" +
                 "The charge will be written in the SBML file in two locations:+\n" +
-                "- in the reaction notes (e.g. <p>charge: -1</p>\n" +
+                "- in the reaction notes (e.g. <p>charge: -1</p>)\n" +
                 "- as fbc attribute (e.g. fbc:charge=\"1\")";
     }
 
-- 
GitLab


From 02840a7d3f76c9d59f447e61053fd30430fc2671 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 11:18:05 +0200
Subject: [PATCH 61/83] debug conditional

---
 .../met4j_toolbox/generic/AbstractMet4jApplication.java       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index 01719a93d..e91a40d3f 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -91,7 +91,7 @@ public abstract class AbstractMet4jApplication {
         options = new ArrayList<>();
 
         // Browse each class field
-        for (Field f : this.getClass().getDeclaredFields()) {
+        for (Field f : this.getClass().getFields()) {
 
             boolean isParameter = Arrays.stream(f.getDeclaredAnnotations()).anyMatch(a -> a instanceof Option);
 
@@ -325,7 +325,7 @@ public abstract class AbstractMet4jApplication {
             } else {
 
                 if (o.get("optional").equals("true")) {
-                    commandText += "#if str($" + o.get("argument").substring(1) + "):\n";
+                    commandText += "#if str($" + o.get("name") + "):\n";
                 }
 
                 commandText += " " + o.get("argument") + " " + "\"$" + o.get("name") + "\"\n";
-- 
GitLab


From 70f29f7ff9e6c2f56098d52584b9b83f994edbd2 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 11:18:23 +0200
Subject: [PATCH 62/83] options protected to public

---
 .../met4j_toolbox/attributes/AbstractSbmlSet.java      | 10 +++++-----
 .../met4j_toolbox/attributes/AbstractSbmlSetAny.java   |  8 ++++----
 .../attributes/AbstractSbmlSetMetabolite.java          |  6 +++---
 .../attributes/AbstractSbmlSetReaction.java            |  4 ++--
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java
index 8efc04086..4bf481b61 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java
@@ -58,26 +58,26 @@ import static fr.inrae.toulouse.metexplore.met4j_toolbox.generic.annotations.Enu
 public abstract class AbstractSbmlSet extends AbstractMet4jApplication {
 
     @Option(name="-n", usage="[0] Number of lines to skip at the beginning of the tabulated file")
-    protected int nSkip = 0;
+    public int nSkip = 0;
 
     @Format(name= Sbml)
     @ParameterType(name = OutputFile)
     @Option(name="-out", usage="[out.sbml] Out sbml file")
-    protected String out = "out.sbml";
+    public String out = "out.sbml";
 
     @Format(name= Sbml)
     @ParameterType(name = InputFile)
     @Option(name="-sbml", usage="Original sbml file", required=true)
-    protected String sbml;
+    public String sbml;
 
     @ParameterType(name = InputFile)
     @Format(name= Tsv)
     @Option(name="-tab", usage="Tabulated file")
-    protected String tab;
+    public String tab;
 
     @ParameterType(name= EnumParameterTypes.Text)
     @Option(name="-c", usage="[#] Comment String in the tabulated file. The lines beginning by this string won't be read")
-    protected String c="#";
+    public String c="#";
 
     /**
      * <p>Constructor for AbstractSbmlSet.</p>
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java
index 1a2bca7a0..ea1876fdb 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java
@@ -56,17 +56,17 @@ public abstract class AbstractSbmlSetAny extends AbstractSbmlSet {
 
     @ParameterType(name=Text)
     @Option(name="-ci", usage="[1] number of the column where are the object ids")
-    protected int colid=1;
+    public int colid=1;
 
     @Option(name="-p", usage="[deactivated] To match the objects in the sbml file, adds the prefix R_ to reactions and M_ to metabolites")
-    protected Boolean p=false;
+    public Boolean p=false;
 
     @Option(name="-s", usage="[deactivated] To match the objects in the sbml file, adds the suffix _comparmentID to metabolites")
-    protected Boolean s=false;
+    public Boolean s=false;
 
     @ParameterType(name=Text)
     @Option(name="-o", usage="[REACTION] Object type in the column id : REACTION;METABOLITE;PROTEIN;GENE;PATHWAY")
-    protected EntityType o= EntityType.REACTION;
+    public EntityType o= EntityType.REACTION;
 
     /**
      * <p>Constructor for AbstractSbmlSetAny.</p>
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetMetabolite.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetMetabolite.java
index b95e80730..9e30fdade 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetMetabolite.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetMetabolite.java
@@ -50,13 +50,13 @@ public abstract class AbstractSbmlSetMetabolite  extends AbstractSbmlSet{
             "If prefix or suffix is different in the SBML file, use the -p or the -s options.";
 
     @Option(name="-ci", usage="[1] number of the column where are the metabolite ids")
-    protected Integer colid=1;
+    public Integer colid=1;
 
     @Option(name="-p", usage="[deactivated] To match the objects in the sbml file, adds the prefix M_ to metabolite ids")
-    protected Boolean p=false;
+    public Boolean p=false;
 
     @Option(name="-s", usage="[deactivated] To match the objects in the sbml file, adds the suffix _comparmentID to metabolites")
-    protected Boolean s=false;
+    public Boolean s=false;
 
     /**
      * <p>Constructor for AbstractSbmlSetMetabolite.</p>
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetReaction.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetReaction.java
index 4b67b39ab..db092f453 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetReaction.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetReaction.java
@@ -53,10 +53,10 @@ public abstract class AbstractSbmlSetReaction extends AbstractSbmlSet {
 
     @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-ci", usage="[1] number of the column where are the reaction ids")
-    protected int colid=1;
+    public int colid=1;
 
     @Option(name="-p", usage="[deactivated] To match the objects in the sbml file, adds the prefix R_ to reactions")
-    protected Boolean p=false;
+    public Boolean p=false;
 
     /**
      * <p>Constructor for AbstractSbmlSetReaction.</p>
-- 
GitLab


From e15366e1387489e8836b2ad9108c40aae34b77db Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 11:27:16 +0200
Subject: [PATCH 63/83] change error status to 1 instead of 0

---
 .../met4j_toolbox/attributes/AbstractSbmlSet.java    |  6 +++---
 .../attributes/SbmlSetChargesFromFile.java           |  4 ++--
 .../met4j_toolbox/attributes/SbmlSetEcsFromFile.java |  2 +-
 .../attributes/SbmlSetFormulasFromFile.java          |  4 ++--
 .../attributes/SbmlSetGprsFromFile.java              |  4 ++--
 .../attributes/SbmlSetNamesFromFile.java             |  4 ++--
 .../attributes/SbmlSetPathwaysFromFile.java          |  2 +-
 .../attributes/SbmlSetRefsFromFile.java              |  4 ++--
 .../attributes/SbmlToMetaboliteTable.java            |  4 ++--
 .../met4j_toolbox/bigg/GetModelProteome.java         | 12 ++++++------
 .../metexplore/met4j_toolbox/convert/FbcToNotes.java |  2 +-
 .../generic/AbstractMet4jApplication.java            |  6 +++---
 12 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java
index 4bf481b61..c21aa34a2 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSet.java
@@ -97,7 +97,7 @@ public abstract class AbstractSbmlSet extends AbstractMet4jApplication {
         } catch (IOException e) {
             e.printStackTrace();
             System.err.println("Unable to read the sbml file "+this.sbml);
-            System.exit(0);
+            System.exit(1);
         }
 
         BioNetwork bn = null;
@@ -106,7 +106,7 @@ public abstract class AbstractSbmlSet extends AbstractMet4jApplication {
         } catch (Met4jSbmlReaderException e) {
             e.printStackTrace();
             System.err.println("Problem while reading the sbml file "+this.sbml);
-            System.exit(0);
+            System.exit(1);
         }
 
         return bn;
@@ -126,7 +126,7 @@ public abstract class AbstractSbmlSet extends AbstractMet4jApplication {
         } catch (Exception e) {
             e.printStackTrace();
             System.err.println("Error in writing the sbml file");
-            System.exit(0);
+            System.exit(1);
         }
     }
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java
index 834c4ecae..b149a5bdf 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetChargesFromFile.java
@@ -110,12 +110,12 @@ public class SbmlSetChargesFromFile extends AbstractSbmlSetMetabolite {
 
         if(!flag) {
             System.err.println("Error in "+this.getLabel());
-            System.exit(0);
+            System.exit(1);
         }
 
         this.writeSbml(bn);
 
-        System.exit(1);
+        System.exit(0);
     }
 
 }
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java
index 91445fe12..3ea0a5a0f 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java
@@ -104,7 +104,7 @@ public class SbmlSetEcsFromFile extends AbstractSbmlSetReaction {
 
         if(!flag) {
             System.err.println("Error in setting ECs");
-            System.exit(0);
+            System.exit(1);
         }
 
         this.writeSbml(bn);
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java
index c89e9871f..c7f3d665e 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetFormulasFromFile.java
@@ -108,12 +108,12 @@ public class SbmlSetFormulasFromFile extends AbstractSbmlSetMetabolite {
 
         if(!flag) {
             System.err.println("Error in SbmlSetFormula");
-            System.exit(0);
+            System.exit(1);
         }
 
         this.writeSbml(bn);
 
-        System.exit(1);
+        System.exit(0);
     }
 
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java
index ba657bb8d..37d47fe82 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetGprsFromFile.java
@@ -117,12 +117,12 @@ public class SbmlSetGprsFromFile  extends AbstractSbmlSetReaction {
 
         if(!flag) {
             System.err.println("Error in setting gene associations");
-            System.exit(0);
+            System.exit(1);
         }
 
         this.writeSbml(bn);
 
-        System.exit(1);
+        System.exit(0);
 
     }
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java
index 936a7358e..24195b8bd 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetNamesFromFile.java
@@ -106,13 +106,13 @@ public class SbmlSetNamesFromFile extends AbstractSbmlSetAny {
 
         if(!flag) {
             System.err.println("Error in SbmlSetNames");
-            System.exit(0);
+            System.exit(1);
         }
 
 
         this.writeSbml(bn);
 
-        System.exit(1);
+        System.exit(0);
 
 
     }
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java
index c8ef8a1f8..91e5f1380 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java
@@ -117,7 +117,7 @@ public class SbmlSetPathwaysFromFile extends AbstractSbmlSetReaction {
 
         if(!flag) {
             System.err.println("Error in "+this.getLabel());
-            System.exit(0);
+            System.exit(1);
         }
 
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java
index 6c7b88321..0b0059e3b 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java
@@ -112,11 +112,11 @@ public class SbmlSetRefsFromFile extends AbstractSbmlSetAny {
 
         if(!flag) {
             System.err.println("Error in "+this.getLabel());
-            System.exit(0);
+            System.exit(1);
         }
 
         this.writeSbml(bn);
 
-        System.exit(1);
+        System.exit(0);
     }
 }
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
index 591e9787f..5d6a38c03 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlToMetaboliteTable.java
@@ -112,7 +112,7 @@ public class SbmlToMetaboliteTable extends AbstractMet4jApplication {
         } catch (IOException e) {
             e.printStackTrace();
             System.err.println("Unable to read the sbml file " + this.sbml);
-            System.exit(0);
+            System.exit(1);
         }
 
         BioNetwork bn = null;
@@ -121,7 +121,7 @@ public class SbmlToMetaboliteTable extends AbstractMet4jApplication {
         } catch (Met4jSbmlReaderException e) {
             e.printStackTrace();
             System.err.println("Problem while reading the sbml file " + this.sbml);
-            System.exit(0);
+            System.exit(1);
         }
 
         return bn;
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java
index 5ae341159..cfa96fe68 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/bigg/GetModelProteome.java
@@ -96,7 +96,7 @@ public class GetModelProteome extends AbstractMet4jApplication {
         } catch (CmdLineException e) {
             System.err.println("Error in arguments");
             parser.printUsage(System.err);
-            System.exit(0);
+            System.exit(1);
         }
 
         f.run();
@@ -116,13 +116,13 @@ public class GetModelProteome extends AbstractMet4jApplication {
         } catch (MalformedURLException e) {
             e.printStackTrace();
             System.err.println("Malformed url : please check that the model id does not include spaces or odd characters");
-            System.exit(0);
+            System.exit(1);
         }
 
         Boolean check = this.checkConnection(urlGenes);
 
         if (!check) {
-            System.exit(0);
+            System.exit(1);
         }
 
         String jsonStringGenes = null;
@@ -131,7 +131,7 @@ public class GetModelProteome extends AbstractMet4jApplication {
         } catch (IOException e) {
             e.printStackTrace();
             System.err.println("Problem when uploading genes");
-            System.exit(0);
+            System.exit(1);
         }
 
         Set<Sequence> sequences = null;
@@ -140,7 +140,7 @@ public class GetModelProteome extends AbstractMet4jApplication {
         } catch (Exception e) {
             e.printStackTrace();
             System.err.println("Problem when reading genes json");
-            System.exit(0);
+            System.exit(1);
         }
 
         try {
@@ -148,7 +148,7 @@ public class GetModelProteome extends AbstractMet4jApplication {
         } catch (IOException e) {
             e.printStackTrace();
             System.err.println("Problem when writing the fasta file");
-            System.exit(0);
+            System.exit(1);
         }
 
 
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java
index de9482d71..53f2d5e5f 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/convert/FbcToNotes.java
@@ -97,7 +97,7 @@ public class FbcToNotes extends AbstractMet4jApplication {
         } catch (CmdLineException e) {
             System.err.println("Error in arguments");
             parser.printUsage(System.err);
-            System.exit(0);
+            System.exit(1);
         }
 
         f.run();
diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index e91a40d3f..6cd03ed94 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -529,18 +529,18 @@ public abstract class AbstractMet4jApplication {
                 this.printShortHeader();
                 System.err.println("Error in arguments");
                 parser.printUsage(System.err);
-                System.exit(0);
+                System.exit(1);
             } else {
                 this.printLongHeader();
                 parser.printUsage(System.err);
-                System.exit(1);
+                System.exit(0);
             }
         }
 
         if (this.h == true) {
             this.printLongHeader();
             parser.printUsage(System.err);
-            System.exit(1);
+            System.exit(0);
         }
     }
 
-- 
GitLab


From 5d8604b7fd1d6bddb04b0e151668640f6200e62d Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 12:52:13 +0200
Subject: [PATCH 64/83] Add underscore to randomly generated id

Otherwise, the SBML syntax checker returns an error
---
 .../inrae/toulouse/metexplore/met4j_core/biodata/BioEntity.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/met4j-core/src/main/java/fr/inrae/toulouse/metexplore/met4j_core/biodata/BioEntity.java b/met4j-core/src/main/java/fr/inrae/toulouse/metexplore/met4j_core/biodata/BioEntity.java
index 3d4fa6a1e..98afdd160 100755
--- a/met4j-core/src/main/java/fr/inrae/toulouse/metexplore/met4j_core/biodata/BioEntity.java
+++ b/met4j-core/src/main/java/fr/inrae/toulouse/metexplore/met4j_core/biodata/BioEntity.java
@@ -81,7 +81,7 @@ public abstract class BioEntity {
      */
     public BioEntity(String id, String name) {
         if (StringUtils.isVoid(id)) {
-            String newId = UUID.randomUUID().toString().replaceAll("-", "_");
+            String newId = "_"+UUID.randomUUID().toString().replaceAll("-", "_");
             this.id = newId;
         } else {
             this.id = id;
-- 
GitLab


From 90d6a692d4a4b0187410d565254d23cefa826ff4 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 12:57:59 +0200
Subject: [PATCH 65/83] doc

---
 .../metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java
index 3ea0a5a0f..bd483f3de 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetEcsFromFile.java
@@ -66,7 +66,7 @@ public class SbmlSetEcsFromFile extends AbstractSbmlSetReaction {
     public String getLongDescription() {
         return this.getShortDescription()+"\n"+this.setDescription+"\n" +
                 "The EC will be written in the SBML file in two locations:+\n" +
-                "- in the reaction notes (e.g. <p>EC_NUMBER: 2.4.2.14</p>\n" +
+                "- in the reaction notes (e.g. <p>EC_NUMBER: 2.4.2.14</p>)\n" +
                 "- as a reaction annotation (e.g. <rdf:li rdf:resource=\"http://identifiers.org/ec-code/2.4.2.14\"/>)";
     }
 
-- 
GitLab


From 4048b8d60d7b0d0f9913a71bb7b15822b0f5e0e2 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 13:36:36 +0200
Subject: [PATCH 66/83] remove logs

---
 .../met4j_io/tabulated/attributes/SetEcsFromFile.java           | 2 --
 1 file changed, 2 deletions(-)

diff --git a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetEcsFromFile.java b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetEcsFromFile.java
index dc26b9d9c..b727d3c71 100644
--- a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetEcsFromFile.java
+++ b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetEcsFromFile.java
@@ -86,8 +86,6 @@ public class SetEcsFromFile extends AbstractSetAttributesFromFile {
 
         String[] ecs = ec.split(";");
 
-        System.err.println("ec : "+ec+" l :"+ecs.length);
-
         return Arrays.stream(ecs).allMatch(e -> {
             Matcher m = patternEC.matcher(e);
             return m.matches();
-- 
GitLab


From c309e2d90baebe42f5cb0ce74c9e7c8ad20d0682 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 14:10:00 +0200
Subject: [PATCH 67/83] doc

---
 .../metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java
index ea1876fdb..a69383187 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/AbstractSbmlSetAny.java
@@ -65,7 +65,7 @@ public abstract class AbstractSbmlSetAny extends AbstractSbmlSet {
     public Boolean s=false;
 
     @ParameterType(name=Text)
-    @Option(name="-o", usage="[REACTION] Object type in the column id : REACTION;METABOLITE;PROTEIN;GENE;PATHWAY")
+    @Option(name="-o", usage="[REACTION] Object type in the column id : REACTION;METABOLITE;GENE;PATHWAY")
     public EntityType o= EntityType.REACTION;
 
     /**
-- 
GitLab


From 3620a76f2332bb5cda1ac95f78684172eb9e466f Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 14:17:56 +0200
Subject: [PATCH 68/83] remove bad annotation

---
 .../met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java        | 1 -
 1 file changed, 1 deletion(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java
index 91e5f1380..181b54ef1 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetPathwaysFromFile.java
@@ -54,7 +54,6 @@ public class SbmlSetPathwaysFromFile extends AbstractSbmlSetReaction {
     @Option(name="-cp", usage="[2] number of the column where are the pathways")
     public int colp=2;
 
-    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-sep", usage="[|] Separator of pathways in the tabulated file")
     public String sep = "|";
 
-- 
GitLab


From c679216063c00b45fb2a452422f4ac297a96bc42 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 15:55:09 +0200
Subject: [PATCH 69/83] check identifier in lower case

---
 .../met4j_io/tabulated/attributes/SetRefsFromFile.java          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetRefsFromFile.java b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetRefsFromFile.java
index ceecebf70..b692e5bf8 100644
--- a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetRefsFromFile.java
+++ b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetRefsFromFile.java
@@ -101,7 +101,7 @@ public class SetRefsFromFile extends AbstractSetAttributesFromFile {
 
         int n = 0;
 
-        if(! IdentifiersOrg.validIdentifiers.contains(ref)) {
+        if(! IdentifiersOrg.validIdentifiers.contains(ref.toLowerCase())) {
             System.err.println("Warning : the identifier "+ref+" is not a valid id in identifiers.org");
         }
 
-- 
GitLab


From e22bdb393e2320c112e6a8ba25b4a5a2b4ea4c84 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 15:55:23 +0200
Subject: [PATCH 70/83] put tests before help

---
 .../generic/AbstractMet4jApplication.java             | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index 6cd03ed94..67499946c 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -386,11 +386,6 @@ public abstract class AbstractMet4jApplication {
         root.appendChild(inputElements);
         root.appendChild(outputElements);
 
-        Element help = document.createElement("help");
-        Node cHelp = document.createCDATASection(this.getLongDescription());
-        help.appendChild(cHelp);
-        root.appendChild(help);
-
         if (testExists) {
             Element tests = document.createElement("tests");
             root.appendChild(tests);
@@ -399,6 +394,12 @@ public abstract class AbstractMet4jApplication {
                 tests.appendChild(newNode);
             }
         }
+
+        Element help = document.createElement("help");
+        Node cHelp = document.createCDATASection(this.getLongDescription());
+        help.appendChild(cHelp);
+        root.appendChild(help);
+
         document.appendChild(root);
 
         TransformerFactory transformerFactory = TransformerFactory.newInstance();
-- 
GitLab


From 133618522480a7081ee8f5bc3d8976f44749bb14 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Thu, 12 May 2022 15:56:39 +0200
Subject: [PATCH 71/83] exit with error when bad identifier

---
 .../met4j_io/tabulated/attributes/SetRefsFromFile.java           | 1 +
 1 file changed, 1 insertion(+)

diff --git a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetRefsFromFile.java b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetRefsFromFile.java
index b692e5bf8..12c46068d 100644
--- a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetRefsFromFile.java
+++ b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetRefsFromFile.java
@@ -103,6 +103,7 @@ public class SetRefsFromFile extends AbstractSetAttributesFromFile {
 
         if(! IdentifiersOrg.validIdentifiers.contains(ref.toLowerCase())) {
             System.err.println("Warning : the identifier "+ref+" is not a valid id in identifiers.org");
+            System.exit(1);
         }
 
         for(String id : this.getIdAttributeMap().keySet()) {
-- 
GitLab


From adf01f5c4d8b8cf132a97850a67eafc83413e9ba Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 13 May 2022 08:09:37 +0200
Subject: [PATCH 72/83] Change the pattern for setting inchis

---
 .../jsbml/reader/plugin/AnnotationParser.java | 442 +++++++++---------
 1 file changed, 216 insertions(+), 226 deletions(-)

diff --git a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/reader/plugin/AnnotationParser.java b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/reader/plugin/AnnotationParser.java
index e13041383..e00a37ee1 100644
--- a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/reader/plugin/AnnotationParser.java
+++ b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/reader/plugin/AnnotationParser.java
@@ -64,234 +64,224 @@ import static fr.inrae.toulouse.metexplore.met4j_core.utils.StringUtils.*;
  * because they do not extend the {@link fr.inrae.toulouse.metexplore.met4j_core.biodata.BioPhysicalEntity} class
  *
  * @author Benjamin
- * @since 3.0
  * @version $Id: $Id
+ * @since 3.0
  */
 public class AnnotationParser implements PackageParser, AdditionalDataTag, ReaderSBML1Compatible, ReaderSBML2Compatible,
-		ReaderSBML3Compatible {
-
-	/** Constant <code>ORIGIN="SBML"</code> */
-	public static final String ORIGIN = "SBML";
-
-	/**
-	 * The Jsbml Model
-	 */
-	public Model model;
-	/**
-	 * The BioNetwork
-	 */
-	public BioNetwork bionetwork;
-
-	/**
-	 * The user defined annotation pattern used in the regular expression of
-	 * this class
-	 */
-	public String annotationPattern;
-
-	/**
-	 * The default annotation pattern:
-	 * <ul>
-	 * <li>http://identifiers.org/([^/]+)/(.*)
-	 * </ul>
-	 * The first parenthesis group is
-	 */
-	public static final String defaultAnnotationPattern = "https?://identifiers.org/([^/]+)/(.*)";
-
-	/**
-	 * Constructor
-	 *
-	 * @param useDefault
-	 *            true to use the {@link #defaultAnnotationPattern}
-	 */
-	public AnnotationParser(boolean useDefault) {
-		if (useDefault)
-			this.setAnnotationPattern(defaultAnnotationPattern);
-	}
-
-	/**
-	 * Constructor
-	 *
-	 * @param pattern
-	 *            the user defined pattern
-	 */
-	public AnnotationParser(String pattern) {
-		this.annotationPattern = pattern;
-	}
-
-	/**
-	 * <p>getAssociatedPackageName.</p>
-	 *
-	 * @return a {@link java.lang.String} object.
-	 */
-	public String getAssociatedPackageName() {
-		return "annot";
-	}
-
-	/** {@inheritDoc} */
-	public boolean isPackageUseableOnModel(Model model) {
-		return true;
-	}
-
-	/**
-	 * {@inheritDoc}
-	 *
-	 * Parse all model entities to retrieve their annotations and extract the
-	 * desired information
-	 */
-	public void parseModel(Model model, BioNetwork bionetwork) {
-		System.err.println("Starting " + this.getAssociatedPackageName() + " plugin...");
-
-		this.setBionetwork(bionetwork);
-		this.setModel(model);
-
-		this.parseAnnotation(bionetwork,model.getAnnotation());
-		
-		this.parseSbmlAnnotations(bionetwork.getReactionsView());
-		this.parseSbmlAnnotations(bionetwork.getMetabolitesView());
-		this.parseSbmlAnnotations(bionetwork.getGenesView());
-		this.parseSbmlAnnotations(bionetwork.getCompartmentsView());
-	}
-
-	/**
-	 * 
-	 *            One of the different lists present in the {@link BioNetwork}
-	 *            class
-	 */
-	private void parseSbmlAnnotations(BioCollection<?> collection) {
-
-		for (BioEntity entry : collection) {
-
-			String id = entry.getId();
-
-			if(entry.getAttribute("oldId") != null)
-			{
-				id = (String) entry.getAttribute("oldId");
-			}
-
-			UniqueNamedSBase sbase = this.getModel().findUniqueNamedSBase(id);
-
-			if (sbase != null && !sbase.getAnnotation().isEmpty() && sbase.hasValidAnnotation()) {
-
-				this.parseAnnotation(entry, sbase.getAnnotation());
-
-			}
-		}
-	}
-
-	/**
-	 * Parse entity's annotation to extract external identifiers
-	 * 
-	 * @param annot
-	 *            the SBML annotation element
-	 */
-	private void parseAnnotation(BioEntity ent, Annotation annot) {
-
-		Matcher m;
-		for (CVTerm cv : annot.getListOfCVTerms()) {
-			
-			String qual;
-			
-			if(cv.isBiologicalQualifier()) {
-			
-				qual = cv.getBiologicalQualifierType().getElementNameEquivalent();
-			}
-			else {
-				qual = cv.getModelQualifierType().getElementNameEquivalent();
-			}
-			
-			for (String ress : cv.getResources()) {
-				if (this.getAnnotationPattern() != null
-						&& (m = Pattern.compile(this.getAnnotationPattern()).matcher(ress)).matches()) {
-
-					if (m.group(1).equalsIgnoreCase("ec-code") && ent instanceof BioReaction) {
-						String oldEc = ((BioReaction) ent).getEcNumber();
-						if(isVoid(oldEc))
-						{
-							((BioReaction) ent).setEcNumber(m.group(2));
-						}
-						else {
-							((BioReaction) ent).setEcNumber(oldEc+";"+m.group(2));
-						}
-					}
-					ent.addRef(m.group(1), m.group(2), 1, qual, ORIGIN);
-				}
-			}
-		}
-
-		String nonrdfAnnot = annot.getNonRDFannotationAsString();
-		if (ent instanceof BioMetabolite && nonrdfAnnot != null && !nonrdfAnnot.isEmpty()) {
-
-			String specialInchiPattern = "<in:inchi xmlns:in=\"([^\"]+)\">InChI=([^<]+)</in:inchi>";
-
-			m = Pattern.compile(specialInchiPattern, Pattern.DOTALL).matcher(nonrdfAnnot);
-
-			while (m.find()) {
-
-				if (m.group(1).equalsIgnoreCase("http://biomodels.net/inchi")) {
-					String inchi = m.group(2);
-					if (!ent.hasRef("inchi", inchi)) {
-						ent.addRef("inchi", inchi, 1, "is", ORIGIN);
-					}
-				}
-			}
-		}
-	}
-
-	/**
-	 * <p>Getter for the field <code>model</code>.</p>
-	 *
-	 * @return the model
-	 */
-	public Model getModel() {
-		return model;
-	}
-
-	/**
-	 * <p>Setter for the field <code>model</code>.</p>
-	 *
-	 * @param model
-	 *            the model to set
-	 */
-	public void setModel(Model model) {
-		this.model = model;
-	}
-
-	/**
-	 * <p>Getter for the field <code>bionetwork</code>.</p>
-	 *
-	 * @return the bionetwork
-	 */
-	public BioNetwork getBionetwork() {
-		return bionetwork;
-	}
-
-	/**
-	 * <p>Setter for the field <code>bionetwork</code>.</p>
-	 *
-	 * @param bionetwork
-	 *            the bionetwork to set
-	 */
-	public void setBionetwork(BioNetwork bionetwork) {
-		this.bionetwork = bionetwork;
-	}
-
-	/**
-	 * <p>Getter for the field <code>annotationPattern</code>.</p>
-	 *
-	 * @return the annotationPattern
-	 */
-	public String getAnnotationPattern() {
-		return annotationPattern;
-	}
-
-	/**
-	 * <p>Setter for the field <code>annotationPattern</code>.</p>
-	 *
-	 * @param annotationPattern
-	 *            the annotationPattern to set
-	 */
-	public void setAnnotationPattern(String annotationPattern) {
-		this.annotationPattern = annotationPattern;
-	}
+        ReaderSBML3Compatible {
+
+    /**
+     * Constant <code>ORIGIN="SBML"</code>
+     */
+    public static final String ORIGIN = "SBML";
+
+    /**
+     * The Jsbml Model
+     */
+    public Model model;
+    /**
+     * The BioNetwork
+     */
+    public BioNetwork bionetwork;
+
+    /**
+     * The user defined annotation pattern used in the regular expression of
+     * this class
+     */
+    public String annotationPattern;
+
+    /**
+     * The default annotation pattern:
+     * <ul>
+     * <li>http://identifiers.org/([^/]+)/(.*)
+     * </ul>
+     * The first parenthesis group is
+     */
+    public static final String defaultAnnotationPattern = "https?://identifiers.org/([^/]+)/(.*)";
+
+    /**
+     * Constructor
+     *
+     * @param useDefault true to use the {@link #defaultAnnotationPattern}
+     */
+    public AnnotationParser(boolean useDefault) {
+        if (useDefault)
+            this.setAnnotationPattern(defaultAnnotationPattern);
+    }
+
+    /**
+     * Constructor
+     *
+     * @param pattern the user defined pattern
+     */
+    public AnnotationParser(String pattern) {
+        this.annotationPattern = pattern;
+    }
+
+    /**
+     * <p>getAssociatedPackageName.</p>
+     *
+     * @return a {@link java.lang.String} object.
+     */
+    public String getAssociatedPackageName() {
+        return "annot";
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isPackageUseableOnModel(Model model) {
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     * <p>
+     * Parse all model entities to retrieve their annotations and extract the
+     * desired information
+     */
+    public void parseModel(Model model, BioNetwork bionetwork) {
+        System.err.println("Starting " + this.getAssociatedPackageName() + " plugin...");
+
+        this.setBionetwork(bionetwork);
+        this.setModel(model);
+
+        this.parseAnnotation(bionetwork, model.getAnnotation());
+
+        this.parseSbmlAnnotations(bionetwork.getReactionsView());
+        this.parseSbmlAnnotations(bionetwork.getMetabolitesView());
+        this.parseSbmlAnnotations(bionetwork.getGenesView());
+        this.parseSbmlAnnotations(bionetwork.getCompartmentsView());
+    }
+
+    /**
+     * One of the different lists present in the {@link BioNetwork}
+     * class
+     */
+    private void parseSbmlAnnotations(BioCollection<?> collection) {
+
+        for (BioEntity entry : collection) {
+
+            String id = entry.getId();
+
+            if (entry.getAttribute("oldId") != null) {
+                id = (String) entry.getAttribute("oldId");
+            }
+
+            UniqueNamedSBase sbase = this.getModel().findUniqueNamedSBase(id);
+
+            if (sbase != null && !sbase.getAnnotation().isEmpty() && sbase.hasValidAnnotation()) {
+
+                this.parseAnnotation(entry, sbase.getAnnotation());
+
+            }
+        }
+    }
+
+    /**
+     * Parse entity's annotation to extract external identifiers
+     *
+     * @param annot the SBML annotation element
+     */
+    private void parseAnnotation(BioEntity ent, Annotation annot) {
+
+        Matcher m;
+        for (CVTerm cv : annot.getListOfCVTerms()) {
+
+            String qual;
+
+            if (cv.isBiologicalQualifier()) {
+
+                qual = cv.getBiologicalQualifierType().getElementNameEquivalent();
+            } else {
+                qual = cv.getModelQualifierType().getElementNameEquivalent();
+            }
+
+            for (String ress : cv.getResources()) {
+                if (this.getAnnotationPattern() != null
+                        && (m = Pattern.compile(this.getAnnotationPattern()).matcher(ress)).matches()) {
+
+                    if (m.group(1).equalsIgnoreCase("ec-code") && ent instanceof BioReaction) {
+                        String oldEc = ((BioReaction) ent).getEcNumber();
+                        if (isVoid(oldEc)) {
+                            ((BioReaction) ent).setEcNumber(m.group(2));
+                        } else {
+                            ((BioReaction) ent).setEcNumber(oldEc + ";" + m.group(2));
+                        }
+                    }
+                    ent.addRef(m.group(1), m.group(2), 1, qual, ORIGIN);
+                }
+            }
+        }
+
+        String nonrdfAnnot = annot.getNonRDFannotationAsString();
+        if (ent instanceof BioMetabolite && nonrdfAnnot != null && !nonrdfAnnot.isEmpty()) {
+
+            String specialInchiPattern = "InChI=([^<]+)";
+
+            m = Pattern.compile(specialInchiPattern, Pattern.DOTALL).matcher(nonrdfAnnot);
+
+            while (m.find()) {
+                String inchi = m.group(1);
+                if (!ent.hasRef("inchi", inchi)) {
+                    ent.addRef("inchi", inchi, 1, "is", ORIGIN);
+                }
+            }
+        }
+    }
+
+    /**
+     * <p>Getter for the field <code>model</code>.</p>
+     *
+     * @return the model
+     */
+    public Model getModel() {
+        return model;
+    }
+
+    /**
+     * <p>Setter for the field <code>model</code>.</p>
+     *
+     * @param model the model to set
+     */
+    public void setModel(Model model) {
+        this.model = model;
+    }
+
+    /**
+     * <p>Getter for the field <code>bionetwork</code>.</p>
+     *
+     * @return the bionetwork
+     */
+    public BioNetwork getBionetwork() {
+        return bionetwork;
+    }
+
+    /**
+     * <p>Setter for the field <code>bionetwork</code>.</p>
+     *
+     * @param bionetwork the bionetwork to set
+     */
+    public void setBionetwork(BioNetwork bionetwork) {
+        this.bionetwork = bionetwork;
+    }
+
+    /**
+     * <p>Getter for the field <code>annotationPattern</code>.</p>
+     *
+     * @return the annotationPattern
+     */
+    public String getAnnotationPattern() {
+        return annotationPattern;
+    }
+
+    /**
+     * <p>Setter for the field <code>annotationPattern</code>.</p>
+     *
+     * @param annotationPattern the annotationPattern to set
+     */
+    public void setAnnotationPattern(String annotationPattern) {
+        this.annotationPattern = annotationPattern;
+    }
 
 }
-- 
GitLab


From 5acbe05d29f537c0984a6e791b3161be5cc96cf3 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Fri, 13 May 2022 08:10:10 +0200
Subject: [PATCH 73/83] Remove the exit when bad identifier

---
 .../met4j_io/tabulated/attributes/SetRefsFromFile.java           | 1 -
 1 file changed, 1 deletion(-)

diff --git a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetRefsFromFile.java b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetRefsFromFile.java
index 12c46068d..b692e5bf8 100644
--- a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetRefsFromFile.java
+++ b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/tabulated/attributes/SetRefsFromFile.java
@@ -103,7 +103,6 @@ public class SetRefsFromFile extends AbstractSetAttributesFromFile {
 
         if(! IdentifiersOrg.validIdentifiers.contains(ref.toLowerCase())) {
             System.err.println("Warning : the identifier "+ref+" is not a valid id in identifiers.org");
-            System.exit(1);
         }
 
         for(String id : this.getIdAttributeMap().keySet()) {
-- 
GitLab


From 28029376c2223118afeb7721ea65c572769479f9 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 17 May 2022 11:18:26 +0200
Subject: [PATCH 74/83] get  default value

---
 .../met4j_toolbox/generic/AbstractMet4jApplication.java          | 1 +
 1 file changed, 1 insertion(+)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index 67499946c..18013ad39 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -424,6 +424,7 @@ public abstract class AbstractMet4jApplication {
             param.setAttribute("name", o.get("name"));
             param.setAttribute("label", o.get("label"));
             param.setAttribute("argument", o.get("argument"));
+            param.setAttribute("value", o.get("default"));
 
             if (!o.get("type").equalsIgnoreCase("boolean")) {
                 param.setAttribute("optional", o.get("optional"));
-- 
GitLab


From b79516b58b3cf7eb0b8163520f9f93860afc7a95 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 17 May 2022 11:18:39 +0200
Subject: [PATCH 75/83] debug output

---
 .../metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java
index 2ecbe315e..22e04a304 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/ChokePoint.java
@@ -4,6 +4,7 @@ import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioMetabolite;
 import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioNetwork;
 import fr.inrae.toulouse.metexplore.met4j_core.biodata.BioReaction;
 import fr.inrae.toulouse.metexplore.met4j_core.biodata.collection.BioCollection;
+import fr.inrae.toulouse.metexplore.met4j_core.biodata.utils.BioReactionUtils;
 import fr.inrae.toulouse.metexplore.met4j_graph.computation.connect.weighting.DefaultWeightPolicy;
 import fr.inrae.toulouse.metexplore.met4j_graph.core.WeightingPolicy;
 import fr.inrae.toulouse.metexplore.met4j_graph.core.compound.CompoundGraph;
@@ -100,7 +101,7 @@ public class ChokePoint extends AbstractMet4jApplication {
         //export results
         System.err.println("Export results...");
         for (BioReaction r : choke) {
-            fw.write(r.getId() + "\t" + r.getName() + "\t" + r.toString() + "\n");
+            fw.write(r.getId() + "\t" + r.getName() + "\t" + BioReactionUtils.getEquation(r, false, false) + "\n");
         }
         System.err.println("done.");
         fw.close();
-- 
GitLab


From 078eb8c5f16db3b6f7b479d253358bde21bd23de Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 17 May 2022 11:50:51 +0200
Subject: [PATCH 76/83] debug annotation

---
 .../metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java
index 0b0059e3b..0f8be5550 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/attributes/SbmlSetRefsFromFile.java
@@ -55,7 +55,6 @@ public class SbmlSetRefsFromFile extends AbstractSbmlSetAny {
     @Option(name="-cr", usage="[2] number of the column where are the references")
     public int colRef=2;
 
-    @ParameterType(name= EnumParameterTypes.Integer)
     @Option(name="-ref", usage="Name of the ref. Must exist in identifiers.org", required = true)
     public String ref=null;
 
-- 
GitLab


From 7752d8bda4c312a724d81ba00d7779081c8beabf Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 17 May 2022 12:55:46 +0200
Subject: [PATCH 77/83] set inchi field

---
 .../met4j_io/jsbml/reader/plugin/AnnotationParser.java           | 1 +
 1 file changed, 1 insertion(+)

diff --git a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/reader/plugin/AnnotationParser.java b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/reader/plugin/AnnotationParser.java
index e00a37ee1..11dc21dc7 100644
--- a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/reader/plugin/AnnotationParser.java
+++ b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/reader/plugin/AnnotationParser.java
@@ -225,6 +225,7 @@ public class AnnotationParser implements PackageParser, AdditionalDataTag, Reade
                 String inchi = m.group(1);
                 if (!ent.hasRef("inchi", inchi)) {
                     ent.addRef("inchi", inchi, 1, "is", ORIGIN);
+                    ((BioMetabolite) ent).setInchi(inchi);
                 }
             }
         }
-- 
GitLab


From 9c0fb557a95a71b577da33eb4d732fe54da3d8b6 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 17 May 2022 12:57:57 +0200
Subject: [PATCH 78/83] test of inchi field

---
 .../met4j_io/jsbml/reader/plugin/AnnotationParserTest.java     | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/met4j-io/src/test/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/reader/plugin/AnnotationParserTest.java b/met4j-io/src/test/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/reader/plugin/AnnotationParserTest.java
index 16ef8c774..b947050b6 100644
--- a/met4j-io/src/test/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/reader/plugin/AnnotationParserTest.java
+++ b/met4j-io/src/test/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/reader/plugin/AnnotationParserTest.java
@@ -260,6 +260,9 @@ public class AnnotationParserTest {
 
 		assertEquals(refInchis, s1.getRefs());
 
+		System.err.println(s1.getInchi());
+
+		assertEquals("truc", s1.getInchi());
 	}
 
 }
-- 
GitLab


From a400671ecbdb533e4cb4de805a86cffb90fad3e5 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 17 May 2022 14:41:08 +0200
Subject: [PATCH 79/83] doc

---
 .../met4j_toolbox/networkAnalysis/DistanceMatrix.java           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java
index 68d959d9f..9d5da9e6b 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/DistanceMatrix.java
@@ -44,7 +44,7 @@ public class DistanceMatrix extends AbstractMet4jApplication {
     @Option(name = "-s", aliases = {"--side"}, usage = "an optional file containing list of side compounds to ignore")
     public String sideCompoundFile = null;
 
-    @Option(name = "-dw", aliases = {"--degree"}, usage = "penalize traversal of hubs by using degree square weighting", forbids = {"-w"})
+    @Option(name = "-dw", aliases = {"--degree"}, usage = "penalize traversal of hubs by using degree square weighting (-w must not be set)", forbids = {"-w"})
     public Boolean degree = false;
 
     @Format(name = EnumFormats.Tsv)
-- 
GitLab


From 2dd716967d0804c350a212262f778592e10d12be Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 17 May 2022 14:41:38 +0200
Subject: [PATCH 80/83] don't write inchi ref twice

---
 .../met4j_io/jsbml/writer/plugin/AnnotationWriter.java          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/writer/plugin/AnnotationWriter.java b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/writer/plugin/AnnotationWriter.java
index 1e971c1c1..e7eac5293 100644
--- a/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/writer/plugin/AnnotationWriter.java
+++ b/met4j-io/src/main/java/fr/inrae/toulouse/metexplore/met4j_io/jsbml/writer/plugin/AnnotationWriter.java
@@ -247,7 +247,7 @@ public class AnnotationWriter implements PackageWriter, AdditionalDataTag {
             addingLoop:
             for (BioRef r : refs) {
 
-                if (IdentifiersOrg.validIdentifiers.contains(r.getDbName().toLowerCase())){
+                if (IdentifiersOrg.validIdentifiers.contains(r.getDbName().toLowerCase()) && ! r.getDbName().equalsIgnoreCase("inchi")){
 
                     Qualifier qual;
 
-- 
GitLab


From 37c73b3448530891a30474abc3acca068697defb Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Tue, 17 May 2022 14:47:50 +0200
Subject: [PATCH 81/83] remove unused forbids

---
 .../metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java
index 519a667c2..20c0512e4 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/networkAnalysis/CompoundNet.java
@@ -60,12 +60,12 @@ public class CompoundNet extends AbstractMet4jApplication {
     @Option(name = "-ri", aliases = {"--removeIsolatedNodes"}, usage = "remove isolated nodes", required = false)
     public boolean removeIsolated = false;
 
-    @Option(name = "-dw", aliases = {"--degreeWeights"}, usage = "penalize traversal of hubs by using degree square weighting", forbids = {"-cw", "-sw"})
+    @Option(name = "-dw", aliases = {"--degreeWeights"}, usage = "penalize traversal of hubs by using degree square weighting", forbids = {"-cw"})
     public Boolean degree = false;
 
     @ParameterType(name=EnumParameterTypes.InputFile)
     @Format(name=EnumFormats.Tsv)
-    @Option(name = "-cw", aliases = {"--customWeights"}, usage = "an optional file containing weights for compound pairs", forbids = {"-dw", "-sw"})
+    @Option(name = "-cw", aliases = {"--customWeights"}, usage = "an optional file containing weights for compound pairs", forbids = {"-dw"})
     public String weightFile = null;
 
     @Option(name = "-un", aliases = {"--undirected"}, usage = "create as undirected", required = false)
-- 
GitLab


From 33c5ff5f9412415ac07ae682ad4ec83498738fce Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Mon, 23 May 2022 10:57:06 +0200
Subject: [PATCH 82/83] debug galaxy optional file

---
 .../met4j_toolbox/generic/AbstractMet4jApplication.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index 18013ad39..c7fb32bd4 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -325,7 +325,13 @@ public abstract class AbstractMet4jApplication {
             } else {
 
                 if (o.get("optional").equals("true")) {
-                    commandText += "#if str($" + o.get("name") + "):\n";
+                   if(o.get("type").startsWith("input")) {
+                        // commandText += "#if str($" + o.get("name") + ") != \"None\":\n";
+                        commandText += "#if str($" + o.get("name") + ") != 'None':\n";
+                    }
+                    else {
+                        commandText += "#if str($" + o.get("name") + "):\n";
+                    }
                 }
 
                 commandText += " " + o.get("argument") + " " + "\"$" + o.get("name") + "\"\n";
-- 
GitLab


From 72d8b81ef928580368675138a12ad1f438e03e30 Mon Sep 17 00:00:00 2001
From: lcottret <ludovic.cottret@inrae.fr>
Date: Mon, 23 May 2022 14:24:20 +0200
Subject: [PATCH 83/83] debug numeric parameters

---
 .../met4j_toolbox/generic/AbstractMet4jApplication.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
index c7fb32bd4..d7ca24738 100644
--- a/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
+++ b/met4j-toolbox/src/main/java/fr/inrae/toulouse/metexplore/met4j_toolbox/generic/AbstractMet4jApplication.java
@@ -325,11 +325,12 @@ public abstract class AbstractMet4jApplication {
             } else {
 
                 if (o.get("optional").equals("true")) {
-                   if(o.get("type").startsWith("input")) {
+                    if (o.get("type").startsWith("input")) {
                         // commandText += "#if str($" + o.get("name") + ") != \"None\":\n";
                         commandText += "#if str($" + o.get("name") + ") != 'None':\n";
-                    }
-                    else {
+                    } else if (o.get("type").equalsIgnoreCase("Integer") || o.get("type").equalsIgnoreCase("Float")) {
+                        commandText += "#if str($" + o.get("name") + ") != 'nan':\n";
+                    } else {
                         commandText += "#if str($" + o.get("name") + "):\n";
                     }
                 }
-- 
GitLab