allensdk.api.queries.biophysical_api module

class allensdk.api.queries.biophysical_api.BiophysicalApi(base_uri=None)[source]

Bases: allensdk.api.queries.rma_template.RmaTemplate

BIOPHYSICAL_MODEL_TYPE_IDS = (491455321, 329230710)
build_rma(self, neuronal_model_id, fmt='json')[source]

Construct a query to find all files related to a neuronal model.

neuronal_model_id : integer or string representation

key of experiment to retrieve.

fmt : string, optional

json (default) or xml


RMA query url.

cache_data(self, neuronal_model_id, working_directory=None)[source]

Take a an experiment id, query the Api RMA to get well-known-files download the files, and store them in the working directory.

neuronal_model_id : int or string representation

found in the neuronal_model table in the api

working_directory : string

Absolute path name where the downloaded well-known files will be stored.

create_manifest(self, fit_path='', model_type='', stimulus_filename='', swc_morphology_path='', marker_path='', sweeps=[])[source]

Generate a json configuration file with parameters for a a biophysical experiment.

fit_path : string

filename of a json configuration file with cell parameters.

stimulus_filename : string

path to an NWB file with input currents.

swc_morphology_path : string

file in SWC format.

sweeps : array of integers

which sweeps in the stimulus file are to be used.

get_neuronal_models(self, specimen_ids, num_rows='all', count=False, model_type_ids=None, **kwargs)[source]

Fetch all of the biophysically detailed model records associated with a particular specimen_id

specimen_ids : list

One or more integer ids identifying specimen records.

num_rows : int, optional

how many records to retrieve. Default is ‘all’.

count : bool, optional

If True, return a count of the lines found by the query. Default is False.

model_type_ids : list, optional

One or more integer ids identifying categories of neuronal model. Defaults to all-active and perisomatic biophysical_models.

List of dict

Each element is a biophysical model record, containing a unique integer id, the id of the associated specimen, and the id of the model type to which this model belongs.

get_well_known_file_ids(self, neuronal_model_id)[source]

Query the current RMA endpoint with a neuronal_model id to get the corresponding well known file ids.


A list of well known file id strings.

is_well_known_file_type(self, wkf, name)[source]

Check if a structure has the expected name.

wkf : dict

A well-known-file structure with nested type information.

name : string

The expected type name

See also

where this helper function is used.
read_json(self, json_parsed_data)[source]

Get the list of well_known_file ids from a response body containing nested sample,microarray_slides,well_known_files.

json_parsed_data : dict

Response from the Allen Institute Api RMA.

list of strings

Well known file ids.

rma_templates = {'model_queries': [{'name': 'models_by_specimen', 'description': 'see name', 'model': 'NeuronalModel', 'num_rows': 'all', 'count': False, 'criteria': '[neuronal_model_template_id$in{{biophysical_model_types}}],[specimen_id$in{{specimen_ids}}]', 'criteria_params': ['specimen_ids', 'biophysical_model_types']}]}