biothings-client


Namebiothings-client JSON
Version 0.3.1 PyPI version JSON
download
home_page
SummaryPython Client for BioThings API services.
upload_time2023-11-13 23:24:20
maintainer
docs_urlNone
authorCyrus Afrasiabi, Xinghua Zhou, Everaldo Rodolpho
requires_python>=2.7
licenseBSD-3-Clause
keywords biology variant gene taxon species drug annotation web service client api myvariant mygene
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            .. image:: https://badge.fury.io/py/biothings-client.svg
    :target: https://pypi.python.org/pypi/biothings-client

.. image:: https://img.shields.io/pypi/pyversions/biothings-client.svg
    :target: https://pypi.python.org/pypi/biothings-client

.. image:: https://img.shields.io/pypi/format/biothings-client.svg
    :target: https://pypi.python.org/pypi/biothings-client

.. image:: https://github.com/biothings/biothings_client.py/actions/workflows/build-package.yml/badge.svg
    :target: https://github.com/biothings/biothings_client.py/actions/workflows/build-package.yml

.. image:: https://github.com/biothings/biothings_client.py/actions/workflows/run-tests.yml/badge.svg
    :target: https://github.com/biothings/biothings_client.py/actions/workflows/run-tests.yml

.. image:: https://api.codacy.com/project/badge/Grade/2b716becb6e948a6b576f278e64dd81f
   :alt: Codacy Badge
   :target: https://www.codacy.com/gh/biothings/biothings_client.py/dashboard?utm_source=github.com&utm_medium=referral&utm_content=biothings/biothings_client.py&utm_campaign=Badge_Grade

.. image:: https://app.codacy.com/project/badge/Coverage/2b716becb6e948a6b576f278e64dd81f
   :alt: Codacy Coverage Badge
   :target: https://app.codacy.com/gh/biothings/biothings_client.py/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage

.. image:: https://img.shields.io/pypi/dm/biothings_client.svg
   :alt: PyPI Downloads
   :target: https://pypistats.org/packages/biothings_client

.. image:: https://readthedocs.org/projects/biothings-clientpy/badge/?version=latest
   :alt: Documentation Status
   :target: https://biothings-clientpy.readthedocs.io/en/latest/?badge=latest

Intro
=====

*biothings_client* is an easy-to-use Python wrapper to access any Biothings.api_
-based backend service. Currently, the following clients are available:

    * gene - The client for MyGene.Info_, which provides access to gene objects.
    * variant - The client MyVariant.Info_, which provides access to genetic variant objects.
    * chem - The client for MyChem.Info_, which provides access to chemical/drug objects.
    * disease - The client for MyDisease.Info_, which provides access to disease objects.
    * geneset - The client for MyGeneset.Info_, which provides access to geneset/pathway objects.
    * taxon - The client for t.biothings.io_, which provides access to taxon objects.

.. _t.biothings.io: https://t.biothings.io
.. _Biothings.api: https://biothings.io
.. _MyGene.Info: https://mygene.info
.. _MyVariant.Info: https://myvariant.info
.. _MyChem.Info: https://mychem.info
.. _MyDisease.Info: https://mydisease.info
.. _MyGeneset.Info: https://mygeneset.info
.. _requests: https://pypi.python.org/pypi/requests

