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, parcellation_id, region_id=None, feature_id=None, bbox=None)
Create a download bundle (zip) for the provided specification
Parameters:
Name | Type | Description | Default |
---|---|---|---|
space_id |
str
|
lookup id of the space requested |
required |
parcellation_id |
str
|
lookup_id of the parcellation requested |
required |
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
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
download
download_all(space_id, parcellation_id, region_id=None, feature_id=None, bbox=None)
Create a download bundle (zip) for the provided specification
Parameters:
Name | Type | Description | Default |
---|---|---|---|
space_id |
str
|
lookup id of the space requested |
required |
parcellation_id |
str
|
lookup_id of the parcellation requested |
required |
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
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
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='')
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. |