Skip to main content

Braingraphgeo

codecov

Braingraphgeo is a package for performing analysis on structural brain networks using random geometric surrogate graphs.

Data and examples stem from a manuscript currently under review at NeuroImage:

Trinkle, S., Foxley, S., Wildenberg, G., Kasthuri, N., La Rivière, P., “The role of spatial embedding in mouse brain networks constructed from diffusion tractography and tracer injections,” Under review at NeuroImage, 2021.

For more information, see my blog post

Installation

braingraphgeo can be installed with pip:

pip install braingraphgeo

For local installation, first clone the repo:

git clone https://github.com/scott-trinkle/braingraphgeo.git

cd into the directory:

cd braingraphgeo

and run (preferably in a virtual environment):

pip install -e .

Usage

The primary utility of braingraphgeo is the creation of geometric surrogate graphs for statistical analysis of brain networks:

from braingraphgeo.surrogates import geomsurr

W = np.load(data_path)  # 2D weighted connectivity matrix
D = np.load(distance_path)  # 2D array of node distances

Wgeo = geomsurr(W,D)  # geometric surrogate connectivity matrix

The package also includes a number of utilities for creating additional random graphs, loading data, and generating useful data visualizations. It also integrates well with external graph theory packages such as networkx.

Examples for using braingraphgeo with the sample data are available as Jupyter notebooks in examples/

Data

Example data represent weighted structural brain graphs derived from neural tracer imaging and diffusion MRI tractography. Graphs are stored as weighted adjacency matrices in .csv files. Nodes are defined as anatomical regions detailed in the Allen Mouse Brain Atlas. "XXX-I" and "XXX-C" in the column and index titles of the data files represent ipsilateral and contralateral nodes, respectively. For access to the Allen brain atlas I recommend using the allensdk:

from allensdk.core.mouse_connectivity_cache import MouseConnectivityCache

mcc = MouseConnectivityCache()
tree = mcc.get_structure_tree()

Parcellation information for the 286 nodes in the datasets is also available in data/parcellation.csv which contains columns for Allen ID, Acronym, Full Name, and Brain Division.

Node locations in 3D physical coordinates are available in data/node_positions.csv

Edge weights for the tracer data (data/tracer.csv) are defined using the normalized connection density metric from the Knox computational model (code available here).

Edge weights for the dense (data/tract_dense_n*.csv) and endpoint (data/tract_endpoint_n*.csv) tractography graphs represent raw streamline counts between nodes, normalized by the product of the two node volumes. Tractography graphs were constructed from diffusion MRI data of postmortem mouse brains. All diffusion MRI data were collected at the University of Chicago, and tractography was performed with MRTrix3.

For fair comparison between tractography (based on an inherently symmetric diffusion metric) and tracers (based on injections to a single hemisphere), graphs have been made undirected and have enforced hemispheric symmetry: W = W.T.

Distances between nodes are available in the same format in data/fiber_distances.csv. Distances are measured in mm and represent the shortest streamline connecting each pair of nodes averaged across all tractography datasets.

Metadata

Release files for braingraphgeo 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for braingraphgeo 0.4
File Size Uploaded Provenance Actions
braingraphgeo-0.4.tar.gz 12.0 kB Without provenance Details for braingraphgeo-0.4.tar.gz

Release files / braingraphgeo-0.4.tar.gz

Download URL braingraphgeo-0.4.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e518a6c44390b15256bbed0d0e711d7f3d418eeb726524011b7ac4add316d57b
BLAKE2b-256 checksum
How to use checksums
766367c59448fc86223a743d663ce9a726e563f842ed870006e46d25b66f4475
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10

Security for braingraphgeo 0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page