import KGML_parser from KGML_scrape import retrieve_KEGG_pathway from KGML_vis import KGMLCanvas # Get list of pathway elements to enhance glyc_path = retrieve_KEGG_pathway('ko00010') tca_path = retrieve_KEGG_pathway('ko00020') enhance_list = [] for pathway in (glyc_path, tca_path): for e in pathway.entries.values(): enhance_list.extend(e.name.split()) enhance_list = set(enhance_list) # Get the pathway we want to render, and make all the lines # that are also in glycolysis or TCA pathways thicker met_pathway = retrieve_KEGG_pathway('ko01100') mod_list = [e for e in met_pathway.entries.values() if \ len(set(e.name.split()).intersection(enhance_list))] for e in mod_list: for g in e.graphics: g.width = 10 kgml_map = KGMLCanvas(met_pathway, show_maps=True) kgml_map.draw('ex3_thick.pdf') # Thin out any lines that aren't in the glycolysis/TCA pathways mod_list = [e for e in met_pathway.entries.values() if \ not len(set(e.name.split()).intersection(enhance_list)) \ and e.type != 'map'] for e in mod_list: for g in e.graphics: g.width = .4 kgml_map.draw('ex3_thin.pdf') # Or turn them grey, maybe: for e in mod_list: for g in e.graphics: g.fgcolor = '#CCCCCC' kgml_map.draw('ex3_grey.pdf')