siibra - Software interfaces for interacting with brain atlases
Project description
siibra-python - Software interface for interacting with brain atlases
Authors: Big Data Analytics Group, Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
Copyright 2020-2021, Forschungszentrum Jülich GmbH
siibra-python
is still at an experimental stage. The API of the library is not
stable, and the software is not yet fully tested. You are welcome to install and
test it, but be aware that you will likely encounter bugs.
siibra
is a Python client for interacting with "multilevel" brain atlases,
which combine multiple brain parcellations and neuroscience datasets across
different reference template spaces. It is designed to allow safe and
convenient interaction with brain regions from different parcellations, to
provide streamlined access to multimodal data features linked to brain regions,
and to perform basic analyses of region-specific data features. The intention
of siibra
is to unify interaction with brain atlas data at different spatial
scales, including parcellations and datasets at the millimeter scale in MNI
space, as well as microstructural maps and microscopic data in the BigBrain space.
siibra
is largely developed inside the Human Brain Project for accessing the human brain atlas of EBRAINS.
It retrieves most of its concept and datasets from the EBRAINS Knowledge Graph, and is designed to support the recently established OpenMINDS metadata standards.
The functionality of siibra
matches common actions known from browsing the EBRAINS Interactive Atlas Viewer: Selecting different
parcellations, browsing and searching brain region hierarchies, downloading maps, selecting regions, and accessing multimodal data features
associated with brain regions.
A key feature is a streamlined implementation of performing structured data queries for selected brain regions, which gives access to multimodal regional “data features”.
siibra
implements a hierarchy of features, which unifies handling of spatial data features (which are linked to atlas regions via coordinates; like contact points of physiological electrodes), regional data features (which are linked to atlases via a brain region specifications, like cell densities or neurotransmitter distributions) and global data features (linked to an atlas via the whole brain or parcellation, like connectivity matrices or activation maps).
As a result, all forms of data features can be queried using the same mechanism (get_features()
) which takes as an argument a specification of the desired data modality, and respects the current selections made in the atlas.
Currently, available data features include neurotransmitter densities, regional connectivity profiles, connectivity matrices, gene expressions, and spatial properties of brain regions.
Additional features, including distributions of neuronal cells, functional activation maps and electrophysiologal recordings, will become available soon.
siibra
hides much of the complexity that would be required to interact with the individual data repositories that host the associated data.
By encapsulating many aspects of interacting with different maps and reference templates spaces, it also minimizes common risks like misinterpretation of coordinates from different reference spaces, or utilisation of inconsistent versions of parcellation maps.
It aims to provide a safe way of using maps defined across multiple spatial scales.
Installation
siibra
is available on pypi.
To install the latest version, simply run pip install siibra-python
.
Authentication
siibra
retrieves data from the EBRAINS Knowledge Graph, which requires
authentication. Therefore you have to provide an EBRAINS authentication token for using siibra
.
Please make sure that you have a valid EBRAINS user account by registering to EBRAINS, and follow the guidelines to get an EBRAINS API token.
As a last step, you need to obtain an authentication token from the authorization endpoint and make it known to siibra
.
There are two ways to do so:
- Set an environment variable HBP_AUTH_TOKEN with the token. The client will then use it automatically.
- Set it programmatically by getting an instance of Authentication as follows:
from siibra.authentication import Authentication
auth = Authentication.instance()
auth.set_token(TOKEN)
Note that as of now, you need to get a new token approximately every day to
perform EBRAINS data queries. However, siibra
implements a local cache on
your harddisk, so once retrieved, your data will become usable and accessible
without refreshing the token.
Usage examples
To get familiar with siibra
, we recommend to checkout the jupyter notebooks in the examples/
subfolder of this repository.
Below are some code snippets to give you an initial idea.
Retrieving receptor densities for one brain area
import siibra as sb
# NOTE: assumes the client is already authenticated, see above
atlas = sb.atlases.MULTILEVEL_HUMAN_ATLAS
atlas.select_region('v1')
features = atlas.get_features(
sb.features.modalities.ReceptorDistribution)
for r in features:
fig = r.plot(r.region)
Retrieving gene expressions for one brain area
import siibra as sb
from nilearn import plotting
atlas = sb.atlases.MULTILEVEL_HUMAN_ATLAS
# request gene expressions from Allen Atlas
atlas.select_region("v1 left")
features = atlas.get_features(
sb.features.modalities.GeneExpression,
gene=sb.features.gene_names.GABARAPL2 )
print(features[0])
# plot
all_coords = [tuple(g.location) for g in features]
mask = atlas.get_mask(sb.spaces.MNI_152_ICBM_2009C_NONLINEAR_ASYMMETRIC)
display = plotting.plot_roi(mask)
display.add_markers(all_coords,marker_size=5)
Acknowledgements
This software code is funded from the European Union’s Horizon 2020 Framework Programme for Research and Innovation under the Specific Grant Agreement No. 945539 (Human Brain Project SGA3).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file siibra-0.0.8.9.dev1.tar.gz
.
File metadata
- Download URL: siibra-0.0.8.9.dev1.tar.gz
- Upload date:
- Size: 45.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7cb5d2e3e475fc6237989e9c66c5a0d4d9c0d8d852c1f40219268936772eaf4 |
|
MD5 | 49b49b8d52d109643f0db719268d1f62 |
|
BLAKE2b-256 | 33ab2dbd22e60800effae0d338973ce2ebd18d7d79b855da6d4acecc11fdacaa |
File details
Details for the file siibra-0.0.8.9.dev1-py3-none-any.whl
.
File metadata
- Download URL: siibra-0.0.8.9.dev1-py3-none-any.whl
- Upload date:
- Size: 53.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15080d1d0d0492df88533a75914da24a429b3faf36e65c78c9804c0e2cde51be |
|
MD5 | a99bd194b32b162625c45277643ca64a |
|
BLAKE2b-256 | 7823a542073ef8f6937743ba786351a27979184d210da6e9eec2138febec3058 |