BraiAn python library (BraiAnalyse)
BraiAnalyse a modular Python library for the easy navigation, visualisation, and analysis of whole-brain quantification outputs. The input data can either be from QuPath, with little-to-no work thanks to BraiAn for QuPath or any other software of brain cell segmentation (e.g. Clearmap).
Its aim is to give you a framework to build your own analysis, typically comparing multiple markers across groups of animals across the entire brain. It provides statistical tools optimized for whole-brain analysis of multiple markers allowing the identification of the whole-brain sets of regions that differ between groups and visualising data in interactive and informative plots.
Beta Software
braian
, while already being a capable and extensible library, is still under development. Some functionalities might expose non-intuitive interfaces, others could be outright buggy. For this reason, we still consider it in beta stage.
If you encounter any problem, we strongly encourage to let us know so that we can work together on improving BraiAn!
Installation
Once you are in an active python>=3.11,<3.13
environment, you can run:
python3 -m pip install braian
Getting started
Package organization
The braian
package wants to help neuroscientists in three main tasks. For each of them, we designed a dedicated sub-module:
braian
: intended for importing brain data from different sources (e.g. QuPath) and checking data integrity against a brain atlas ontology. It can also prepare the data in cohorts/groups and experiments;braian.stats
: intended for brain data normalization, aggregation and group and markers statistical analysis;braian.plot
: intended for brain data visualisation, in an interactive intuitive manner.
Overall, BraiAn aims at exposing non-trivial operations with an intuitive interface. Nonetheless, the user is required to have basic programming skills in order ensure the statistical analyses are performed accordingly to the parameters that better suits their needs.
Configuration file
Just like BraiAn for QuPath, braian
can use a YAML configuration file to store metadata about an experiment along with some additional parameters. Such file can be read in braian
and used to apply a consistent analysis parameters across all animals and runs.
For a detailed explanation on how to format such file and understanding what each parameter does, we suggest to look at this example YAML file and BraiAnConfig
API.
Prebaked analysis
Examples of available whole-brain statistical analysis provided by braian are:
- braian.stats.PLS
- braian.stats.density
- braian.stats.percentage
- braian.stats.relative_density
- braian.stats.fold_change
- braian.stats.diff_change
- braian.stats.markers_overlap
- braian.stats.markers_jaccard_index
- braian.stats.markers_similarity_index
- braian.stats.markers_overlap_coefficient
- braian.stats.markers_difference
- braian.stats.markers_correlation
Building
Prerequisites
-
python>=3.11: you can use conda or pyenv/pyenv-win to manage the correct version
-
Poetry: for dependency management
Step 1: Set-up an environment for BraiAn
Create and activate a new python>=3.11,<3.13
environment.
Using conda :
|
Using python venv:
python3.11 -m venv /path/to/new/braian_env
and activate it
|
Step 2: clone the repository
git clone https://codeberg.org/SilvaLab/BraiAn.git /path/to/BraiAn
Step 3: install BraiAn inside the environment with Poetry
With the environment set and Poetry installed:
(braian_env) cd /path/to/BraiAn
(braian_env) poetry install # --with docs, if building the documentation is of your interest