datanator_rest_api.util package¶
Submodules¶
datanator_rest_api.util.paginator module¶
datanator_rest_api.util.taxon_distance module¶
-
class
datanator_rest_api.util.taxon_distance.
TaxonDist
(debugging=False)[source]¶ Bases:
object
-
arrange_distance_objs
(docs, target_species='homo sapiens', tax_field='taxon_name', org_format='tax_name')[source]¶ Arrange the distance object returned into arrays.
- Parameters
docs (
Iter
) – Documents that need calculation of taxon_distance and rearranging.target_species (
str
orint
, optional) – User input for target species.tax_field (
str
, optional) – Field containing taxon information in documents.org_format (
str
, optional) – format of species identifier (tax_id or tax_name). Defaults to ‘tax_id’.
- Returns
List of documents that have the taxon_distance objects.
- Return type
(
list
ofObj
)
-
get_dist_object
(doc, queried_species, distance_obj, target_species, org_format='tax_id', tax_field='species_name', obj_name='taxon_distance')[source]¶ Return taxon_distance object for frontend.
- Parameters
doc (
Obj
) – documents that need to be processed.queried_species (
deque
) – already queried species.distance_obj (
Obj
) – distance objects containing already queried species.target_species (
str
orint
) – target species.org_format (
str
, optional) – format of species identifier (tax_id or tax_name). Defaults to ‘tax_id’.tax_field (
str
, optional) – field containing taxon information in documents.obj_name (
str
, optional) – name of the object containing taxon distance information.
- Returns
(
tuple
oflist
,Obj
,Obj
)
-