if kegg_id is not None: node_colors[kegg_id] = cmap(color(dsi.data[0, n])) with open(os.path.join(_pathomx_tempdir, 'kegg-pathway-data.txt'), 'w') as tmp: tmp.write('#hsa\tData\n') for k, c in list(node_colors.items()): tmp.write('%s\t%s\n' % (k, c[0])) m = MultipartEncoder( fields={ 'map': config['kegg_pathway_id'], 'mapping_list': ('filename', open(os.path.join(_pathomx_tempdir, 'kegg-pathway-data.txt'), 'r')), 'mode': 'color', 'submit': 'Exec', } ) r = requests.post(url, data=m, headers={'Content-Type': m.content_type}) html = r.text from pathomx.displayobjects import Html # We've got the html page; pull out the image # <img src="/tmp/mark_pathway13818418802193/hsa05200.1.png" name="pathwayimage" usemap="#mapdata" border="0" /> m = re.search('\<img src="(.*)" name="pathwayimage"', html) img = m.group(1) m = re.search('^KEGG PATHWAY: (.*)$', html, flags=re.MULTILINE) title = m.group(1) output_html = '<html><body><img src="http://www.kegg.jp%s"></body></html>' % img View = Html(output_html)
tmp.write('#hsa\tData\n') for k, c in list(node_colors.items()): tmp.write('%s\t%s\n' % (k, c[0])) m = MultipartEncoder( fields={ 'map': config['kegg_pathway_id'], 'mapping_list': ('filename', open(os.path.join(_pathomx_tempdir, 'kegg-pathway-data.txt'), 'r')), 'mode': 'color', 'submit': 'Exec', }) r = requests.post(url, data=m, headers={'Content-Type': m.content_type}) html = r.text from pathomx.displayobjects import Html # We've got the html page; pull out the image # <img src="/tmp/mark_pathway13818418802193/hsa05200.1.png" name="pathwayimage" usemap="#mapdata" border="0" /> m = re.search('\<img src="(.*)" name="pathwayimage"', html) img = m.group(1) m = re.search('^KEGG PATHWAY: (.*)$', html, flags=re.MULTILINE) title = m.group(1) output_html = '<html><body><img src="http://www.kegg.jp%s"></body></html>' % img View = Html(output_html)