def test_v2_tnrs_no_fuzzy():
    cfg = get_test_config()
    taxo = APIWrapper(config=cfg).taxomachine
    resp = taxo.TNRS(names, context_name="All life", fuzzy_matching=False)
    print resp
    assert len(resp['matched_name_ids']) == 3
    assert 'H**o sapphire' in resp['unmatched_name_ids']
    assert 'Pan trodlogytes' in resp['unmatched_name_ids']
def test_v1_tnrs():
    cfg = get_test_config({'apis': {'api_version': '1'}})
    taxo = APIWrapper(config=cfg).taxomachine
    names = [
        'Pan trodlogytes',
        'H**o sapphire',
        'Plantago',
        'Morpho peleides',
        'Eleocharis',
    ]
    resp = taxo.TNRS(names, context_name="All life")
    assert len(resp['matched_name_ids']) == 4
    assert resp['unmatched_name_ids'] == [u'H**o sapphire']
def test_v2_tnrs_fuzzy():
    cfg = get_test_config()
    taxo = APIWrapper(config=cfg).taxomachine
    names = [
        'Pan trodlogytes',
        'H**o sapphire',
        'Plantago',
        'Morpho peleides',
        'Eleocharis',
    ]
    resp = taxo.TNRS(names, context_name="All life", fuzzy_matching=True)
    print resp
    assert len(resp['matched_name_ids']) == 4
    assert resp['unmatched_name_ids'] == [u'H**o sapphire']
Example #4
0
#!/usr/bin/env python
from peyotl.api import APIWrapper
taxo = APIWrapper().taxomachine
print(taxo.valid_contexts)
print(taxo.TNRS(['sorex montereyensis'], context_name='Mammals'))
print(taxo.TNRS(['sorex montereyensis']))
Example #5
0
# Get the OpenTreeeOfLife identifier from a named clade

from peyotl.api import APIWrapper

import sys

input = sys.argv[1]
tx = APIWrapper().taxomachine
context = None

nms = tx.TNRS([input])
for i in nms['results']:
    for j in i['matches']:
        print j[u'taxon'][u'name']
        print j[u'taxon'][u'ott_id']