diff COBRAxy/custom_data_generator_beta.py @ 444:06564187fba3 draft

Uploaded
author francesco_lapi
date Thu, 11 Sep 2025 09:03:10 +0000
parents 00a78da611ba
children c3bb75ce07e6
line wrap: on
line diff
--- a/COBRAxy/custom_data_generator_beta.py	Wed Sep 10 16:50:16 2025 +0000
+++ b/COBRAxy/custom_data_generator_beta.py	Thu Sep 11 09:03:10 2025 +0000
@@ -173,26 +173,26 @@
             if value is not None:
                 model.reactions.get_by_id(reaction).lower_bound = -float(value)
 
-    if ARGS.name == "ENGRO2" and ARGS.gene_format != "Default":
+    #if ARGS.name == "ENGRO2" and ARGS.gene_format != "Default":
+    #    logging.basicConfig(level=logging.INFO)
+    #    logger = logging.getLogger(__name__)
+
+        #model = modelUtils.translate_model_genes(
+        #    model=model,
+        #    mapping_df= pd.read_csv(ARGS.tool_dir + "/local/mappings/genes_human.csv"), dtype={'entrez_id': str},
+        #    target_nomenclature=ARGS.gene_format.replace("HGNC_", "HGNC "),
+        #    source_nomenclature='HGNC_ID',
+        #    logger=logger
+        #)
+        #model = modelUtils.convert_genes(model, ARGS.gene_format.replace("HGNC_", "HGNC "))
+    
+    if (ARGS.name == "Recon" or ARGS.name == "ENGRO2") and ARGS.gene_format != "Default":
         logging.basicConfig(level=logging.INFO)
         logger = logging.getLogger(__name__)
 
         model = modelUtils.translate_model_genes(
             model=model,
-            mapping_df= pd.read_csv(ARGS.tool_dir + "/local/mappings/genes_human.csv"),
-            target_nomenclature=ARGS.gene_format.replace("HGNC_", "HGNC "),
-            source_nomenclature='HGNC_ID',
-            logger=logger
-        )
-        #model = modelUtils.convert_genes(model, ARGS.gene_format.replace("HGNC_", "HGNC "))
-    
-    if ARGS.name == "Recon" and ARGS.gene_format != "Default":
-        logging.basicConfig(level=logging.INFO)
-        logger = logging.getLogger(__name__)
-
-        model = modelUtils.translate_model_genes(
-            model=model,
-            mapping_df= pd.read_csv(ARGS.tool_dir + "/local/mappings/genes_human.csv"),
+            mapping_df= pd.read_csv(ARGS.tool_dir + "/local/mappings/genes_human.csv", dtype={'entrez_id': str}),
             target_nomenclature=ARGS.gene_format.replace("HGNC_", "HGNC "),
             source_nomenclature='HGNC_symbol',
             logger=logger