Mercurial > repos > bimib > cobraxy
comparison COBRAxy/ras_generator.py @ 513:b02cfa3b36dd draft default tip
Uploaded
author | francesco_lapi |
---|---|
date | Wed, 08 Oct 2025 13:01:47 +0000 |
parents | f32d3c9089fc |
children |
comparison
equal
deleted
inserted
replaced
512:f32d3c9089fc | 513:b02cfa3b36dd |
---|---|
307 rules_total_string=list(set(rules_total_string.split(" "))) | 307 rules_total_string=list(set(rules_total_string.split(" "))) |
308 | 308 |
309 if any(dataset.index.duplicated(keep=False)): | 309 if any(dataset.index.duplicated(keep=False)): |
310 genes_duplicates=orig_gene_list[dataset.index.duplicated(keep=False)] | 310 genes_duplicates=orig_gene_list[dataset.index.duplicated(keep=False)] |
311 genes_duplicates_in_model=[elem for elem in genes_duplicates if elem in rules_total_string] | 311 genes_duplicates_in_model=[elem for elem in genes_duplicates if elem in rules_total_string] |
312 | |
312 if len(genes_duplicates_in_model)>0:#metabolic genes have duplicated entries in the dataset | 313 if len(genes_duplicates_in_model)>0:#metabolic genes have duplicated entries in the dataset |
313 list_str=", ".join(genes_duplicates_in_model) | 314 list_str=", ".join(genes_duplicates_in_model) |
314 raise ValueError(f"ERROR: Duplicate entries in the gene dataset present in one or more GPR. The following metabolic genes are duplicated: "+list_str) | 315 list_genes=f"ERROR: Duplicate entries in the gene dataset present in one or more GPR. The following metabolic genes are duplicated: "+list_str |
316 raise ValueError(list_genes) | |
317 else: | |
318 list_str=", ".join(genes_duplicates) | |
319 list_genes=f"INFO: Duplicate entries in the gene dataset. The following genes are duplicated in the dataset but not mentioned in the GPRs: "+list_str | |
320 utils.logWarning(list_genes,ARGS.out_log) | |
315 | 321 |
316 #check if nan value must be ignored in the GPR | 322 #check if nan value must be ignored in the GPR |
317 if ARGS.none: | 323 if ARGS.none: |
318 # #e.g. (A or nan --> A) | 324 # #e.g. (A or nan --> A) |
319 ignore_nan = True | 325 ignore_nan = True |
333 | 339 |
334 #report genes not present in the data | 340 #report genes not present in the data |
335 if len(genes_not_mapped)>0: | 341 if len(genes_not_mapped)>0: |
336 genes_not_mapped_str=", ".join(genes_not_mapped) | 342 genes_not_mapped_str=", ".join(genes_not_mapped) |
337 utils.logWarning( | 343 utils.logWarning( |
338 f"The following genes are mentioned in the GPR rules but don't appear in the dataset: "+genes_not_mapped_str, | 344 f"INFO: The following genes are mentioned in the GPR rules but don't appear in the dataset: "+genes_not_mapped_str, |
339 ARGS.out_log) | 345 ARGS.out_log) |
340 | 346 |
341 print("Execution succeeded") | 347 print("Execution succeeded") |
342 | 348 |
343 ############################################################################### | 349 ############################################################################### |