taxonomic classes for Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
docs
pytaxa
test
.coveragerc
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
Changelog.rst
LICENSE
Makefile
README.rst
requirements.txt
runtime.txt
setup.py

README.rst

pytaxa

pypi travis coverage

info

  • Minimum Python version: 3.5
  • pytaxa docs
  • Check out sister R package: taxa

Installation

Stable version

pip install pytaxa
pip3 install pytaxa

Dev version

sudo pip install git+git://github.com/sckott/pytaxa.git#egg=pytaxa

# OR

git clone git@github.com:sckott/pytaxa.git
cd pytaxa
make install

Usage

>>> from pytaxa import constructors as cs
>>> tn = cs.taxon_name("Poa")
>>> tn['name']
'Poa'

>>> from pytaxa import Taxon
>>> x = Taxon(None)
>>> x.is_empty()
True

>>> name = cs.taxon_name("Poa")
>>> rank = cs.taxon_rank("genus", "ncbi")
>>> db = cs.taxon_database("ncbi",
...   "http://www.ncbi.nlm.nih.gov/taxonomy",
...   "NCBI Taxonomy Database",
...   "*")
>>> id = cs.taxon_id(12345, db)
>>> tx1 = Taxon(name, rank, id, "L.")
>>> tx2 = Taxon(cs.taxon_name("Poaceae"),
...   cs.taxon_rank("family", "ncbi"), cs.taxon_id(4479, db))
>>> tx3 = Taxon(cs.taxon_name("Poa annua"),
...   cs.taxon_rank("species", "ncbi"), cs.taxon_id(93036, db))
>>> from pytaxa import Taxa
>>> Taxa(tx1, tx2, tx3)
<taxa>
  no. taxa: 3
  Poa / genus / 12345
  Poaceae / family / 4479
  Poa annua / species / 93036

>>> from pytaxa import Hierarchy
>>> out = Hierarchy(tx1, tx2, tx3)
>>> out.taxa
[<Taxon>
  name: Poaceae
  rank: family
  id: 4479
  authority: , <Taxon>
  name: Poa
  rank: genus
  id: 12345
  authority: L., <Taxon>
  name: Poa annua
  rank: species
  id: 93036
  authority: ]
>>> out.ranklist
['180', '140', '220']
>>> out.all_empty()
False
>>> out.pop(ranks = "family")
<Hierarchy>
  Poa / genus / 12345
  Poa annua / species / 93036

Contributing

See CONTRIBUTING.md

Contributors

  • Scott Chamberlain
  • Chuck McCallum

Meta