allensdk.core.cell_types_cache module

class allensdk.core.cell_types_cache.CellTypesCache(cache=True, manifest_file='cell_types_manifest.json', base_uri=None)[source]

Bases: allensdk.api.cache.Cache

Cache class for storing and accessing data from the Cell Types Database. By default, this class will cache any downloaded metadata or files in well known locations defined in a manifest file. This behavior can be disabled.

Parameters:
cache: boolean

Whether the class should save results of API queries to locations specified in the manifest file. Queries for files (as opposed to metadata) must have a file location. If caching is disabled, those locations must be specified in the function call (e.g. get_ephys_data(file_name=’file.nwb’)).

manifest_file: string

File name of the manifest to be read. Default is “cell_types_manifest.json”.

Attributes:
api: CellTypesApi instance

The object used for making API queries related to the Cell Types Database

CELLS_KEY = 'CELLS'
EPHYS_DATA_KEY = 'EPHYS_DATA'
EPHYS_FEATURES_KEY = 'EPHYS_FEATURES'
EPHYS_SWEEPS_KEY = 'EPHYS_SWEEPS'
MANIFEST_VERSION = '1.1'
MARKER_KEY = 'MARKER'
MORPHOLOGY_FEATURES_KEY = 'MORPHOLOGY_FEATURES'
RECONSTRUCTION_KEY = 'RECONSTRUCTION'
build_manifest(file_name)[source]

Construct a manifest for this Cache class and save it in a file.

Parameters:
file_name: string

File location to save the manifest.

get_all_features(dataframe=False, require_reconstruction=True)[source]

Download morphology and electrophysiology features for all cells and merge them into a single table.

Parameters:
dataframe: boolean

Return the output as a Pandas DataFrame. If False, return a list of dictionaries.

require_reconstruction: boolean

Only return ephys and morphology features for cells that have reconstructions. Default True.

get_cells(file_name=None, require_morphology=False, require_reconstruction=False, reporter_status=None, species=None, simple=True)[source]

Download metadata for all cells in the database and optionally return a subset filtered by whether or not they have a morphology or reconstruction.

Parameters:
file_name: string

File name to save/read the cell metadata as JSON. If file_name is None, the file_name will be pulled out of the manifest. If caching is disabled, no file will be saved. Default is None.

require_morphology: boolean

Filter out cells that have no morphological images.

require_reconstruction: boolean

Filter out cells that have no morphological reconstructions.

reporter_status: list

Filter for cells that have one or more cell reporter statuses.

species: list

Filter for cells that belong to one or more species. If None, return all. Must be one of [ CellTypesApi.MOUSE, CellTypesApi.HUMAN ].

get_ephys_data(specimen_id, file_name=None)[source]

Download electrophysiology traces for a single cell in the database.

Parameters:
specimen_id: int

The ID of a cell specimen to download.

file_name: string

File name to save/read the ephys features metadata as CSV. If file_name is None, the file_name will be pulled out of the manifest. If caching is disabled, no file will be saved. Default is None.

Returns:
NwbDataSet

A class instance with helper methods for retrieving stimulus and response traces out of an NWB file.

get_ephys_features(dataframe=False, file_name=None)[source]

Download electrophysiology features for all cells in the database.

Parameters:
file_name: string

File name to save/read the ephys features metadata as CSV. If file_name is None, the file_name will be pulled out of the manifest. If caching is disabled, no file will be saved. Default is None.

dataframe: boolean

Return the output as a Pandas DataFrame. If False, return a list of dictionaries.

get_ephys_sweeps(specimen_id, file_name=None)[source]

Download sweep metadata for a single cell specimen.

Parameters:
specimen_id: int

ID of a cell.

get_morphology_features(dataframe=False, file_name=None)[source]

Download morphology features for all cells with reconstructions in the database.

Parameters:
file_name: string

File name to save/read the ephys features metadata as CSV. If file_name is None, the file_name will be pulled out of the manifest. If caching is disabled, no file will be saved. Default is None.

dataframe: boolean

Return the output as a Pandas DataFrame. If False, return a list of dictionaries.

get_reconstruction(specimen_id, file_name=None)[source]

Download and open a reconstruction for a single cell in the database.

Parameters:
specimen_id: int

The ID of a cell specimen to download.

file_name: string

File name to save/read the reconstruction SWC. If file_name is None, the file_name will be pulled out of the manifest. If caching is disabled, no file will be saved. Default is None.

Returns:
Morphology

A class instance with methods for accessing morphology compartments.

get_reconstruction_markers(specimen_id, file_name=None)[source]

Download and open a reconstruction marker file for a single cell in the database.

Parameters:
specimen_id: int

The ID of a cell specimen to download.

file_name: string

File name to save/read the reconstruction marker. If file_name is None, the file_name will be pulled out of the manifest. If caching is disabled, no file will be saved. Default is None.

Returns:
Morphology

A class instance with methods for accessing morphology compartments.

class allensdk.core.cell_types_cache.ReporterStatus[source]

Valid strings for filtering by cell reporter status.

INDETERMINATE = None
NA = None
NEGATIVE = 'negative'
POSITIVE = 'positive'