biotaphy.client.ot_service_wrapper.open_tree

Module for Open Tree of Life client.

Module Contents

Classes

LABEL_FORMAT

Represents the label format constants used when calling induced subtree.

Functions

induced_subtree(ott_ids, label_format=LABEL_FORMAT.NAME)

Retrieves a Newick tree containing the nodes represented by the ids.

resolve_names_otol(names_list)

Get information from the OTL taxon match service for a list of names.

sanitize_name(name)

Quick and dirty sanitization of a name string.

Attributes

INDUCED_SUBTREE_BASE_URL

MAX_NAMES_PER_REQUEST

OTT_TAXON_INFO_URL

PRODUCTION_SERVER

biotaphy.client.ot_service_wrapper.open_tree.INDUCED_SUBTREE_BASE_URL[source]
class biotaphy.client.ot_service_wrapper.open_tree.LABEL_FORMAT[source]

Represents the label format constants used when calling induced subtree.

ID = id[source]
NAME = name[source]
NAME_AND_ID = name_and_id[source]
biotaphy.client.ot_service_wrapper.open_tree.MAX_NAMES_PER_REQUEST = 250[source]
biotaphy.client.ot_service_wrapper.open_tree.OTT_TAXON_INFO_URL[source]
biotaphy.client.ot_service_wrapper.open_tree.PRODUCTION_SERVER = https://api.opentreeoflife.org/v3[source]
biotaphy.client.ot_service_wrapper.open_tree.induced_subtree(ott_ids, label_format=LABEL_FORMAT.NAME)[source]

Retrieves a Newick tree containing the nodes represented by the ids.

Calls the Open Tree ‘induced_subtree’ service to retrieve a tree, in Newick format, containing the nodes represented by the provided Open Tree IDs.

Parameters
  • ott_ids (list) – A list of Open Tree IDs. These will be converted to integers in the request.

  • label_format (str) – The label string format to use when creating the tree on the server. (see: LABEL_FORMAT)

Returns

A dictionary of the subtree response after JSON processing.

Return type

dict

biotaphy.client.ot_service_wrapper.open_tree.resolve_names_otol(names_list)[source]

Get information from the OTL taxon match service for a list of names.

Parameters

names_list (list of str) – A list of taxon names to get information for.

Returns

A dictionary where keys are the searched taxon names and the values are

dictionaries of values from Open Tree.

Return type

dict

biotaphy.client.ot_service_wrapper.open_tree.sanitize_name(name)[source]

Quick and dirty sanitization of a name string.

Parameters

name (str) – A name string to sanitize.

Returns

A sanitized search name.

Return type

str