Requirements
============
    python >=2.7 (including all python3 versions)

    (It may still work under python 2.6, but it's not supported any more.)

    requests_ (install using "pip install requests")

Optional dependencies
======================
    * `pandas <http://pandas.pydata.org>`_ (install using "pip install pandas") is required for returning a list of variant objects as `DataFrame <http://pandas.pydata.org/pandas-docs/stable/dsintro.html#dataframe>`_.
    * `requests_cache <https://pypi.python.org/pypi/requests-cache>`_ (install using "pip install requests_cache") is required for local caching of API requests.

Installation
=============

    Option 1
          ::

           pip install biothings_client

    Option 2
          download/extract the source code and run::

           python setup.py install

    Option 3
          install the latest code directly from the repository::

            pip install -e git+https://github.com/biothings/biothings_client.py#egg=biothings_client

Version history
===============

    `CHANGES.txt <https://raw.githubusercontent.com/biothings/biothings_client.py/master/CHANGES.txt>`_

Tutorial
=========

    See the `quick start tutorial <https://biothings-clientpy.readthedocs.io/en/latest/doc/Quick-Start.html>`_ at the `biothings_client doc page <https://biothings-clientpy.readthedocs.io/en/latest/index.html>`_.

Documentation
=============

    https://biothings-clientpy.readthedocs.io

Usage
=====

.. code-block:: python

    In [1]: from biothings_client import get_client

    # get a client for variant objects

    In [2]: mv = get_client("variant")

    In [3]: mv.getvariant("chr7:g.140453134T>C")
    Out[3]:  #output below is collapsed
    {"_id": "chr7:g.140453134T>C",
     "_version": 1,
     "chrom": "7",
     "cadd": {...},
     "clinvar": {...},
     "cosmic": {...},
     "dbnsfp": {...},
     "dbsnp": {...},
     "docm": {...},
     "hg19": {'end': 140453134, 'start': 140453134},
     "mutdb": {...},
     "snpeff": {...},
     "vcf": {
        "alt": "C",
        "position": "140453134",
        "ref": "T"
     }}

    # get a client for gene objects

    In [7]: mg = get_client("gene")

    In [8]: mg.getgene(1017, 'name,symbol,refseq')
    Out[8]:
    {'_id': '1017',
     '_score': 21.03413,
     'name': 'cyclin dependent kinase 2',
     'refseq': {'genomic': ['NC_000012.12', 'NC_018923.2', 'NG_034014.1'],
      'protein': ['NP_001277159.1',
       'NP_001789.2',
       'NP_439892.2',
       'XP_011536034.1'],
      'rna': ['NM_001290230.1', 'NM_001798.4', 'NM_052827.3', 'XM_011537732.1'],
      'translation': [{'protein': 'NP_001789.2', 'rna': 'NM_001798.4'},
       {'protein': 'NP_439892.2', 'rna': 'NM_052827.3'},
       {'protein': 'NP_001277159.1', 'rna': 'NM_001290230.1'},
       {'protein': 'XP_011536034.1', 'rna': 'XM_011537732.1'}]},
     'symbol': 'CDK2'}

    # get a client for chems/drugs

    In [9]: md = get_client("chem")

    In [10]: md.getchem("ATBDZSAENDYQDW-UHFFFAOYSA-N", fields="pubchem")
    Out[10]:
    {'_id': 'ATBDZSAENDYQDW-UHFFFAOYSA-N',
     '_version': 1,
     'pubchem': {'chiral_atom_count': 0,
      'chiral_bond_count': 0,
      'cid': 'CID4080429',
      'complexity': 250,
      'covalently-bonded_unit_count': 1,
      'defined_atom_stereocenter_count': 0,
      'defined_bond_stereocenter_count': 0,
      'exact_mass': 184.019415,
      'formal_charge': 0,
      'heavy_atom_count': 12,
      'hydrogen_bond_acceptor_count': 3,
      'hydrogen_bond_donor_count': 1,
      'inchi': 'InChI=1S/C8H8O3S/c1-2-7-4-3-5-8(6-7)12(9,10)11/h2-6H,1H2,(H,9,10,11)',
      'inchi_key': 'ATBDZSAENDYQDW-UHFFFAOYSA-N',
      'isotope_atom_count': 0,
      'iupac': {'traditional': '3-vinylbesylic acid'},
      'molecular_formula': 'C8H8O3S',
      'molecular_weight': 184.21232,
      'monoisotopic_weight': 184.019415,
      'rotatable_bond_count': 2,
      'smiles': {'isomeric': 'C=CC1=CC(=CC=C1)S(=O)(=O)O'},
      'tautomers_count': 1,
      'topological_polar_surface_area': 62.8,
      'undefined_atom_stereocenter_count': 0,
      'undefined_bond_stereocenter_count': 0,
      'xlogp': 1.4}}

    # get a client for taxa

    In [11]: mt = get_client("taxon")

    In [12]: mt.gettaxon(9606)
    Out[12]:
    {'_id': '9606',
     '_version': 1,
     'authority': ['homo sapiens linnaeus, 1758'],
     'common_name': 'man',
     'genbank_common_name': 'human',
     'has_gene': True,
     'lineage': [9606,
      9605,
      207598,
      9604,
      314295,
      9526,
      314293,
      376913,
      9443,
      314146,
      1437010,
      9347,
      32525,
      40674,
      32524,
      32523,
      1338369,
      8287,
      117571,
      117570,
      7776,
      7742,
      89593,
      7711,
      33511,
      33213,
      6072,
      33208,
      33154,
      2759,
      131567,
      1],
     'other_names': ['humans'],
     'parent_taxid': 9605,
     'rank': 'species',
     'scientific_name': 'homo sapiens',
     'taxid': 9606,
     'uniprot_name': 'homo sapiens'}

Contact
========
Drop us any feedback `@biothingsapi <https://twitter.com/biothingsapi>`_

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "biothings-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=2.7",
    "maintainer_email": "",
    "keywords": "biology,variant,gene,taxon,species,drug,annotation,web,service,client,api,myvariant,mygene",
    "author": "Cyrus Afrasiabi, Xinghua Zhou, Everaldo Rodolpho",
    "author_email": "Chunlei Wu <cwu@scripps.edu>",
    "download_url": "https://files.pythonhosted.org/packages/ee/54/1a6bce6507a986906a828786e3f2c7411ae12d846d4d3edf806ec405bc9a/biothings_client-0.3.1.tar.gz",
    "platform": null,
    "description": ".. image:: https://badge.fury.io/py/biothings-client.svg\n    :target: https://pypi.python.org/pypi/biothings-client\n\n.. image:: https://img.shields.io/pypi/pyversions/biothings-client.svg\n    :target: https://pypi.python.org/pypi/biothings-client\n\n.. image:: https://img.shields.io/pypi/format/biothings-client.svg\n    :target: https://pypi.python.org/pypi/biothings-client\n\n.. image:: https://github.com/biothings/biothings_client.py/actions/workflows/build-package.yml/badge.svg\n    :target: https://github.com/biothings/biothings_client.py/actions/workflows/build-package.yml\n\n.. image:: https://github.com/biothings/biothings_client.py/actions/workflows/run-tests.yml/badge.svg\n    :target: https://github.com/biothings/biothings_client.py/actions/workflows/run-tests.yml\n\n.. image:: https://api.codacy.com/project/badge/Grade/2b716becb6e948a6b576f278e64dd81f\n   :alt: Codacy Badge\n   :target: https://www.codacy.com/gh/biothings/biothings_client.py/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=biothings/biothings_client.py&amp;utm_campaign=Badge_Grade\n\n.. image:: https://app.codacy.com/project/badge/Coverage/2b716becb6e948a6b576f278e64dd81f\n   :alt: Codacy Coverage Badge\n   :target: https://app.codacy.com/gh/biothings/biothings_client.py/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage\n\n.. image:: https://img.shields.io/pypi/dm/biothings_client.svg\n   :alt: PyPI Downloads\n   :target: https://pypistats.org/packages/biothings_client\n\n.. image:: https://readthedocs.org/projects/biothings-clientpy/badge/?version=latest\n   :alt: Documentation Status\n   :target: https://biothings-clientpy.readthedocs.io/en/latest/?badge=latest\n\nIntro\n=====\n\n*biothings_client* is an easy-to-use Python wrapper to access any Biothings.api_\n-based backend service. Currently, the following clients are available:\n\n    * gene - The client for MyGene.Info_, which provides access to gene objects.\n    * variant - The client MyVariant.Info_, which provides access to genetic variant objects.\n    * chem - The client for MyChem.Info_, which provides access to chemical/drug objects.\n    * disease - The client for MyDisease.Info_, which provides access to disease objects.\n    * geneset - The client for MyGeneset.Info_, which provides access to geneset/pathway objects.\n    * taxon - The client for t.biothings.io_, which provides access to taxon objects.\n\n.. _t.biothings.io: https://t.biothings.io\n.. _Biothings.api: https://biothings.io\n.. _MyGene.Info: https://mygene.info\n.. _MyVariant.Info: https://myvariant.info\n.. _MyChem.Info: https://mychem.info\n.. _MyDisease.Info: https://mydisease.info\n.. _MyGeneset.Info: https://mygeneset.info\n.. _requests: https://pypi.python.org/pypi/requests\n\nRequirements\n============\n    python >=2.7 (including all python3 versions)\n\n    (It may still work under python 2.6, but it's not supported any more.)\n\n    requests_ (install using \"pip install requests\")\n\nOptional dependencies\n======================\n    * `pandas <http://pandas.pydata.org>`_ (install using \"pip install pandas\") is required for returning a list of variant objects as `DataFrame <http://pandas.pydata.org/pandas-docs/stable/dsintro.html#dataframe>`_.\n    * `requests_cache <https://pypi.python.org/pypi/requests-cache>`_ (install using \"pip install requests_cache\") is required for local caching of API requests.\n\nInstallation\n=============\n\n    Option 1\n          ::\n\n           pip install biothings_client\n\n    Option 2\n          download/extract the source code and run::\n\n           python setup.py install\n\n    Option 3\n          install the latest code directly from the repository::\n\n            pip install -e git+https://github.com/biothings/biothings_client.py#egg=biothings_client\n\nVersion history\n===============\n\n    `CHANGES.txt <https://raw.githubusercontent.com/biothings/biothings_client.py/master/CHANGES.txt>`_\n\nTutorial\n=========\n\n    See the `quick start tutorial <https://biothings-clientpy.readthedocs.io/en/latest/doc/Quick-Start.html>`_ at the `biothings_client doc page <https://biothings-clientpy.readthedocs.io/en/latest/index.html>`_.\n\nDocumentation\n=============\n\n    https://biothings-clientpy.readthedocs.io\n\nUsage\n=====\n\n.. code-block:: python\n\n    In [1]: from biothings_client import get_client\n\n    # get a client for variant objects\n\n    In [2]: mv = get_client(\"variant\")\n\n    In [3]: mv.getvariant(\"chr7:g.140453134T>C\")\n    Out[3]:  #output below is collapsed\n    {\"_id\": \"chr7:g.140453134T>C\",\n     \"_version\": 1,\n     \"chrom\": \"7\",\n     \"cadd\": {...},\n     \"clinvar\": {...},\n     \"cosmic\": {...},\n     \"dbnsfp\": {...},\n     \"dbsnp\": {...},\n     \"docm\": {...},\n     \"hg19\": {'end': 140453134, 'start': 140453134},\n     \"mutdb\": {...},\n     \"snpeff\": {...},\n     \"vcf\": {\n        \"alt\": \"C\",\n        \"position\": \"140453134\",\n        \"ref\": \"T\"\n     }}\n\n    # get a client for gene objects\n\n    In [7]: mg = get_client(\"gene\")\n\n    In [8]: mg.getgene(1017, 'name,symbol,refseq')\n    Out[8]:\n    {'_id': '1017',\n     '_score': 21.03413,\n     'name': 'cyclin dependent kinase 2',\n     'refseq': {'genomic': ['NC_000012.12', 'NC_018923.2', 'NG_034014.1'],\n      'protein': ['NP_001277159.1',\n       'NP_001789.2',\n       'NP_439892.2',\n       'XP_011536034.1'],\n      'rna': ['NM_001290230.1', 'NM_001798.4', 'NM_052827.3', 'XM_011537732.1'],\n      'translation': [{'protein': 'NP_001789.2', 'rna': 'NM_001798.4'},\n       {'protein': 'NP_439892.2', 'rna': 'NM_052827.3'},\n       {'protein': 'NP_001277159.1', 'rna': 'NM_001290230.1'},\n       {'protein': 'XP_011536034.1', 'rna': 'XM_011537732.1'}]},\n     'symbol': 'CDK2'}\n\n    # get a client for chems/drugs\n\n    In [9]: md = get_client(\"chem\")\n\n    In [10]: md.getchem(\"ATBDZSAENDYQDW-UHFFFAOYSA-N\", fields=\"pubchem\")\n    Out[10]:\n    {'_id': 'ATBDZSAENDYQDW-UHFFFAOYSA-N',\n     '_version': 1,\n     'pubchem': {'chiral_atom_count': 0,\n      'chiral_bond_count': 0,\n      'cid': 'CID4080429',\n      'complexity': 250,\n      'covalently-bonded_unit_count': 1,\n      'defined_atom_stereocenter_count': 0,\n      'defined_bond_stereocenter_count': 0,\n      'exact_mass': 184.019415,\n      'formal_charge': 0,\n      'heavy_atom_count': 12,\n      'hydrogen_bond_acceptor_count': 3,\n      'hydrogen_bond_donor_count': 1,\n      'inchi': 'InChI=1S/C8H8O3S/c1-2-7-4-3-5-8(6-7)12(9,10)11/h2-6H,1H2,(H,9,10,11)',\n      'inchi_key': 'ATBDZSAENDYQDW-UHFFFAOYSA-N',\n      'isotope_atom_count': 0,\n      'iupac': {'traditional': '3-vinylbesylic acid'},\n      'molecular_formula': 'C8H8O3S',\n      'molecular_weight': 184.21232,\n      'monoisotopic_weight': 184.019415,\n      'rotatable_bond_count': 2,\n      'smiles': {'isomeric': 'C=CC1=CC(=CC=C1)S(=O)(=O)O'},\n      'tautomers_count': 1,\n      'topological_polar_surface_area': 62.8,\n      'undefined_atom_stereocenter_count': 0,\n      'undefined_bond_stereocenter_count': 0,\n      'xlogp': 1.4}}\n\n    # get a client for taxa\n\n    In [11]: mt = get_client(\"taxon\")\n\n    In [12]: mt.gettaxon(9606)\n    Out[12]:\n    {'_id': '9606',\n     '_version': 1,\n     'authority': ['homo sapiens linnaeus, 1758'],\n     'common_name': 'man',\n     'genbank_common_name': 'human',\n     'has_gene': True,\n     'lineage': [9606,\n      9605,\n      207598,\n      9604,\n      314295,\n      9526,\n      314293,\n      376913,\n      9443,\n      314146,\n      1437010,\n      9347,\n      32525,\n      40674,\n      32524,\n      32523,\n      1338369,\n      8287,\n      117571,\n      117570,\n      7776,\n      7742,\n      89593,\n      7711,\n      33511,\n      33213,\n      6072,\n      33208,\n      33154,\n      2759,\n      131567,\n      1],\n     'other_names': ['humans'],\n     'parent_taxid': 9605,\n     'rank': 'species',\n     'scientific_name': 'homo sapiens',\n     'taxid': 9606,\n     'uniprot_name': 'homo sapiens'}\n\nContact\n========\nDrop us any feedback `@biothingsapi <https://twitter.com/biothingsapi>`_\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Python Client for BioThings API services.",
    "version": "0.3.1",
    "project_urls": {
        "documentation": "https://biothings-clientpy.readthedocs.io",
        "homepage": "https://github.com/biothings/biothings_client.py",
        "repository": "https://github.com/biothings/biothings_client.py"
    },
    "split_keywords": [
        "biology",
        "variant",
        "gene",
        "taxon",
        "species",
        "drug",
        "annotation",
        "web",
        "service",
        "client",
        "api",
        "myvariant",
        "mygene"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c2216c4bdb8ba8d2cdeb5ac3a6460ab1cbd841e46cd851d6b00028b327c5deb3",
                "md5": "394cdd4f5c9124ac901b8c1a88686227",
                "sha256": "c08437f652d9282da785e098288ef7cf3aa2a79f5d90c480eadfce96b846013e"
            },
            "downloads": -1,
            "filename": "biothings_client-0.3.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "394cdd4f5c9124ac901b8c1a88686227",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=2.7",
            "size": 29350,
            "upload_time": "2023-11-13T23:24:19",
            "upload_time_iso_8601": "2023-11-13T23:24:19.177510Z",
            "url": "https://files.pythonhosted.org/packages/c2/21/6c4bdb8ba8d2cdeb5ac3a6460ab1cbd841e46cd851d6b00028b327c5deb3/biothings_client-0.3.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ee541a6bce6507a986906a828786e3f2c7411ae12d846d4d3edf806ec405bc9a",
                "md5": "08bfce32147a245cc251c61ccc053539",
                "sha256": "c972bf2e02b6f9cc78f7f2fbc5ef02cc56fe4f8a2adcb8801ec902f4ab7011e6"
            },
            "downloads": -1,
            "filename": "biothings_client-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "08bfce32147a245cc251c61ccc053539",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=2.7",
            "size": 25893,
            "upload_time": "2023-11-13T23:24:20",
            "upload_time_iso_8601": "2023-11-13T23:24:20.847137Z",
            "url": "https://files.pythonhosted.org/packages/ee/54/1a6bce6507a986906a828786e3f2c7411ae12d846d4d3edf806ec405bc9a/biothings_client-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-13 23:24:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "biothings",
    "github_project": "biothings_client.py",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "biothings-client"
}
        
Elapsed time: 0.15265s