All Projects → bioforensics → pytaxonkit

bioforensics / pytaxonkit

Licence: other
Python bindings for the TaxonKit library

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to pytaxonkit

react-taxonomypicker
A Taxonomy Picker control built with TypeScript for React. Built for use in Office 365 / SharePoint
Stars: ✭ 23 (+53.33%)
Mutual labels:  taxonomy
multitax
Python package to obtain, parse and explore biological taxonomies (GTDB, NCBI, Silva, Greengenes, OTT)
Stars: ✭ 22 (+46.67%)
Mutual labels:  taxonomy
virion
The Global Virome in One Network
Stars: ✭ 27 (+80%)
Mutual labels:  taxonomy
vrt-ruby
Ruby library for interacting with Bugcrowd's VRT
Stars: ✭ 15 (+0%)
Mutual labels:  taxonomy
pytaxize
python port of taxize (taxonomy toolbelt) for R
Stars: ✭ 29 (+93.33%)
Mutual labels:  taxonomy
venue-taxonomy
The intention of this project is to standardize the list of venue types that represent Digital-Out-of-Home (DOOH) advertising screens within a programmatic OpenRTB 2.5 context. The systematization of DOOH venue types will allow for clearer targeting by media buying platforms across a spectrum of available supply-side platforms offering DOOH inve…
Stars: ✭ 26 (+73.33%)
Mutual labels:  taxonomy
worrms
World Register of Marine Species R client
Stars: ✭ 13 (-13.33%)
Mutual labels:  taxonomy
Sitegeist.Taxonomy
Manage vocabularies and taxonomies as separate node-hierarchy.
Stars: ✭ 14 (-6.67%)
Mutual labels:  taxonomy
Raskoh
Raskoh - easy and object oriented way to interact with WordPress custom post types and taxonomies.
Stars: ✭ 12 (-20%)
Mutual labels:  taxonomy
pr2database
Protist Ribosomal Reference database (PR2) - SSU rRNA gene database
Stars: ✭ 54 (+260%)
Mutual labels:  taxonomy
bio
A lightweight and high-performance bioinformatics package in Golang
Stars: ✭ 80 (+433.33%)
Mutual labels:  taxonomy
flora-on-server
Work collaboratively in IUCN Red List assessments and manage online biodiversity databases, including a graph-based taxonomy system, species traits and habitats, and species occurrences.
Stars: ✭ 13 (-13.33%)
Mutual labels:  taxonomy
popoto-examples
Contains a list of Popoto.js examples
Stars: ✭ 121 (+706.67%)
Mutual labels:  taxonomy
metacoder
Parsing, Manipulation, and Visualization of Metabarcoding/Taxonomic data
Stars: ✭ 120 (+700%)
Mutual labels:  taxonomy
naturtag
Tag your nature photos with iNat taxonomy and observation metadata
Stars: ✭ 20 (+33.33%)
Mutual labels:  taxonomy
wikitaxa
taxonomy data from Wikipedia/Wikidata/Wikispecies
Stars: ✭ 16 (+6.67%)
Mutual labels:  taxonomy
skos-play
SKOS-Play allows to print SKOS files in HTML or PDF. It also embeds xls2rdf to generate RDF from Excel.
Stars: ✭ 58 (+286.67%)
Mutual labels:  taxonomy
kraken-biom
Create BIOM-format tables (http://biom-format.org) from Kraken output (http://ccb.jhu.edu/software/kraken/, https://github.com/DerrickWood/kraken).
Stars: ✭ 35 (+133.33%)
Mutual labels:  taxonomy
arctos
Arctos is a museum collections management system
Stars: ✭ 39 (+160%)
Mutual labels:  taxonomy
laravel-tags
Rinvex Taggable is a polymorphic Laravel package, for tag management. You can tag any eloquent model with ease, and utilize the awesomeness of Sluggable, and Translatable models out of the box.
Stars: ✭ 23 (+53.33%)
Mutual labels:  taxonomy

pytaxonkit

Python bindings for the TaxonKit library. Results of queries are returned as pandas data frames, dictionaries, and other convenient data structures.

Install

Installation with Conda is recommended. (See environment.yaml for details on prerequisites if you want to try a different installation method.)

conda install -c bioconda pytaxonkit

Please follow the taxonkit instructions for downloading the NCBI Taxonomy database dump files. By default, taxonkit and pytaxonkit search for these files in ~/.taxonkit/, but this directory can be overridden by setting the data_dir appropriately for the functions described below. Execute help(pytaxonkit.name2taxid) (and so on) from the Python interpreter for more details.

Usage

pytaxonkit provides convenient access to TaxonKit operations from Python for use in the interactive interpreter, IPython, Jupyter notebooks, or custom Python code.

NOTES

  • The reformat operation is automatically run by pytaxonkit.lineage and cannot be invoked independently.
  • The taxid-changelog operation is not supported.
  • The genautocomplete operation is specific to the shell and is not supported.

name2taxid

>>> import pytaxonkit
>>> names = ['Phyllobolus spinuliferus', 'Alteromonas putrefaciens', 'Rexia erectus']
>>> pytaxonkit.name2taxid(names)
                       Name   TaxID     Rank
0  Phyllobolus spinuliferus  359607  species
1  Alteromonas putrefaciens      24  species
2             Rexia erectus  262902  species
>>> pytaxonkit.name2taxid(names, sciname=True)
                       Name  TaxID  Rank
0  Phyllobolus spinuliferus   <NA>  <NA>
1  Alteromonas putrefaciens   <NA>  <NA>
2             Rexia erectus   <NA>  <NA>

lineage

>>> import pytaxonkit
>>> result = pytaxonkit.lineage([7399, 1973489])
>>> result.columns
Index(['TaxID', 'Code', 'Name', 'Lineage', 'LineageTaxIDs', 'Rank',
       'FullLineage', 'FullLineageTaxIDs', 'FullLineageRanks'],
      dtype='object')
>>> result[['TaxID', 'Lineage', 'LineageTaxIDs']]
     TaxID                                            Lineage                          LineageTaxIDs
0     7399        Eukaryota;Arthropoda;Insecta;Hymenoptera;;;                2759;6656;50557;7399;;;
1  1973489  Bacteria;Firmicutes;Bacilli;Bacillales;Bacilla...  2;1239;91061;1385;186817;1386;1973489
>>> result = pytaxonkit.lineage(['1382510', '929505', '390333'], formatstr='{f};{g};{s};{S}')
>>> result['Lineage'].iloc[2]
'Lactobacillaceae;Lactobacillus;Lactobacillus delbrueckii;Lactobacillus delbrueckii subsp. bulgaricus'

name

>>> import pytaxonkit
>>> pytaxonkit.name(['274127', 511170])
    TaxID        Name
0  274127   Distathma
1  511170  Delicatula

list

>>> import pytaxonkit
>>> result = pytaxonkit.list([13685, 9903])
>>> for taxon, tree in result:
...     subtaxa = [t for t in tree.traverse]
...     print(f'Top level result: {taxon.name} ({taxon.taxid}); {len(subtaxa)} related taxa')
...
Top level result: Solenopsis (13685); 293 related taxa
Top level result: Bos (9903); 29 related taxa
>>> subtaxa[0]
BasicTaxon(taxid=9904, rank='species', name='Bos gaurus')
>>> pytaxonkit.list([9605], raw=True)
{'9605 [genus] Homo': {'9606 [species] Homo sapiens': {'63221 [subspecies] Homo sapiens neanderthalensis': {}, "741158 [subspecies] Homo sapiens subsp. 'Denisova'": {}}, '1425170 [species] Homo heidelbergensis': {}, '2665952 [no rank] environmental samples': {'2665953 [species] Homo sapiens environmental sample': {}}}}

filter

>>> import pytaxonkit
>>> taxids = [131567, 2759, 33154, 33208, 6072, 33213, 33317, 1206794, 88770, 6656, 197563, 197562, 6960, 50557, 85512, 7496, 33340, 33392, 85604, 7088]
>>> result = pytaxonkit.filter(taxids, equal_to='phylum', higher_than='phylum')
>>> pytaxonkit.name(result)
>>> pytaxonkit.name(result)
   TaxID        Name
0   2759   Eukaryota
1  33208     Metazoa
2   6656  Arthropoda
>>> taxids = [131567, 2759, 33154, 33208, 6072, 33213, 33317, 1206794, 88770, 6656, 197563, 197562, 6960, 50557, 85512, 7496, 33340, 33342, 7524]
>>> result = pytaxonkit.filter(taxids, lower_than='phylum', discard_norank=True)
>>> pytaxonkit.name(result)
   TaxID          Name
0   6960      Hexapoda
1  50557       Insecta
2   7496     Pterygota
3  33340      Neoptera
4  33342  Paraneoptera
5   7524     Hemiptera

lca

>>> import pytaxonkit
>>> taxids = pytaxonkit.name2taxid(['Polistes metricus', 'Nasonia vitripennis'])
>>> taxids
                  Name  TaxID     Rank
0    Polistes metricus  91422  species
1  Nasonia vitripennis   7425  species
>>> ancestor = pytaxonkit.lca(taxids.TaxID)
>>> pytaxonkit.name([ancestor])
   TaxID      Name
0   7400  Apocrita

version

>>> import pytaxonkit
>>> pytaxonkit.__version__
'0.7.2'
>>> pytaxonkit.__taxonkitversion__
'taxonkit v0.7.2'

License

BSD 3-clause

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].