Taxonomy data from the web in three languages

    R ruby python taxonomy
 Source: .Rmd/.md

Eduard Szöcs and I started developing a taxonomic toolbelt for the R language a while back , which lets you interact with a multitude of taxonomic databases on the web. We have a paper in F1000Research if you want to find out more (see here).

I thought it would be fun to rewrite some of taxize in other languages to learn more languages. Ruby and Python made the most sense to try. I did try others (Julia, Node), but gave up on those for now. The goal here isn’t to port taxize to Python and Ruby right now - it’s for me to learn myself some coding.

Anyway, here’s use of the same function in three languages: R, Ruby, and Python. The function searches the Global Names Index, but is named slightly differently in R (gni_search) vs. Ruby/Python (gniSearch). (yes, I realize the package names aren’t consistent)

Note that there are only a few functions available in the Ruby and Python versions:

And the behavior of these functions does not necessarily match that in the R version.

One thing I have learned is that packaging in R is much harder than in Python or Ruby. devtools does make R packaging easier, but still…


Code here


Then search for a taxonomic name

out <- gni_search('Helianthus annuus')
               name      id
1 Helianthus annuus 3329657
                              uuid_hex resource_url
1 18f9c244-a450-535e-adcd-2bfaf85c9b2e         none


Code here

git clone
cd tacksize
gem build tacksize.gemspec
gem install ./tacksize-0.0.1.gem

In a Ruby repl, like irb, search for a taxonomic name

require 'tacksize'
out = Tacksize.gniSearch(:search_term => 'Helianthus annuus')
=> {"uuid_hex"=>"18f9c244-a450-535e-adcd-2bfaf85c9b2e", "name"=>"Helianthus annuus", "lsid"=>"", "resource_uri"=>"", "id"=>3329657}


Code here

git clone
cd pytaxize
python install

In a Python repl, like ipython, search for a taxonomic name

import pytaxize
out = pytaxize.gniSearch(name = 'Helianthus annuus')
{u'id': 3329657,
 u'lsid': u'',
 u'name': u'Helianthus annuus',
 u'resource_uri': u'',
 u'uuid_hex': u'18f9c244-a450-535e-adcd-2bfaf85c9b2e'}
comments powered by Disqus