pheatmap


Namepheatmap JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/Ann-Holmes/pheatmap
Summarypheatmap for Python
upload_time2023-01-02 18:36:23
maintainer
docs_urlNone
authorZongliang Hou
requires_python>=3.8, <4
license
keywords heatmap gene expression visualization
VCS
bugtrack_url
requirements cycler fonttools kiwisolver matplotlib numpy packaging pandas Pillow pyparsing python-dateutil pytz six
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pheatmap

[![codecov](https://codecov.io/gh/Ann-Holmes/pheatmap/branch/main/graph/badge.svg?token=MTTRU5NLA8)](https://codecov.io/gh/Ann-Holmes/pheatmap)

`pheatmap` for Python.

You can create a heatmap with its annotation bars, just like pheatmap of R. Documnets at [here](https://pheatmap.readthedocs.io/en/latest/)

## Requirements

`pheatmap` need `python` > 3.8, and `numpy`, `pandas` and `matplolib`. 

## Install

You can install `pheatmap` by `pip`. 

```shell
pip install pheatmap
```

Run the command above, `pip` will automatically install `numpy`, `pandas` and `matplolib`.

## Usage

```python
import numpy as np
import pandas as pd
from pheatmap import pheatmap

nrows, ncols = 10, 10
mat = np.linspace(-1, 1, nrows * ncols).reshape(nrows, ncols)
rownames = ["abcdefghig"[i % 10] for i in np.arange(nrows)]
colnames = ["xyz"[i % 3] for i in np.arange(ncols)]

mat = pd.DataFrame(mat, index=rownames, columns=colnames)

anno_row = pd.DataFrame(dict(
    anno1=np.linspace(0, 10, nrows),
    anno2=["CNS"[i % 3] for i in np.arange(nrows)]
))
anno_col = pd.DataFrame(dict(
    anno3=np.linspace(0, 20, ncols),
    anno4=["ABC"[i % 3] for i in np.arange(ncols)]
))

anno_row_cmaps = {"anno1": "Blues", "anno2": "Set1"}
anno_col_cmaps = {"anno3": "Purples", "anno4": "Set3"}

fig = pheatmap(
    self.mat, annotation_row=self.anno_row, annotation_col=self.anno_col,
    annotation_row_cmaps=self.anno_row_cmaps, annotation_col_cmaps=self.anno_col_cmaps
)
fig.savefig("tests/pheatmap.png")
```

Run the above code at the ipython or jupyter notebook. You can see the fellow heatmap with its
annotation bars. 

![heatmap](https://raw.githubusercontent.com/Ann-Holmes/pheatmap/main/pic/pheatmap.png)

Also, you can save the figure to file. For example, save the figure to `PDF` file. 

```python
fig.savefig("pheatmap.pdf")
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Ann-Holmes/pheatmap",
    "name": "pheatmap",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8, <4",
    "maintainer_email": "",
    "keywords": "heatmap,gene,expression,visualization",
    "author": "Zongliang Hou",
    "author_email": "zonglianghou@163.com",
    "download_url": "https://files.pythonhosted.org/packages/c4/77/62d8e5f76bfe06f337e1569fe2ed66efe5d76eefb9f6194427ca00a15880/pheatmap-1.0.1.tar.gz",
    "platform": null,
    "description": "# pheatmap\n\n[![codecov](https://codecov.io/gh/Ann-Holmes/pheatmap/branch/main/graph/badge.svg?token=MTTRU5NLA8)](https://codecov.io/gh/Ann-Holmes/pheatmap)\n\n`pheatmap` for Python.\n\nYou can create a heatmap with its annotation bars, just like pheatmap of R. Documnets at [here](https://pheatmap.readthedocs.io/en/latest/)\n\n## Requirements\n\n`pheatmap` need `python` > 3.8, and `numpy`, `pandas` and `matplolib`. \n\n## Install\n\nYou can install `pheatmap` by `pip`. \n\n```shell\npip install pheatmap\n```\n\nRun the command above, `pip` will automatically install `numpy`, `pandas` and `matplolib`.\n\n## Usage\n\n```python\nimport numpy as np\nimport pandas as pd\nfrom pheatmap import pheatmap\n\nnrows, ncols = 10, 10\nmat = np.linspace(-1, 1, nrows * ncols).reshape(nrows, ncols)\nrownames = [\"abcdefghig\"[i % 10] for i in np.arange(nrows)]\ncolnames = [\"xyz\"[i % 3] for i in np.arange(ncols)]\n\nmat = pd.DataFrame(mat, index=rownames, columns=colnames)\n\nanno_row = pd.DataFrame(dict(\n    anno1=np.linspace(0, 10, nrows),\n    anno2=[\"CNS\"[i % 3] for i in np.arange(nrows)]\n))\nanno_col = pd.DataFrame(dict(\n    anno3=np.linspace(0, 20, ncols),\n    anno4=[\"ABC\"[i % 3] for i in np.arange(ncols)]\n))\n\nanno_row_cmaps = {\"anno1\": \"Blues\", \"anno2\": \"Set1\"}\nanno_col_cmaps = {\"anno3\": \"Purples\", \"anno4\": \"Set3\"}\n\nfig = pheatmap(\n    self.mat, annotation_row=self.anno_row, annotation_col=self.anno_col,\n    annotation_row_cmaps=self.anno_row_cmaps, annotation_col_cmaps=self.anno_col_cmaps\n)\nfig.savefig(\"tests/pheatmap.png\")\n```\n\nRun the above code at the ipython or jupyter notebook. You can see the fellow heatmap with its\nannotation bars. \n\n![heatmap](https://raw.githubusercontent.com/Ann-Holmes/pheatmap/main/pic/pheatmap.png)\n\nAlso, you can save the figure to file. For example, save the figure to `PDF` file. \n\n```python\nfig.savefig(\"pheatmap.pdf\")\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "pheatmap for Python",
    "version": "1.0.1",
    "split_keywords": [
        "heatmap",
        "gene",
        "expression",
        "visualization"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "12754b384579247b3a11f0310c839d0adab28ada701db27b5d3a9070e7e8f66c",
                "md5": "8f6da075ff0a7958ea49a0b4630d5550",
                "sha256": "1a5da6c4026c96f7b2259b67c35e97cf3b379134671886dd8c018222c7409db6"
            },
            "downloads": -1,
            "filename": "pheatmap-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8f6da075ff0a7958ea49a0b4630d5550",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8, <4",
            "size": 14912,
            "upload_time": "2023-01-02T18:36:22",
            "upload_time_iso_8601": "2023-01-02T18:36:22.524359Z",
            "url": "https://files.pythonhosted.org/packages/12/75/4b384579247b3a11f0310c839d0adab28ada701db27b5d3a9070e7e8f66c/pheatmap-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c47762d8e5f76bfe06f337e1569fe2ed66efe5d76eefb9f6194427ca00a15880",
                "md5": "cec1ef157523d06fb13d66c5985ebfac",
                "sha256": "8c83bf267c20b1652c1961d8b13ccb0799da317a108254f81a73cd0799b17f0e"
            },
            "downloads": -1,
            "filename": "pheatmap-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "cec1ef157523d06fb13d66c5985ebfac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8, <4",
            "size": 13341,
            "upload_time": "2023-01-02T18:36:23",
            "upload_time_iso_8601": "2023-01-02T18:36:23.742622Z",
            "url": "https://files.pythonhosted.org/packages/c4/77/62d8e5f76bfe06f337e1569fe2ed66efe5d76eefb9f6194427ca00a15880/pheatmap-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-02 18:36:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Ann-Holmes",
    "github_project": "pheatmap",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "cycler",
            "specs": [
                [
                    "==",
                    "0.11.0"
                ]
            ]
        },
        {
            "name": "fonttools",
            "specs": [
                [
                    "==",
                    "4.37.1"
                ]
            ]
        },
        {
            "name": "kiwisolver",
            "specs": [
                [
                    "==",
                    "1.4.4"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    "==",
                    "3.5.3"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.23.2"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "21.3"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "1.4.3"
                ]
            ]
        },
        {
            "name": "Pillow",
            "specs": [
                [
                    "==",
                    "9.2.0"
                ]
            ]
        },
        {
            "name": "pyparsing",
            "specs": [
                [
                    "==",
                    "3.0.9"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "==",
                    "2.8.2"
                ]
            ]
        },
        {
            "name": "pytz",
            "specs": [
                [
                    "==",
                    "2022.2.1"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.16.0"
                ]
            ]
        }
    ],
    "lcname": "pheatmap"
}
        
Elapsed time: 0.08764s