# needs: pathway-tools -python-local-only-non-strict -lisp import pythoncyc import sys import re import pdb meta = pythoncyc.select_organism('meta') pythoncyc.sendQueryToPTools("(select-organism :org-id 'META)") def getReaInfos(pwy): meta.allpwy = meta.all_pathways() #pwy = "ANAEROFRUCAT-PWY" #pwy = "ALL-CHORISMATE-PWY" if meta[pwy] == None: print(pwy, "Pathway does not exist") return ([[], []]) rea_list = [] if meta[pwy].key_reactions != None: keyRea_list = meta[pwy].key_reactions else: keyRea_list = [] check_list = meta[pwy]["reaction_list"] if meta[pwy].sub_pathways != None: check_list.extend( [p for p in meta[pwy].sub_pathways if p not in check_list]) isSuperPwy = False while len(check_list) > 0: ptmp = check_list.pop()
# needs: pathway-tools -python-local-only-non-strict -lisp import pythoncyc meta = pythoncyc.select_organism('meta') pythoncyc.sendQueryToPTools("(select-organism :org-id 'META)") #query = "|Amino-Acid-Biosynthesis|" #query = "|Nucleotide-Biosynthesis|" #query = "|Cofactor-Biosynthesis|" #query = "|Carbohydrates-Degradation|" query = "|Polyamine-Biosynthesis|" instances = meta.get_class_all_instances(query) ofile = open("/home/jo/pwy.csv", "w") ofile.write("id" + "\t" + "name" + "\t" + "ec" + "\t" + "rea" + "\n") for idx, pwy in enumerate(instances): if meta[pwy] == None: print(pwy, "Pathway does not exist") continue rea_list = meta[pwy]["reaction_list"] ec_list = [] reaid_list = [] for r in rea_list: ec = meta[r]["ec_number"] reaid = r if ec == None: continue ec_nr=len(ec)