# HG changeset patch # User francesco_lapi # Date 1759925127 0 # Node ID f32d3c9089fc2cda6e2edb3ef13c2481a1bd9ce5 # Parent 0cb727788cae0b6ccd019d8196e71f45fff4fbbc Uploaded diff -r 0cb727788cae -r f32d3c9089fc COBRAxy/ras_generator.py --- a/COBRAxy/ras_generator.py Tue Oct 07 10:31:33 2025 +0000 +++ b/COBRAxy/ras_generator.py Wed Oct 08 12:05:27 2025 +0000 @@ -297,10 +297,6 @@ orig_gene_list=dataset.index.copy() dataset.index = [str(el.split(".")[0]) for el in dataset.index] - if any(dataset.index.duplicated(keep=False)): - list_str=", ".join(orig_gene_list[dataset.index.duplicated(keep=False)]) - raise ValueError(f"ERROR: Duplicate entries in the gene dataset. The following genes are duplicated: "+list_str) - #load GPR rules rules = load_custom_rules() @@ -310,6 +306,13 @@ rules_total_string+=rule.replace("(","").replace(")","") + " " rules_total_string=list(set(rules_total_string.split(" "))) + if any(dataset.index.duplicated(keep=False)): + genes_duplicates=orig_gene_list[dataset.index.duplicated(keep=False)] + genes_duplicates_in_model=[elem for elem in genes_duplicates if elem in rules_total_string] + if len(genes_duplicates_in_model)>0:#metabolic genes have duplicated entries in the dataset + list_str=", ".join(genes_duplicates_in_model) + raise ValueError(f"ERROR: Duplicate entries in the gene dataset present in one or more GPR. The following metabolic genes are duplicated: "+list_str) + #check if nan value must be ignored in the GPR if ARGS.none: # #e.g. (A or nan --> A)