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, 32923071)
build_rma(neuronal_model_id, fmt='json')[source]

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

Parameters:
neuronal_model_id : integer or string representation

key of experiment to retrieve.

fmt : string, optional

json (default) or xml

Returns:
string

RMA query url.

cache_data(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.

Parameters:
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(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.

Parameters:
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(**kwargs)[source]

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

Parameters:
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.

Returns:
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(neuronal_model_id)[source]

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

Returns:
list

A list of well known file id strings.

is_well_known_file_type(wkf, name)[source]

Check if a structure has the expected name.

Parameters:
wkf : dict

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

name : string

The expected type name

See also

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

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

Parameters:
json_parsed_data : dict

Response from the Allen Institute Api RMA.

Returns:
list of strings

Well known file ids.

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