ConnectomeMatch
Python implementation of preprocessing and significance testing with inexact graph matching accross a population.
This is a Python implementation built upon the techniques used in Osmanlıoğlu et al (2019).
It also allows for multi-threading of the more consuming proccesses (density matching and permutation testing).
Usage
First install the package.
pip install ConnectomeMatch
Then import
import ConnectomeMatch as cm
Preprocessing
Density Matching
Sometimes we are matching groups of graphs with different densities. For instance a sparse DTI-MRI connectome against a fully connected MEG connectome.
Given two group of N graphs (shape=N x Node x Node), we threshold the sample matrix to match the target matrix
sample_matrix = cm.match_density(sample_matrix, target_matrix, 0.2, 0.01,100)
Matching
One function executes the matching on the group level. It normalises per graph pair and allows for built in multithreading.
diagonal_matches, binary_matrices, euclidean_distances = cm.match_graphs(sample_matrix, target_matrix, njobs=4, log=True)
the function returns the matches along each graphs diagonal, binary matrixes for each participant and the euclidean distance between nodes of each graph.
Inference
A permutation function generates a null distribution of binary matches for the sample. This can then be compared to the average matching accuracy from binary matching matrices above
import numpy as np
null = cm.generate_null_dist(sample_matrix, target_matrix,perms=100, njobs=4) # get null distribution
montecarlo_thresh = np.percentile(null, 0.95, axis=2) # get threshold values for matching matrix
significance_mask = binary_matrices.mean(axis=0) > montecarlo_thresh # mask for all significant values
Metadata
Release files for ConnectomeMatch 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ConnectomeMatch-0.0.8.tar.gz | 11.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ConnectomeMatch-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.9 kB
Release files / ConnectomeMatch-0.0.8.tar.gz
| Download URL | ConnectomeMatch-0.0.8.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
568f41d1e78d4ba65f4aa58a7f2b45420f7703cad880ad2464dc17d7e54c98ee
|
|
BLAKE2b-256 checksum How to use checksums |
f56d59dd118a92cb3dee3eb2cb7254c039622a0d817ca30b20a3988b6fb1909d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.1
|
Release files / ConnectomeMatch-0.0.8-py3-none-any.whl
| Download URL | ConnectomeMatch-0.0.8-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5dd128c76bd63b7bac3a9d2dacd8f2567e2e93990f489db5c8eaa29f55d43fd1
|
|
BLAKE2b-256 checksum How to use checksums |
774d83257f64f703e85f8949008d120ce55bb387336a523855f8d3e8a6ec750b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.1
|