# HG changeset patch
# User francesco_lapi
# Date 1757077342 0
# Node ID 52658ddcaa5d9e52adf6ba4bee152bafaa1f846a
# Parent  f73d57641124042a2a351f7634bf10f0214b46a6
Uploaded
diff -r f73d57641124 -r 52658ddcaa5d COBRAxy/custom_data_generator.py
--- a/COBRAxy/custom_data_generator.py	Fri Sep 05 10:53:36 2025 +0000
+++ b/COBRAxy/custom_data_generator.py	Fri Sep 05 13:02:22 2025 +0000
@@ -31,9 +31,10 @@
                         help="Model name (default or custom)")
     
     parser.add_argument("--medium_selector", type=str, required=True,
-                        help="Medium selection option (default/custom)")
-    parser.add_argument("--medium", type=str,
-                        help="Custom medium file if medium_selector=Custom")
+                        help="Medium selection option")
+
+    parser.add_argument("--gene_format", type=str, default="Default",
+                        help="Gene nomenclature format: Default (original), ENSNG, HGNC_SYMBOL, HGNC_ID, ENTREZ")
     
     parser.add_argument("--out_tabular", type=str,
                         help="Output file for the merged dataset (CSV or XLSX)")
@@ -226,7 +227,27 @@
             raise utils.DataErr(ARGS.model, f"failed loading built-in model: {e}")
 
     # Determine final model name: explicit --name overrides, otherwise use the model id
+    
     model_name = ARGS.name if ARGS.name else ARGS.model
+    
+    
+    if ARGS.name == "ENGRO2" and ARGS.medium_selector != "Default":
+        df_mediums = pd.read_csv(ARGS.tool_dir + "/local/medium/medium.csv", index_col = 0)
+        ARGS.medium_selector = ARGS.medium_selector.replace("_", " ")
+        medium = df_mediums[[ARGS.medium_selector]]
+        medium = medium[ARGS.medium_selector].to_dict()
+
+        # Set all reactions to zero in the medium
+        for rxn_id, _ in model.medium.items():
+            model.reactions.get_by_id(rxn_id).lower_bound = float(0.0)
+        
+        # Set medium conditions
+        for reaction, value in medium.items():
+            if value is not None:
+                model.reactions.get_by_id(reaction).lower_bound = -float(value)
+
+    if ARGS.name == "ENGRO2" and ARGS.gene_format != "Default":
+        utils.convert_genes(model, ARGS.gene_format)
 
     # generate data
     rules = generate_rules(model, asParsed = False)
diff -r f73d57641124 -r 52658ddcaa5d COBRAxy/custom_data_generator.xml
--- a/COBRAxy/custom_data_generator.xml	Fri Sep 05 10:53:36 2025 +0000
+++ b/COBRAxy/custom_data_generator.xml	Fri Sep 05 13:02:22 2025 +0000
@@ -23,9 +23,6 @@
             --model $cond_model.model_selector
             --name $cond_model.model_selector
         #end if
-        #if $cond_model.medium_selector == 'Custom'
-            --medium $cond_model.medium
-        #end if
 
         --gene_format $gene_format
         
@@ -42,9 +39,6 @@
                 
                 
                     
-                    
-                        
-                    
                 
             
 
@@ -54,14 +48,10 @@
                 
                     
                         
-                        
                     
                     
                         
                     
-                    
-                        
-                    
                 
             
 
@@ -72,24 +62,20 @@
                 
                     
                         
-                        
                     
                     
                         
                     
-                    
-                        
-                    
                 
             
         
 
         
             
-            
-            
-            
-            
+            
+            
+            
+            
         
     
 
diff -r f73d57641124 -r 52658ddcaa5d COBRAxy/marea_macros.xml
--- a/COBRAxy/marea_macros.xml	Fri Sep 05 10:53:36 2025 +0000
+++ b/COBRAxy/marea_macros.xml	Fri Sep 05 13:02:22 2025 +0000
@@ -28,7 +28,6 @@
         
             
             
-