harmony-pytorch


Nameharmony-pytorch JSON
Version 0.1.8 PyPI version JSON
download
home_pagehttps://github.com/lilab-bcb/harmony-pytorch
SummaryPytorch implementation of Harmony algorithm on single-cell sequencing data integration
upload_time2024-01-07 21:36:56
maintainer
docs_urlNone
authorYiming Yang, Bo Li
requires_python~=3.8
license
keywords single-cell genomics data integration
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Harmony-Pytorch
---------------

|PyPI| |Conda| |Python| |License|

.. |PyPI| image:: https://img.shields.io/pypi/v/harmony-pytorch.svg
   :target: https://pypi.org/project/harmony-pytorch

.. |Conda| image:: https://img.shields.io/conda/v/bioconda/harmony-pytorch
   :target: https://anaconda.org/bioconda/harmony-pytorch

.. |Python| image:: https://img.shields.io/pypi/pyversions/harmony-pytorch.svg
   :target: https://pypi.org/project/harmony-pytorch

.. |License| image:: https://img.shields.io/github/license/lilab-bcb/harmony-pytorch
   :target: https://github.com/lilab-bcb/harmony-pytorch/blob/master/LICENSE

This is a Pytorch implementation of Harmony algorithm on single-cell sequencing data integration. Please see `Ilya Korsunsky et al., 2019 <https://www.nature.com/articles/s41592-019-0619-0>`_ for details.

Installation
^^^^^^^^^^^^^

This package is published on PyPI::

	pip install harmony-pytorch


Usage
^^^^^^^^

General Case
##############

Given an embedding ``X`` as a N-by-d matrix in numpy array structure (N for number of cells, d for embedding components) and cell attributes as a Data Frame ``df_metadata``, use Harmony for data integration as the following::

	from harmony import harmonize
	Z = harmonize(X, df_metadata, batch_key = 'Channel')


where ``Channel`` is the attribute in ``df_metadata`` for batches.

Alternatively, if there are multiple attributes for batches, write::

	Z = harmonize(X, df_metadata, batch_key = ['Lab', 'Date'])

Input as MultimodalData Object
###############################

It's easy for Harmony-pytorch to work with count matrix data structure from `PegasusIO <https://pegasusio.readthedocs.io>`_ package. Let ``data`` be a MultimodalData object in Python::

    from harmony import harmonize
    Z = harmonize(data.obsm['X_pca'], data.obs, batch_key = 'Channel')
    data.obsm['X_pca_harmony'] = Z

This will calculate the harmonized PCA matrix for the default UnimodalData of ``data``.

Given a UnimodalData object ``unidata``, you can also use the code above to perform Harmony algorithm: simply substitute ``unidata`` for ``data`` there.

Input as AnnData Object
##########################

It's easy for Harmony-pytorch to work with annotated count matrix data structure from `anndata <https://icb-anndata.readthedocs-hosted.com/en/stable/index.html>`_ package. Let ``adata`` be an AnnData object in Python::

	from harmony import harmonize
	Z = harmonize(adata.obsm['X_pca'], adata.obs, batch_key = '<your-batch-key>')
	adata.obsm['X_harmony'] = Z

where ``<your-batch-key>`` should be replaced by the actual batch key attribute name in your data.

