{ "info": { "author": "Hadrien Gourl\u00e9, Juliette Hayer, Emmanuel Quevillon", "author_email": "hadrien.gourle@slu.se, juliette.hayer@slu.se, tuco@pasteur.fr", "bugtrack_url": null, "classifiers": [], "description": "# Taxadb\n\n[![Build Status](https://travis-ci.org/HadrienG/taxadb.svg?branch=master)](https://travis-ci.org/HadrienG/taxadb)\n[![Documentation Status](https://readthedocs.org/projects/taxadb/badge/?version=latest)](http://taxadb.readthedocs.io/en/latest/?badge=latest)\n[![made-with-python](https://img.shields.io/badge/made%20with-python3-blue.svg)](https://www.python.org/)\n[![PyPI version](https://badge.fury.io/py/taxadb.svg)](https://pypi.org/project/taxadb/)\n[![codecov](https://codecov.io/gh/HadrienG/taxadb/branch/master/graph/badge.svg)](https://codecov.io/gh/HadrienG/taxadb)\n[![LICENSE](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://github.com/HadrienG/taxadb)\n\nTaxadb is an application to locally query the ncbi taxonomy. Taxadb is written in python, and access its database using the [peewee](http://peewee.readthedocs.io) library.\n\nIn brief Taxadb:\n\n* is a small tool to query the [ncbi](https://ncbi.nlm.nih.gov/taxonomy) taxonomy.\n* is written in python >= 3.5.\n* has built-in support for [SQLite](https://www.sqlite.org), [MySQL](https://www.mysql.com) and [PostgreSQL](https://www.postgresql.org).\n* has available pre-built SQLite databases.\n* has a comprehensive API documentation.\n\n\n## Installation\n\nTaxadb requires python >= 3.5 to work. To install taxadb with sqlite support, simply type the following in your terminal:\n\n pip3 install taxadb\n\nIf you wish to use MySQL or PostgreSQL, please refer to the full [documentation](http://taxadb.readthedocs.io/en/latest/)\n\n## Usage\n\n### Querying the Database\n\nFirstly, make sure you have [built](#creating-the-database) the database\n\nBelow you can find basic examples. For more complete examples, please refer to the complete [API documentation](http://taxadb.readthedocs.io/en/latest/)\n\n```python\n >>> from taxadb.taxid import TaxID\n\n >>> taxid = TaxID(dbtype='sqlite', dbname='mydb.sqlite')\n >>> name = taxid.sci_name(33208)\n >>> print(name)\n Metazoa\n\n >>> lineage = taxid.lineage_name(33208)\n >>> print(lineage)\n ['Metazoa', 'Opisthokonta', 'Eukaryota', 'cellular organisms']\n >>> lineage = taxid.lineage_name(33208, reverse=True)\n >>> print(lineage)\n ['cellular organism', 'Eukaryota', 'Opisthokonta', 'Metazoa']\n\n >>> taxid.has_parent(33208, 'Eukaryota')\n True\n```\n\nGet the taxid from a scientific name.\n\n```python\n >>> from taxadb.names import SciName\n\n >>> names = SciName(dbtype='sqlite', dbname='mydb.sqlite')\n >>> taxid = names.taxid('Physisporinus cinereus')\n >>> print(taxid)\n 2056287\n```\n\nGet the taxonomic information for accession number(s).\n\n```python\n >>> from taxadb.accessionid import AccessionID\n\n >>> my_accessions = ['X17276', 'Z12029']\n >>> accession = AccessionID(dbtype='sqlite', dbname='mydb.sqlite')\n >>> taxids = accession.taxid(my_accessions)\n >>> taxids\n \n\n >>> for tax in taxids:\n print(tax)\n ('X17276', 9646)\n ('Z12029', 9915)\n```\n\nYou can also use a configuration file in order to automatically set database\nconnection parameters at object build. Either set `config` parameter to `__init__`\n object method:\n ```python\n >>> from taxadb.accessionid import AccessionID\n\n >>> my_accessions = ['X17276', 'Z12029']\n >>> accession = AccessionID(config='/path/to/taxadb.cfg')\n >>> taxids = accession.taxid(my_accessions)\n >>> ...\n ```\n\n or set environment variable `TAXADB_CONFIG` which point to configuration file:\n ```bash\n $ export TAXADB_CONFIG='/path/to/taxadb.cfg'\n ```\n then\n ```python\n >>> from taxadb.accessionid import AccessionID\n\n >>> my_accessions = ['X17276', 'Z12029']\n >>> accession = AccessionID()\n >>> taxids = accession.taxid(my_accessions)\n >>> ...\n ```\n\nCheck documentation for more information.\n\n### Creating the Database\n\n#### Download data\n\nThe following commands will download the necessary files from the ncbi ftp into the directory `taxadb`.\n```\n$ taxadb download -o taxadb\n```\n\n#### Insert data\n\n##### SQLite\n\n\n```\n$ taxadb create -i taxadb --dbname taxadb.sqlite\n```\nYou can then safely remove the downloaded files\n```\n$ rm -r taxadb\n```\n\n##### MySQL\n\nCreating databases is a very vendor specific task. Peewee, as most ORMs, can create tables but not databases.\nIn order to use taxadb with MySQL, you'll have to create the database yourself.\n\nConnect to your mysql server\n```\n$ mysql -u $user -p\n$ mysql> CREATE DATABASE taxadb;\n\n```\n\nLoad data\n```\n$ taxadb create -i taxadb --dbname taxadb --dbtype mysql --username --password ...\n```\n\n##### PostgreSQL\n\nCreating databases is a very vendor specific task. Peewee, as most ORMs, can create tables but not databases.\nIn order to use taxadb with PosgreSQL, you'll have to create the database yourself.\n\nConnect to your postgresql server\n```\n$ psql -U $user -d postgres\n$ psql> CREATE DATABASE taxadb;\n```\n\nLoad data\n```\n$ taxadb create -i taxadb --dbname taxadb --dbtype postgres --username --password ...\n```\n\nYou can easily rerun the same command, `taxadb` is able to skip already inserted `taxid` as well as `accession`.\n\n## Tests\n\nYou can easily run some tests. Go to the root directory of this projects `cd /path/to/taxadb` and run\n`nosetests`.\n\nThis simple command will run tests against an `SQLite` test database called `test_db.sqlite` located in `taxadb/test`\ndirectory.\n\nIt is also possible to only run tests related to accessionid or taxid as follow\n```\n$ nosetests -a 'taxid'\n$ nosetests -a 'accessionid'\n```\n\nYou can also use the configuration file located in root distribution `taxadb.ini` as follow. This file should contains\ndatabase connection settings:\n```\n$ nosetests --tc-file taxadb.ini\n```\n\nYou can easily override configuration file settings using command line options `--tc` such as:\n```\n$ nosetest --tc-file taxadb.ini --tc=sql.dbname:another_dbname\n```\n\nMore info at [nose-testconfig](https://pypi.python.org/pypi/nose-testconfig)\n\n### Running tests against PostgreSQL or MySQL\n\n#### First create a test database to insert test data\n\n* PostgreSQL\n\n```\n$ createdb \n```\nor\n```\n$ psql -U postgres\npsql> CREATE DATABASE ;\n```\n\n* MySQL\n\n```\n$ mysql -u root\nmysql> CREATE DATABASE ;\n```\n\n#### Load test data\n\n* PostgreSQL\n```\n$ gunzip -c /path/to/taxadb/taxadb/test/test_mypg_db.sql.gz | psql -d -U \n```\n\n* MySQL\n```\n$ gunzip -c /path/to/taxadb/taxadb/test/test_mypg_db.sql.gz | mysql -D -u -p\n```\n\n#### Run tests\n\nEither edit `taxadb.ini` to fit database configuration or use `--tc` command line option and set appropriate values like\n`username, password, port, hostname, dbtype(postgres or mysql), dbname`.\n\n1) PostgreSQL\n```\n$ nosetests --tc-file taxadb.ini\nOR\n$ nosetests -tc-file taxadb.ini --tc=sql.dbtype:postgres --tc=sql.username:postgres --tc=sql.dbname:test_db2\n```\n\n2) MySQL\n```\n$ nosetests --tc-file taxadb.ini\nOR\n$ nosetests -tc-file taxadb.ini --tc=sql.dbtype:mysql --tc=sql.username:root --tc=sql.dbname:newdbname\n```\n\n## License\n\nCode is under the [MIT](LICENSE) license.\n\n## Issues\n\nFound a bug or have a question? Please open an [issue](https://github.com/HadrienG/taxadb/issues)\n\n## Contributing\n\nThought about a new feature that you'd like us to implement? Open an [issue](https://github.com/HadrienG/taxadb/issues) or fork the repository and submit a [pull request](https://github.com/HadrienG/taxadb/pulls)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/HadrienG/taxadb/tarball/0.12.0", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/HadrienG/taxadb", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "taxadb", "package_url": "https://pypi.org/project/taxadb/", "platform": "", "project_url": "https://pypi.org/project/taxadb/", "project_urls": { "Download": "https://github.com/HadrienG/taxadb/tarball/0.12.0", "Homepage": "https://github.com/HadrienG/taxadb" }, "release_url": "https://pypi.org/project/taxadb/0.12.0/", "requires_dist": [ "requests", "peewee (>=3.8.2)", "tqdm", "PyMySQL (>=0.7.10) ; extra == 'mysql'", "psycopg2 (>=2.6.2) ; extra == 'postgres'" ], "requires_python": "", "summary": "locally query the ncbi taxonomy", "version": "0.12.0" }, "last_serial": 5644732, "releases": { "0.10.0": [ { "comment_text": "", "digests": { "md5": "0e564352940b9ea8359924ac56676d7c", "sha256": "814dcf15b8b33d0c0ed26c3d2b537e88dfbcc685d56fac6b9a9b226a440687ec" }, "downloads": -1, "filename": "taxadb-0.10.0-py3-none-any.whl", "has_sig": false, "md5_digest": "0e564352940b9ea8359924ac56676d7c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19606, "upload_time": "2019-04-25T05:42:17", "url": "https://files.pythonhosted.org/packages/c7/28/99da3e08ff73d8e2ddb0fe9c6a0b35857aee7c906af8c9aeb0726d009db1/taxadb-0.10.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4adf1e066390a2494b5163feddf8e0f0", "sha256": "1fba9d3d0240e083fa9c15599028b50aee894bd94c45601b46e3b1649f3d8680" }, "downloads": -1, "filename": "taxadb-0.10.0.tar.gz", "has_sig": false, "md5_digest": "4adf1e066390a2494b5163feddf8e0f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17416, "upload_time": "2019-04-25T05:42:19", "url": "https://files.pythonhosted.org/packages/05/a6/e8e7e7e25f74b6af7de63535100f16b4be9ab3098699dcf3250630970596/taxadb-0.10.0.tar.gz" } ], "0.10.1": [ { "comment_text": "", "digests": { "md5": "c331d351c77a058689e8b1da59323c40", "sha256": "3876e399191eeab9997a692e0148fb50b41ea2791e3904efab78f1783e034c4d" }, "downloads": -1, "filename": "taxadb-0.10.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c331d351c77a058689e8b1da59323c40", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19602, "upload_time": "2019-05-16T07:25:52", "url": "https://files.pythonhosted.org/packages/04/48/73e4457ab90fcc3601e5ca4130fc1c03b9e2f3b78bd2de6e9e55ca9b464d/taxadb-0.10.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "39537e74eee0295c570b33e9d2002ed7", "sha256": "cd96a82faf27cf42c3b50ad34761e7db3a6ae26fb49deabe5a41702dde8dcc8a" }, "downloads": -1, "filename": "taxadb-0.10.1.tar.gz", "has_sig": false, "md5_digest": "39537e74eee0295c570b33e9d2002ed7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17432, "upload_time": "2019-05-16T07:25:54", "url": "https://files.pythonhosted.org/packages/cf/3d/f927553160783f2b09b673aa7b72726ee0f2163ac0cd2780346278569412/taxadb-0.10.1.tar.gz" } ], "0.12.0": [ { "comment_text": "", "digests": { "md5": "c042984ef726283336703114a9951c5a", "sha256": "d063dd4c24b613a697c23cf38c6077228660be67e0718d5afb8c012c8c25b96c" }, "downloads": -1, "filename": "taxadb-0.12.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c042984ef726283336703114a9951c5a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19608, "upload_time": "2019-08-07T12:17:24", "url": "https://files.pythonhosted.org/packages/96/59/37d840c9e50fd69a691923d3ba260aa9ddd6192570561bcc8121031e666d/taxadb-0.12.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ec0caed73cfd698f079d94edc910da6e", "sha256": "b4c33e41c3e9aa167906a8e03fcad5779cd954e6e98d311ceefcc9269d665df5" }, "downloads": -1, "filename": "taxadb-0.12.0.tar.gz", "has_sig": false, "md5_digest": "ec0caed73cfd698f079d94edc910da6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17467, "upload_time": "2019-08-07T12:17:25", "url": "https://files.pythonhosted.org/packages/7a/c0/7dddcb1433e77346b4c78743daaf6a8a648eee9650710e554749368cdf0a/taxadb-0.12.0.tar.gz" } ], "0.4a0": [ { "comment_text": "", "digests": { "md5": "4046f6be37ecfe810dab5ec6b45268a5", "sha256": "042d058950ce9a4886c335546a2a017f5eeb7731facd5f2f7de1b605bb0a9368" }, "downloads": -1, "filename": "taxadb-0.4a0.tar.gz", "has_sig": false, "md5_digest": "4046f6be37ecfe810dab5ec6b45268a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5002, "upload_time": "2016-12-06T13:30:10", "url": "https://files.pythonhosted.org/packages/4f/e4/1446d2c9081d90cab1f1b49d8ebea59d9cebb21d49f29b94d4fb10c067bf/taxadb-0.4a0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "798efa79f624beb4d3bd6db4c1d748ab", "sha256": "042f04862261a9df2f1e81dc84ddf19625e5b5f6e6598028d360d6ef4f3eefac" }, "downloads": -1, "filename": "taxadb-0.5.0.tar.gz", "has_sig": false, "md5_digest": "798efa79f624beb4d3bd6db4c1d748ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8977, "upload_time": "2017-03-16T07:36:48", "url": "https://files.pythonhosted.org/packages/06/ae/263ff8fc95d8efe41233e718b1dd50dc43536729daeb3e9367196442fd40/taxadb-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "ca6f5f5c89f65d9c5789ddb771608f54", "sha256": "b0fa3fb5a725569486ab22387b72e53de66d584083a2848a46bbc88346fa1ecc" }, "downloads": -1, "filename": "taxadb-0.6.0.tar.gz", "has_sig": false, "md5_digest": "ca6f5f5c89f65d9c5789ddb771608f54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10517, "upload_time": "2017-04-19T06:55:32", "url": "https://files.pythonhosted.org/packages/b5/9a/942d91ad6ebb7f805514a302a961a0ffefc27a5b01f4609246b3f9743916/taxadb-0.6.0.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "89901c6f70c39f9c93a060a87a66268c", "sha256": "b6e60137affdbc1eae2385ed7ccab56634276dd70d8b2595246e05d4436b1a46" }, "downloads": -1, "filename": "taxadb-0.7.0-py3-none-any.whl", "has_sig": false, "md5_digest": "89901c6f70c39f9c93a060a87a66268c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21014, "upload_time": "2018-03-26T11:10:36", "url": "https://files.pythonhosted.org/packages/82/08/654e8d06ed086dcc9793f16ff4f6df52294365a4da068834ca0cd1d4b97a/taxadb-0.7.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c1b954241c523a18017611fa822cbc5e", "sha256": "ad62bf80e13d5d0cc34ee9d52ded9f630f0f3a02132cddfcda26d5b0ec530932" }, "downloads": -1, "filename": "taxadb-0.7.0.tar.gz", "has_sig": false, "md5_digest": "c1b954241c523a18017611fa822cbc5e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14182, "upload_time": "2018-03-26T11:10:37", "url": "https://files.pythonhosted.org/packages/37/05/3e59c86a6a242230d28f007d987990563d4d17ca8a1c026472354e0758f1/taxadb-0.7.0.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "2fbb80f78d56b9b0e6cb31ec4f4b5849", "sha256": "461dd24fcb9ec4af951a888e385103387721d8555f4d2a42661a457b13d7b23e" }, "downloads": -1, "filename": "taxadb-0.8.0-py3-none-any.whl", "has_sig": false, "md5_digest": "2fbb80f78d56b9b0e6cb31ec4f4b5849", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22003, "upload_time": "2018-04-22T13:26:18", "url": "https://files.pythonhosted.org/packages/3e/c3/47608a2055382d3fbbcac9f8d4b80f0402542f237a92860748c0e80d1b9e/taxadb-0.8.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "567567d2558b5af02822cb89abbab6e1", "sha256": "612eae360555531bf45ae10fd7ca8ab2fcc0358d6d3150beb272e4b12d2134d8" }, "downloads": -1, "filename": "taxadb-0.8.0.tar.gz", "has_sig": false, "md5_digest": "567567d2558b5af02822cb89abbab6e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14611, "upload_time": "2018-04-22T13:26:19", "url": "https://files.pythonhosted.org/packages/00/49/2c9a31b7dea923f6d6967b578d7e969aa026831462d3dddb5e68a1346da6/taxadb-0.8.0.tar.gz" } ], "0.9.0": [ { "comment_text": "", "digests": { "md5": "05a1596232f25b2ab11797cfac1be569", "sha256": "cb3d6c7ba9656a92a34585eb295fbcc3f2da2e51ff7b69f1555ec66d1c6b3ce1" }, "downloads": -1, "filename": "taxadb-0.9.0-py3-none-any.whl", "has_sig": false, "md5_digest": "05a1596232f25b2ab11797cfac1be569", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18633, "upload_time": "2018-09-21T07:53:58", "url": "https://files.pythonhosted.org/packages/f8/be/19e605b91abc7c6e3c6a183d89f1f6dca2c2851ba588f9673e77302934bc/taxadb-0.9.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7d932a49fc9119e57f8ebce5e2a198db", "sha256": "77a9c7b5ef853a963b0d41a0355603ef550eb5c861dc5267a71365f747303bca" }, "downloads": -1, "filename": "taxadb-0.9.0.tar.gz", "has_sig": false, "md5_digest": "7d932a49fc9119e57f8ebce5e2a198db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17316, "upload_time": "2018-09-21T07:54:00", "url": "https://files.pythonhosted.org/packages/6d/9f/7b6e6402c6d8fc02f958058350fbdb8b62eccd3c3d7eac1e65546a2db663/taxadb-0.9.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c042984ef726283336703114a9951c5a", "sha256": "d063dd4c24b613a697c23cf38c6077228660be67e0718d5afb8c012c8c25b96c" }, "downloads": -1, "filename": "taxadb-0.12.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c042984ef726283336703114a9951c5a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19608, "upload_time": "2019-08-07T12:17:24", "url": "https://files.pythonhosted.org/packages/96/59/37d840c9e50fd69a691923d3ba260aa9ddd6192570561bcc8121031e666d/taxadb-0.12.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ec0caed73cfd698f079d94edc910da6e", "sha256": "b4c33e41c3e9aa167906a8e03fcad5779cd954e6e98d311ceefcc9269d665df5" }, "downloads": -1, "filename": "taxadb-0.12.0.tar.gz", "has_sig": false, "md5_digest": "ec0caed73cfd698f079d94edc910da6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17467, "upload_time": "2019-08-07T12:17:25", "url": "https://files.pythonhosted.org/packages/7a/c0/7dddcb1433e77346b4c78743daaf6a8a648eee9650710e554749368cdf0a/taxadb-0.12.0.tar.gz" } ] }