diff COBRAxy/ras_generator.py @ 309:38c9a958ea78 draft

Uploaded
author francesco_lapi
date Thu, 22 May 2025 16:03:37 +0000
parents 0025449eadba
children
line wrap: on
line diff
--- a/COBRAxy/ras_generator.py	Tue May 20 16:01:21 2025 +0000
+++ b/COBRAxy/ras_generator.py	Thu May 22 16:03:37 2025 +0000
@@ -8,6 +8,7 @@
 import utils.general_utils as utils
 import utils.rule_parsing as ruleUtils
 from typing import Union, Optional, List, Dict, Tuple, TypeVar
+import os
 
 ERRORS = []
 ########################## argparse ##########################################
@@ -212,7 +213,7 @@
     Returns:
         dict: A dictionary containing gene data with gene IDs as keys and corresponding values.
     """
-    args = process_args()    
+ 
     for i in range(len(gene)):
         tmp = gene.iloc[i, 0]
         gene.iloc[i, 0] = tmp.strip().split('.')[0]
@@ -227,16 +228,16 @@
     if gene_dup:
         if gene_custom == None:
 
-            if str(args.rules_selector) == 'HMRcore':
-                gene_in_rule = pk.load(open(args.tool_dir + '/local/pickle files/HMRcore_genes.p', 'rb'))
+            if str(ARGS.rules_selector) == 'HMRcore':
+                gene_in_rule = pk.load(open(ARGS.tool_dir + '/local/pickle files/HMRcore_genes.p', 'rb'))
             
-            elif str(args.rules_selector) == 'Recon':
-                gene_in_rule = pk.load(open(args.tool_dir + '/local/pickle files/Recon_genes.p', 'rb'))
+            elif str(ARGS.rules_selector) == 'Recon':
+                gene_in_rule = pk.load(open(ARGS.tool_dir + '/local/pickle files/Recon_genes.p', 'rb'))
             
-            elif str(args.rules_selector) == 'ENGRO2':
-                gene_in_rule = pk.load(open(args.tool_dir + '/local/pickle files/ENGRO2_genes.p', 'rb'))
+            elif str(ARGS.rules_selector) == 'ENGRO2':
+                gene_in_rule = pk.load(open(ARGS.tool_dir + '/local/pickle files/ENGRO2_genes.p', 'rb'))
 
-            utils.logWarning(f"{args.tool_dir}'/local/pickle files/ENGRO2_genes.p'", ARGS.out_log)
+            utils.logWarning(f"{ARGS.tool_dir}'/local/pickle files/ENGRO2_genes.p'", ARGS.out_log)
 
             gene_in_rule = gene_in_rule.get(type_gene)
         
@@ -662,7 +663,7 @@
     # get args from frontend (related xml)
     global ARGS
     ARGS = process_args(args)
-    print(ARGS.rules_selector)
+
     # read dataset
     dataset = read_dataset(ARGS.input, "dataset")
     dataset.iloc[:, 0] = (dataset.iloc[:, 0]).astype(str)
@@ -672,6 +673,7 @@
 
     # handle custom models
     model :utils.Model = ARGS.rules_selector
+
     if model is utils.Model.Custom:
         rules = load_custom_rules()
         reactions = list(rules.keys())
@@ -703,4 +705,4 @@
 
 ###############################################################################
 if __name__ == "__main__":
-    main()
\ No newline at end of file
+    main()