{ "info": { "author": "Elmar Bucher", "author_email": "ulmusfagus@zoho.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3.6", "Topic :: Multimedia :: Graphics", "Topic :: Scientific/Engineering :: Bio-Informatics", "Topic :: Scientific/Engineering :: Visualization" ], "description": "# BokehHeat\n\n## Abstract\n\nBokehheat provides a python3, bokeh based, interactive\ncategorical dendrogram and heatmap plotting implementation.\n\n+ Minimal requirement: python 3.6\n+ Dependencies: bokeh, pandas, scipy\n+ Programmer: bue, jenny\n+ Date origin: 2018-08\n+ License: >= GPLv3\n+ User manual: this README file\n+ Source code: [https://gitlab.com/biotransistor/bokehheat](https://gitlab.com/biotransistor/bokehheat)\n\nAvailable bokehheat plots are:\n+ heat.cdendro: an interactive categorical dendrogram plot implementation.\n+ heat.bbar: an interactive boolean bar plot implementation.\n+ heat.cbar: an interactive categorical bar plot implementation.\n+ heat.qbar: an interactive quantitative bar plot implementation.\n+ heat.heatmap: an interactive heatmap implementation.\n+ heat.clustermap: an interactive cluster heatmap implementation which combines\n heat.cdendro, heat.bbar, heat.cbar, heat.qbar and heat.heatmap under the hood.\n\n## Example Results\n\nFor the real interactive experience please clone or download this repository\nand open theclustermap.html file with your favorite web browser\n(we recommend [FireFox](https://www.mozilla.org/en-US/firefox/developer/)).\n\n![heat.clustermap image](theclustermap.png)\n\n**Figure:** This is a poor, static heat.clustermap html result screenshot.\n\n\n## HowTo Guide\n\nHow to install bokehheat?\n```bash\npip3 install bokehheat\n```\n\nHow to load the bokehheat library?\n```python\nfrom bokehheat import heat\n```\n\nHowto get reference information about how to use each bokehheat module?\n```python\nfrom bokehheat import heat\n\nhelp(heat.cdendro)\nhelp(heat.bbar)\nhelp(heat.cbar)\nhelp(heat.qbar)\nhelp(heat.heatmap)\nhelp(heat.clustermap)\n```\n\nHowto integrate bokehheat plots into [pweave](https://github.com/mpastell/Pweave) \ndocuments?\n```python\nfrom pweave.bokeh import output_pweave, show\n\noutput_pweave()\no_clustermap, ls_xaxis, ls_yaxis = heat.clustermap(...)\nshow(o_clustermap)\n```\n\n## Tutorial\nThis tutorial guides you through a cluster heatmap generation process.\n\n1. Load libraries needed for this tutorial:\n ```python\n # library\n from bokehheat import heat\n from bokeh.io import show\n from bokeh.palettes import Reds9, YlGn8, Colorblind8\n import numpy as np\n import pandas as pd\n ```\n\n1. Prepare data:\n ```python\n # generate test data\n ls_sample = ['sampleA','sampleB','sampleC','sampleD','sampleE','sampleF','sampleG','sampleH']\n ls_variable = ['geneA','geneB','geneC','geneD','geneE','geneF','geneG','geneH', 'geneI']\n ar_z = np.random.rand(8,9)\n df_matrix = pd.DataFrame(ar_z)\n df_matrix.index = ls_sample\n df_matrix.columns = ls_variable\n df_matrix.index.name = 'y'\n df_matrix.columns.name = 'x'\n\n # generate some sample annotation\n df_sample = pd.DataFrame({\n 'y': ls_sample,\n 'age_year': list(np.random.randint(0,101, 8)),\n 'sampletype': ['LumA','LumA','LumA','LumB','LumB','Basal','Basal','Basal'],\n 'sampletype_color': ['Cyan','Cyan','Cyan','Blue','Blue','Red','Red','Red'],\n })\n df_sample.index = df_sample.y\n\n # generate some gene annotation\n df_variable = pd.DataFrame({\n 'x': ls_variable,\n 'genereal': list(np.random.random(9) * 2 - 1),\n 'genetype': ['Lig','Lig','Lig','Lig','Lig','Lig','Rec','Rec','Rec'],\n 'genetype_color': ['Yellow','Yellow','Yellow','Yellow','Yellow','Yellow','Brown','Brown','Brown'],\n })\n df_variable.index = df_variable.x\n ```\n\n1. Generate categorical and quantitative sample and gene\n annotation tuple of tuples:\n ```python\n t_ycat = (df_sample, ['sampletype'], ['sampletype_color'])\n t_yquant = (df_sample, ['age_year'], [0], [128], [YlGn8])\n t_xcat = (df_variable, ['genetype'], ['genetype_color'])\n t_xquant = (df_variable, ['genereal'], [-1], [1], [Colorblind8])\n tt_catquant = (t_ycat, t_yquant, t_xquant, t_xcat)\n ```\n\n1. Generate the cluster heatmap:\n ```python\n s_file = \"theclustermap.html\"\n o_clustermap, ls_xaxis, ls_yaxis = heat.clustermap(\n df_matrix = df_matrix,\n ls_color_palette = Reds9,\n r_low = 0,\n r_high = 1,\n s_z = \"log2\",\n tt_axis_annot = tt_catquant,\n b_ydendo = True,\n b_xdendo = True,\n #s_method='single',\n #s_metric='euclidean',\n #b_optimal_ordering=True,\n #i_px = 80,\n #i_height = 8,\n #i_width = 8,\n s_filename=s_file,\n s_filetitel=\"the Clustermap\",\n )\n ```\n\n1. Display the result:\n ```python\n print(f\"check out: {s_file}\")\n print(f\"y axis is: {ls_yaxis}\")\n print(f\"x axis is: {ls_xaxis}\")\n\n show(o_clustermap)\n ```\nThe resulting clustermap should look something like the example result\nin the section above.\n\n## Discussion\n\nIn bioinformatics a clustered heatmap is a common plot to present\ngene expression data from many patient samples.\nThere are well established open source clustering software kits like\n[Cluster and TreeView](http://bonsai.hgc.jp/%7Emdehoon/software/cluster/index.html)\nfor producing and investigating such heatmaps.\n\n### Static cluster heaptmap implementations\n\nThere exist a wealth of\n[R](https://cran.r-project.org/) and R/[bioconductor](https://www.bioconductor.org/) \npackages with static cluster heatmaps functions (e.g. heatmap.2 from the gplots library), \neach one with his own pros and cons.\n\nIn Python the static cluster heatmap landscape looks much more deserted.\nThere are some ancient [mathplotlib](https://matplotlib.org/) based implementations\nlike this [active state recipe](https://code.activestate.com/recipes/578175-hierarchical-clustering-heatmap-python/)\nor the [heatmapcluster](https://github.com/WarrenWeckesser/heatmapcluster) library.\nThere is the [seaborn clustermap](https://seaborn.pydata.org/generated/seaborn.clustermap.html) implementation,\nwhich looks good but might need hours of tweaking to get an agreeable plot with all the needed information out.\n\nSo, static heatmaps are not really a tool for exploring data.\n\n### Interactive cluster heatmap implementations\n\nThere exist d3heatmap a R/d3.js based interactive cluster heatmap packages.\nAnd heatmaply, a R/plotly based package.\nOr on a more basic level R/plotly based cluster heatmaps can be written\nwith the ggdendro and ggplot2 library.\n\nBut I have not found a full fledged python based interactive cluster heatmap library.\nNeither Python/[plottly](https://plot.ly/) nor Python/[bokeh](https://bokeh.pydata.org/en/latest/) based.\nThe only Python/bokeh based cluster heatmap implementation I found was this\n[listing](https://russodanielp.github.io/plotting-a-heatmap-with-a-dendrogram-using-bokeh.html)\nfrom Daniel Russo.\n\n### Synopsis\n\nAll in all, all of this implementations were not really what I was looking for.\nThat is why I rolled my own.\nBokehheat is a Python/[bokeh](https://bokeh.pydata.org/en/latest/) based interactive cluster heatmap library.\n\nThe challenges this implementation tried to solve are,\nthe library should be:\n+ easy to use with [pandas](https://pandas.pydata.org/) datafarmes.\n+ interactive, this means the results should be hover and zoomable plots.\n+ output should be in computer platform independent and easy accessible format,\n like java script spiced up html file, which can be opened in any webbrowser.\n+ possibility to add as many categorical and quantitative y and x annotation bars as wished.\n+ possibility to cluster y and/or x axis.\n+ snappy interactivity, even with big datasets with lot of samples and genes.\n (It turns out bokehheat is ok with hundreds of samples and genes but noth with thousends.)\n\n#### Future directions\n\nAn [altair](https://altair-viz.github.io/) based cluster heatmap implementation.\nI think that this will be the future. Check out Jake VanderPlas talk\n[Python Visualization Landscape](https://www.youtube.com/watch?v=FytuB8nFHPQ)\nfrom the PyCon 2017 in Portland Oregon (USA).\n\n## Contributions\n\n+ Implementation: Elmar Bucher\n+ Documentation: Jennifer Eng, Elmar Bucher\n+ Helpfull discussion: Mark Dane, Daniel Derrick, Hongmei Zhang,\n Annette Kolodize, Jim Korkola, Laura Heiser\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/biotransistor/bokehheat", "keywords": "visualization bokeh dendrogram cladogram heatmap", "license": "GPL>=3", "maintainer": "", "maintainer_email": "", "name": "bokehheat", "package_url": "https://pypi.org/project/bokehheat/", "platform": "", "project_url": "https://pypi.org/project/bokehheat/", "project_urls": { "Bug Reports": "https://gitlab.com/biotransistor/bokehheat/issues", "Funding": "https://donate.doctorswithoutborders.org", "Homepage": "https://gitlab.com/biotransistor/bokehheat", "Source": "https://gitlab.com/biotransistor/bokehheat/" }, "release_url": "https://pypi.org/project/bokehheat/0.0.3/", "requires_dist": [ "bokeh", "pandas", "scipy" ], "requires_python": ">=3.6", "summary": "A python3 bokeh based categorical dendrogram and heatmap plotting library.", "version": "0.0.3" }, "last_serial": 4310729, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "b1ad4ab50569decab5d5272332916352", "sha256": "c85524780be2802206d9e059421b21e82822914168273b8338ec2fbdba61a5ec" }, "downloads": -1, "filename": "bokehheat-0.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b1ad4ab50569decab5d5272332916352", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 10440, "upload_time": "2018-08-29T18:24:00", "url": "https://files.pythonhosted.org/packages/da/be/7e0cd720e1489123ae2d459a78b901a9fbbe7fa4e1571c3190219b9e529d/bokehheat-0.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b585817eefb9dcd024b6a8af085e4227", "sha256": "3de1c19919357ff9bae58c76e56f8646fed08c2fbc4022f7c9d72b325ffca7ab" }, "downloads": -1, "filename": "bokehheat-0.0.0.tar.gz", "has_sig": false, "md5_digest": "b585817eefb9dcd024b6a8af085e4227", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 13234, "upload_time": "2018-08-29T18:24:01", "url": "https://files.pythonhosted.org/packages/ac/f9/86cdff59d3cb3f27e63d11a44e362079a10a1ebb23c29215e93364e1b24b/bokehheat-0.0.0.tar.gz" } ], "0.0.1": [ { "comment_text": "", "digests": { "md5": "739aace13f742bef7df90c2d8ea0deea", "sha256": "100be0b009f4a962743d9bb0163ee89458e3d2341175c61967ef29750bc7690b" }, "downloads": -1, "filename": "bokehheat-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "739aace13f742bef7df90c2d8ea0deea", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 11039, "upload_time": "2018-09-01T23:13:50", "url": "https://files.pythonhosted.org/packages/ce/a2/175ff21155c63babe4a039d499b509239903cf3a11c7226fde7c53f11d10/bokehheat-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a90248698aceb9c3720edefec8a56e9a", "sha256": "e4ac5446f28deb3e82cc4173588c7004e6bf9d0816db5ee4665c8d16c3a93378" }, "downloads": -1, "filename": "bokehheat-0.0.1.tar.gz", "has_sig": false, "md5_digest": "a90248698aceb9c3720edefec8a56e9a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 14081, "upload_time": "2018-09-01T23:13:52", "url": "https://files.pythonhosted.org/packages/ae/d0/51e1f475589f3461a1de1a6bce19dbb3939d73a2a15d5e21adb5585d7e5d/bokehheat-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "4ddd127c930ce2761b82a02f2951ced5", "sha256": "767108aabb09f509370bde7cfd8937e048d737710f285b6efc75f07cdeedc213" }, "downloads": -1, "filename": "bokehheat-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "4ddd127c930ce2761b82a02f2951ced5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 11576, "upload_time": "2018-09-08T02:12:18", "url": "https://files.pythonhosted.org/packages/9e/14/e18f529ef3858e5d187c2dd236207b8cd91691186b97fe623452db793557/bokehheat-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "48ceab79675de6f1d3941597893cc41b", "sha256": "7e526061d2745936ce55c7ba1e2114606da0aa527935891b90e75319cb367c84" }, "downloads": -1, "filename": "bokehheat-0.0.2.tar.gz", "has_sig": false, "md5_digest": "48ceab79675de6f1d3941597893cc41b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 15684, "upload_time": "2018-09-08T02:12:20", "url": "https://files.pythonhosted.org/packages/51/ca/2a3439411fd8c22d1efd83254b12bbf4b2937ef4f95f26b992beae1c5e2b/bokehheat-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "18b06fc4d108596f749898417e08a0a4", "sha256": "280e40d728299b055f5a73a5f41ac3859c2972c8e0608f74111069f83268b40d" }, "downloads": -1, "filename": "bokehheat-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "18b06fc4d108596f749898417e08a0a4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 11563, "upload_time": "2018-09-26T00:38:10", "url": "https://files.pythonhosted.org/packages/a5/c7/f87c5297a9db1c214b7facbe084c76fe56e255925c843f9d89ee45b0dfda/bokehheat-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6951d1f4e4e13b59139cee5719d637e3", "sha256": "f14afc9e449de8cd2f13fe588c9e7133e370bb702593660cd4e073dfef8c6046" }, "downloads": -1, "filename": "bokehheat-0.0.3.tar.gz", "has_sig": false, "md5_digest": "6951d1f4e4e13b59139cee5719d637e3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 15668, "upload_time": "2018-09-26T00:38:13", "url": "https://files.pythonhosted.org/packages/e4/d9/ae0f3cd2eaec402008a9bb6297e5be8332d25c4accf6900895f0ab169ee0/bokehheat-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "18b06fc4d108596f749898417e08a0a4", "sha256": "280e40d728299b055f5a73a5f41ac3859c2972c8e0608f74111069f83268b40d" }, "downloads": -1, "filename": "bokehheat-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "18b06fc4d108596f749898417e08a0a4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 11563, "upload_time": "2018-09-26T00:38:10", "url": "https://files.pythonhosted.org/packages/a5/c7/f87c5297a9db1c214b7facbe084c76fe56e255925c843f9d89ee45b0dfda/bokehheat-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6951d1f4e4e13b59139cee5719d637e3", "sha256": "f14afc9e449de8cd2f13fe588c9e7133e370bb702593660cd4e073dfef8c6046" }, "downloads": -1, "filename": "bokehheat-0.0.3.tar.gz", "has_sig": false, "md5_digest": "6951d1f4e4e13b59139cee5719d637e3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 15668, "upload_time": "2018-09-26T00:38:13", "url": "https://files.pythonhosted.org/packages/e4/d9/ae0f3cd2eaec402008a9bb6297e5be8332d25c4accf6900895f0ab169ee0/bokehheat-0.0.3.tar.gz" } ] }