For details about ``AnnData`` data structure, please refer to its `documentation <https://icb-anndata.readthedocs-hosted.com/en/stable/anndata.AnnData.html>`_.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lilab-bcb/harmony-pytorch",
    "name": "harmony-pytorch",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": "",
    "keywords": "single-cell genomics data integration",
    "author": "Yiming Yang, Bo Li",
    "author_email": "yang.yihming@gmail.com, lijiganjun@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8d/df/71fe694d70ff148db2364c4118a6bbd37e598be269be471ed3d2f6bfee1a/harmony-pytorch-0.1.8.tar.gz",
    "platform": null,
    "description": "Harmony-Pytorch\n---------------\n\n|PyPI| |Conda| |Python| |License|\n\n.. |PyPI| image:: https://img.shields.io/pypi/v/harmony-pytorch.svg\n   :target: https://pypi.org/project/harmony-pytorch\n\n.. |Conda| image:: https://img.shields.io/conda/v/bioconda/harmony-pytorch\n   :target: https://anaconda.org/bioconda/harmony-pytorch\n\n.. |Python| image:: https://img.shields.io/pypi/pyversions/harmony-pytorch.svg\n   :target: https://pypi.org/project/harmony-pytorch\n\n.. |License| image:: https://img.shields.io/github/license/lilab-bcb/harmony-pytorch\n   :target: https://github.com/lilab-bcb/harmony-pytorch/blob/master/LICENSE\n\nThis is a Pytorch implementation of Harmony algorithm on single-cell sequencing data integration. Please see `Ilya Korsunsky et al., 2019 <https://www.nature.com/articles/s41592-019-0619-0>`_ for details.\n\nInstallation\n^^^^^^^^^^^^^\n\nThis package is published on PyPI::\n\n\tpip install harmony-pytorch\n\n\nUsage\n^^^^^^^^\n\nGeneral Case\n##############\n\nGiven an embedding ``X`` as a N-by-d matrix in numpy array structure (N for number of cells, d for embedding components) and cell attributes as a Data Frame ``df_metadata``, use Harmony for data integration as the following::\n\n\tfrom harmony import harmonize\n\tZ = harmonize(X, df_metadata, batch_key = 'Channel')\n\n\nwhere ``Channel`` is the attribute in ``df_metadata`` for batches.\n\nAlternatively, if there are multiple attributes for batches, write::\n\n\tZ = harmonize(X, df_metadata, batch_key = ['Lab', 'Date'])\n\nInput as MultimodalData Object\n###############################\n\nIt's easy for Harmony-pytorch to work with count matrix data structure from `PegasusIO <https://pegasusio.readthedocs.io>`_ package. Let ``data`` be a MultimodalData object in Python::\n\n    from harmony import harmonize\n    Z = harmonize(data.obsm['X_pca'], data.obs, batch_key = 'Channel')\n    data.obsm['X_pca_harmony'] = Z\n\nThis will calculate the harmonized PCA matrix for the default UnimodalData of ``data``.\n\nGiven a UnimodalData object ``unidata``, you can also use the code above to perform Harmony algorithm: simply substitute ``unidata`` for ``data`` there.\n\nInput as AnnData Object\n##########################\n\nIt's easy for Harmony-pytorch to work with annotated count matrix data structure from `anndata <https://icb-anndata.readthedocs-hosted.com/en/stable/index.html>`_ package. Let ``adata`` be an AnnData object in Python::\n\n\tfrom harmony import harmonize\n\tZ = harmonize(adata.obsm['X_pca'], adata.obs, batch_key = '<your-batch-key>')\n\tadata.obsm['X_harmony'] = Z\n\nwhere ``<your-batch-key>`` should be replaced by the actual batch key attribute name in your data.\n\nFor details about ``AnnData`` data structure, please refer to its `documentation <https://icb-anndata.readthedocs-hosted.com/en/stable/anndata.AnnData.html>`_.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Pytorch implementation of Harmony algorithm on single-cell sequencing data integration",
    "version": "0.1.8",
    "project_urls": {
        "Homepage": "https://github.com/lilab-bcb/harmony-pytorch"
    },
    "split_keywords": [
        "single-cell",
        "genomics",
        "data",
        "integration"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75da42486f1c79b6f2db9140ee23161791e5b25d9369f30c1d9f67b67f3eb4bf",
                "md5": "0a96f6dbae1a65574d9e6d71d61c75df",
                "sha256": "1f92f6145ea93225b0226fda9da5bdd442e411d14ff402052afae0fde7fd1452"
            },
            "downloads": -1,
            "filename": "harmony_pytorch-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0a96f6dbae1a65574d9e6d71d61c75df",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 8474,
            "upload_time": "2024-01-07T21:36:54",
            "upload_time_iso_8601": "2024-01-07T21:36:54.488914Z",
            "url": "https://files.pythonhosted.org/packages/75/da/42486f1c79b6f2db9140ee23161791e5b25d9369f30c1d9f67b67f3eb4bf/harmony_pytorch-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ddf71fe694d70ff148db2364c4118a6bbd37e598be269be471ed3d2f6bfee1a",
                "md5": "6c97161169f87d576716e03dd1c0ab08",
                "sha256": "1b097906d49c6ed9dde6cf234f7d987fb49a3b649b8a1323d99e6ea71b5b7df2"
            },
            "downloads": -1,
            "filename": "harmony-pytorch-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "6c97161169f87d576716e03dd1c0ab08",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 8373,
            "upload_time": "2024-01-07T21:36:56",
            "upload_time_iso_8601": "2024-01-07T21:36:56.059462Z",
            "url": "https://files.pythonhosted.org/packages/8d/df/71fe694d70ff148db2364c4118a6bbd37e598be269be471ed3d2f6bfee1a/harmony-pytorch-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-07 21:36:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lilab-bcb",
    "github_project": "harmony-pytorch",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "harmony-pytorch"
}
        
Elapsed time: 0.18600s