api.common.data_handlers
compounds
ROLE = os.environ.get('SIIBRA_API_ROLE', 'all')
module-attribute
ROLE
data_decorator(role)
data decorator
Extensively used in api.common.data_handlers. Most of the business logic, including data fetching, serialization, etc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
role |
ROLE_TYPE
|
Role of this process |
required |
Raises:
| Type | Description |
|---|---|
ImportError
|
Celery not installed, but role is set to either |
Source code in api/common/decorators.py
download_all(space_id=None, parcellation_id=None, region_id=None, feature_id=None, bbox=None, strict_mode=None)
Create a download bundle (zip) for the provided specification
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
space_id |
str
|
lookup id of the space requested |
None
|
parcellation_id |
str
|
lookup_id of the parcellation requested |
None
|
region_id |
str
|
lookup_id of the region requested |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the zip file |
Source code in api/common/data_handlers/compounds/download.py
download
download_all(space_id=None, parcellation_id=None, region_id=None, feature_id=None, bbox=None, strict_mode=None)
Create a download bundle (zip) for the provided specification
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
space_id |
str
|
lookup id of the space requested |
None
|
parcellation_id |
str
|
lookup_id of the parcellation requested |
None
|
region_id |
str
|
lookup_id of the region requested |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the zip file |
Source code in api/common/data_handlers/compounds/download.py
core
atlas
all_atlases()
Get all atlases
Returns:
| Type | Description |
|---|---|
List[Dict]
|
List of all serialized atlases. |
Source code in api/common/data_handlers/core/atlas.py
single_atlas(atlas_id)
Get a single atlas
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atlas_id |
str
|
id of the atlas |
required |
Returns:
| Type | Description |
|---|---|
Dict
|
The atlas specified by the provided id, serialized into dict |
Source code in api/common/data_handlers/core/atlas.py
misc
cache_region_statistic_map(parcellation_id, region_id, space_id)
Retrieve and save regional statistical map (if necessary), and then return the path of the map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parcellation_id |
str
|
lookup id of the parcellation of the map |
required |
region_id |
str
|
lookup id of the region of the map |
required |
space_id |
str
|
lookup id of the space of the map |
required |
Returns:
| Type | Description |
|---|---|
Tuple[str, bool]
|
path to statistical map, if a cached file is returned |
Source code in api/common/data_handlers/core/misc.py
get_map(parcellation_id, space_id, maptype)
Get a map instance, based on specification
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parcellation_id |
str
|
lookup id of the parcellation of the map |
required |
space_id |
str
|
lookup id of the space of the map |
required |
maptype |
Union[MapType, str]
|
maptype, either LABELLED or STATISTICAL |
required |
Returns:
| Type | Description |
|---|---|
Dict
|
Requested map instance, serialized into dict |
Raises:
| Type | Description |
|---|---|
AssertionError
|
if the supplied maptype is invalid type |
NotFound
|
Map with the specification not found |
Source code in api/common/data_handlers/core/misc.py
get_parcellation_labelled_map(parcellation_id, space_id, region_id=None)
Retrieve and save labelled map / regional mask (if necessary), and then return the path of the map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parcellation_id |
str
|
lookup id of the parcellation of the map |
required |
region_id |
str
|
lookup id of the region of the map |
None
|
space_id |
str
|
lookup id of the space of the map |
required |
Returns:
| Type | Description |
|---|---|
|
path to labelled map/regional mask, if a cached file is returned |
Source code in api/common/data_handlers/core/misc.py
get_region_statistic_map(parcellation_id, region_id, space_id)
Retrieve and save regional statistical map (if necessary), and then return the path of the map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parcellation_id |
str
|
lookup id of the parcellation of the map |
required |
region_id |
str
|
lookup id of the region of the map |
required |
space_id |
str
|
lookup id of the space of the map |
required |
Returns:
| Type | Description |
|---|---|
|
path to statistical map, if a cached file is returned |
Source code in api/common/data_handlers/core/misc.py
get_region_statistic_map_info(parcellation_id, region_id, space_id)
Retrieve and save regional statistical map (if necessary), and then return the path of the map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parcellation_id |
str
|
lookup id of the parcellation of the map |
required |
region_id |
str
|
lookup id of the region of the map |
required |
space_id |
str
|
lookup id of the space of the map |
required |
Returns:
| Type | Description |
|---|---|
|
dict of min an max of the statistical map |
Source code in api/common/data_handlers/core/misc.py
get_resampled_map(parcellation_id, space_id, name=None)
Retrieve and save a labelled map, resampled in space (if necessary), and then return the path of the map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parcellation_id |
str
|
lookup id of the parcellation of the map |
required |
space_id |
str
|
lookup id of the target space of the sampled map |
required |
Returns:
| Type | Description |
|---|---|
|
path to statistical map, if a cached file is returned |
Source code in api/common/data_handlers/core/misc.py
parcellation
all_parcellations()
Get all parcellations
Returns:
| Type | Description |
|---|---|
|
List of all serialized parcellations |
Source code in api/common/data_handlers/core/parcellation.py
single_parcellation(parc_id)
Get a single parcellation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parc_id |
str
|
id of the parcellation |
required |
Returns:
| Type | Description |
|---|---|
|
The parcellation specified by the provided id, serialized into dict |
Source code in api/common/data_handlers/core/parcellation.py
region
all_regions(parcellation_id, find=None)
Get all regions, categorised under the parcellation specified by parcellation_id, optionally filtered by find.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parcellation_id |
str
|
id of the parcellation, under which regions will be fetched |
required |
find |
str
|
string to search for |
None
|
Returns:
| Type | Description |
|---|---|
List
|
List of all serialized regions |
Source code in api/common/data_handlers/core/region.py
get_related_regions(parcellation_id, region_id)
Get related regions, including the relationship qualification.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parcellation_id |
str
|
id of the parcellation, under which the regions will be fetched |
required |
region_id |
str
|
lookup id of the region |
required |
Returns:
| Type | Description |
|---|---|
|
List of RegionalRelationshipAssessments, serialized |
Source code in api/common/data_handlers/core/region.py
single_region(parcellation_id, region_id, space_id=None)
Get a single region, categorised under parcellation specified by parcellation_id, defined by region_id.
If space_id optional parameter is supplied, additional information about the region in the space will also be returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parcellation_id |
str
|
id of the parcellation, under which the regions will be fetched |
required |
region_id |
str
|
lookup id of the region |
required |
space_id |
str
|
additional information about the region in the provided space |
None
|
Returns:
| Type | Description |
|---|---|
|
The region, specified by the criteria, serialized. |
Source code in api/common/data_handlers/core/region.py
space
all_spaces()
Get all spaces
Returns:
| Type | Description |
|---|---|
List
|
List of all serialized spaces. |
Source code in api/common/data_handlers/core/space.py
single_space(space_id)
Get a single space
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
space_id |
str
|
lookup id of the space |
required |
Returns:
| Type | Description |
|---|---|
Dict
|
The space specified by the provided id, serialized into Dict |
Source code in api/common/data_handlers/core/space.py
features
misc
get_genes(find=None)
Get all genes
Returns:
| Type | Description |
|---|---|
|
List of the genes. |
Source code in api/common/data_handlers/features/misc.py
types
all_feature_types()
Get all feature types
Returns:
| Type | Description |
|---|---|
List[Dict[str, str]]
|
List of all features, including their name, and inheritance from Feature |
Source code in api/common/data_handlers/features/types.py
vocabularies
gene
get_genes(find=None)
Get all genes
Returns:
| Type | Description |
|---|---|
|
List of the genes. |