allensdk.api.queries.ontologies_api module

class allensdk.api.queries.ontologies_api.OntologiesApi(base_uri=None)[source]

Bases: allensdk.api.queries.rma_template.RmaTemplate

See: Atlas Drawings and Ontologies

get_atlases(**kwargs)[source]
get_atlases_table(**kwargs)[source]

List Atlases available through the API with associated ontologies and structure graphs.

Parameters:
atlas_ids : integer or list of integers, optional

only select specific atlases

brief : boolean, optional

True (default) requests only name and id fields.

Returns:
dict : atlas metadata

Notes

This query is based on the table of available Atlases. See also: Class: Atlas

get_structure_graphs(**kwargs)[source]
get_structure_sets(**kwargs)[source]
get_structures(**kwargs)[source]

Retrieve data about anatomical structures.

Parameters:
structure_graph_ids : int or list of ints, optional

database keys to get all structures in particular graphs

structure_graph_names : string or list of strings, optional

list of graph names to narrow the query

structure_set_ids : int or list of ints, optional

database keys to get all structures in a particular set

structure_set_names : string or list of strings, optional

list of set names to narrow the query.

order : list of strings

list of RMA order clauses for sorting

num_rows : int

how many records to retrieve

Returns:
dict

the parsed json response containing data from the API

Notes

Only one of the methods of limiting the query should be used at a time.

get_structures_with_sets(**kwargs)[source]

Download structures along with the sets to which they belong.

Parameters:
structure_graph_ids : int or list of int

Only fetch structure records from these graphs.

order : list of strings

list of RMA order clauses for sorting

num_rows : int

how many records to retrieve

Returns:
dict

the parsed json response containing data from the API

rma_templates = {'ontology_queries': [{'count': False, 'name': 'structures_by_graph_ids', 'criteria': '[graph_id$in{{ graph_ids }}]', 'num_rows': 'all', 'model': 'Structure', 'criteria_params': ['graph_ids'], 'order': ['structures.graph_order'], 'description': 'see name'}, {'count': False, 'name': 'structures_by_graph_names', 'criteria': 'graph[structure_graphs.name$in{{ graph_names }}]', 'num_rows': 'all', 'model': 'Structure', 'criteria_params': ['graph_names'], 'order': ['structures.graph_order'], 'description': 'see name'}, {'count': False, 'name': 'structures_by_set_ids', 'criteria': '[structure_set_id$in{{ set_ids }}]', 'num_rows': 'all', 'model': 'Structure', 'criteria_params': ['set_ids'], 'order': ['structures.graph_order'], 'description': 'see name'}, {'count': False, 'name': 'structures_by_set_names', 'criteria': 'structure_sets[name$in{{ set_names }}]', 'num_rows': 'all', 'model': 'Structure', 'criteria_params': ['set_names'], 'order': ['structures.graph_order'], 'description': 'see name'}, {'num_rows': 'all', 'count': False, 'model': 'StructureGraph', 'name': 'structure_graphs_list', 'description': 'see name'}, {'num_rows': 'all', 'count': False, 'model': 'StructureSet', 'name': 'structure_sets_list', 'description': 'see name'}, {'num_rows': 'all', 'count': False, 'model': 'Atlas', 'name': 'atlases_list', 'description': 'see name'}, {'count': False, 'only': ['atlases.id', 'atlases.name', 'atlases.image_type', 'ontologies.id', 'ontologies.name', 'structure_graphs.id', 'structure_graphs.name', 'graphic_group_labels.id', 'graphic_group_labels.name'], 'criteria_params': ['atlas_ids'], 'name': 'atlases_table', 'criteria': '{% if atlas_ids is defined %}[id$in{{ atlas_ids }}],{%endif%}structure_graph(ontology),graphic_group_labels', 'num_rows': 'all', 'model': 'Atlas', 'include': 'structure_graph(ontology),graphic_group_labels', 'description': 'see name'}, {'count': False, 'criteria_params': ['graph_ids'], 'name': 'structures_with_sets', 'criteria': '[graph_id$in{{ graph_ids }}]', 'num_rows': 'all', 'model': 'Structure', 'include': 'structure_sets', 'order': ['structures.graph_order'], 'description': 'see name'}, {'count': False, 'name': 'structure_sets_by_id', 'criteria_params': ['set_ids'], 'criteria': '[id$in{{ set_ids }}]', 'num_rows': 'all', 'model': 'StructureSet', 'description': 'see name'}]}
unpack_structure_set_ancestors(structure_dataframe)[source]

Convert a slash-separated structure_id_path field to a list.

Parameters:
structure_dataframe : DataFrame

structure data from the API

Returns:
None

A new column is added to the dataframe containing the ancestor list.