Package Search Help

You can use boolean logic (e.g. AND/OR/NOT) for complex search queries. For more help and examples, see the search documentation.

Search by package name:
my-package (implicit)
name:my-package (explicit)

Search by package filename:
filename:my-package.ext 

Search by package tag:
tag:latest 

Search by package version:
version:1.0.0  prerelease:true (prereleases)
prerelease:false (no prereleases)

Search by package architecture:
architecture:x86_64 

Search by package distribution:
distribution:el 

Search by package license:
license:MIT 

Search by package format:
format:deb 

Search by package status:
status:in_progress 

Search by package file checksum:
checksum:5afba 

Search by package security status:
severity:critical 

Search by package vulnerabilities:
vulnerabilities:>1 
vulnerabilities:<1000 

Search by # of package downloads:
downloads:>8 
downloads:<100 

Search by package type:
type:binary 
type:source 

Search by package size (bytes):
size:>50000 
size:<10000 

Search by dependency name/version:
dependency:log4j 
dependency:log4j=1.0.0 
dependency:log4j>1.0.0 

Search by uploaded date:
uploaded:>"1 day ago" 
uploaded:<"August 14, 2022 EST" 

Search by entitlement token (identifier):
entitlement:3lKPVJPosCsY 

Search by policy violation:
policy_violated:true
deny_policy_violated:true
license_policy_violated:true
vulnerability_policy_violated:true

Search by repository:
repository:repo-name

Search by last download date:
last_downloaded:<"30 days ago" 
last_downloaded:>"August 14, 2022 EST" 

Search queries for all Debian-specific (and related) package types

Search by component:
deb_component:unstable

Search queries for all Maven-specific (and related) package types

Search by group ID:
maven_group_id:org.apache

Search queries for all Docker-specific (and related) package types

Search by image digest:
docker_image_digest:sha256:7c5..6d4
(full hashref only)

Search by layer digest:
docker_layer_digest:sha256:4c4..ae4
(full hashref only)

Search queries for all Generic-specific package types

Search by file path:
generic_filepath:path/to/file.txt

Search by directory:
generic_directory:path/to

Field type modifiers (depending on the type, you can influence behaviour)

For all queries, you can use:
~foo for negation

For string queries, you can use:
^foo to anchor to start of term
foo$ to anchor to end of term
foo*bar for fuzzy matching

For number/date or version queries, you can use:
>foo for values greater than
>=foo for values greater / equal
<foo for values less than
<=foo for values less / equal

Need a secure and centralised artifact repository to deliver Alpine, Cargo, CocoaPods, Composer, Conan, Conda, CRAN, Dart, Debian, Docker, Generic, Go, Helm, Hex, HuggingFace, LuaRocks, Maven, npm, NuGet, P2, Python, RedHat, Ruby, Swift, Terraform, Vagrant, VSX, Raw & More packages?

Cloudsmith is the new standard in Package / Artifact Management and Software Distribution.

With support for all major package formats, you can trust us to manage your software supply chain.

Start My Free Trial

Python logo brainnet-graph  0.2.0

One-liner (summary)

Graph construction from BOLD signal time series

Description

# 🧠 brainnet-graph

[![PyPI version](https://img.shields.io/pypi/v/brainnet-graph.svg)](https://pypi.org/project/brainnet-graph/) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Python](https://img.shields.io/badge/python-3.7+-brightgreen.svg)](https://www.python.org/) [![Docs](https://img.shields.io/badge/docs-online-blue)](https://brainnet-graph.readthedocs.io/)

---

> A lightweight, flexible Python package to construct brain connectivity graphs from ROI-level fMRI BOLD signals using multiple correlation-based methods.

---

## 🚀 Features

  • Supports raw time-series inputs: .csv, .tsv, .pkl
  • Build graphs using: - Pearson correlation - Partial correlation - Cosine similarity
  • Outputs in .pt (PyTorch Geometric Data) or .csv (edge list)
  • One-liner CLI usage
  • Easily integrable in pipelines or tutorials
  • Demo mode for quick testing
  • Built-in input validation & flexible formatting

---

## 📦 Installation

`bash pip install brainnet-graph `

Requires Python 3.7+

---

## 🧠 Concept

Given ROI-level fMRI BOLD signal data ( X in mathbb{R}^{T times N} ), where:

  • ( T ) = number of time points
  • ( N ) = number of brain regions (ROIs)

We construct an undirected, weighted graph ( G = (V, E, W) ) such that:

  • Each node ( v_i in V ) represents a brain region
  • Edges ( (v_i, v_j) in E ) are computed using a similarity or correlation measure between time series ( X_i ) and ( X_j )

---

## 🚀 Quick Start

## 🧪 Methods Supported

The following methods are supported to construct brain connectivity graphs from time-series data:

Method | Description |
------------------------------------------------ | --------------------------------------------------------------------- |
pearson_correlation | Classic Pearson correlation: linear association(rho(X_i, X_j)) |
spearman_correlation | Rank-based Spearman correlation |
kendall_correlation | Kendall’s tau correlation for ordinal association |
partial_correlation | Removes the effect of other ROIs using inverse covariance |
cosine_similarity | Measures angular similarity between ROI vectors |
correlations_correlation | Second-order correlation: similarity between ROI correlation profiles |
associated_high_order_fc | High-order FC using correlation of correlation vectors |
euclidean_distance | Distance-based connectivity (low = more similar) |
knn_graph | Builds graph using k-nearest neighbors (non-correlation) |
mutual_information | Nonlinear dependency estimation via mutual information |
cross_correlation | Temporal lagged correlation |
granger_causality | Temporal causal inference using Granger's test |
generalised_synchronisation_matrix | Dynamical systems synchrony —very slow |
patels_conditional_dependence_measures_kappa | Conditional dependence metric (Patel’s(kappa)) |
patels_conditional_dependence_measures_tau | Conditional dependence metric (Patel’s(tau)) |
lingam | Causal inference using LiNGAM model —very slow |

📌 Note:

  • Some methods like lingam and generalised_synchronisation_matrix are computationally intensive.
  • All methods return a connectivity matrix which is then converted to a PyTorch Geometric graph object or edge list CSV.
  • You can plug in your own method via code if desired (ask in GitHub Issues and we’ll help).

---

### 🛠️ From CLI

`bash construct-graph --input bold.csv --output graph.csv --method pearson_correlation `

### 📦 With Demo Data

`bash construct-graph --demo `

Save demo as PyTorch Geometric .pt:

`bash construct-graph --demo --format pt `

---

## 🧰 CLI Arguments

Flag | Description |
-------------------- | ------------------------------------------ |
--input, -i | Path to input BOLD signal (.csv/.tsv/.pkl) |
--output, -o | Output file path (.csv or .pt) |
--method, -m | Method to use (see above) |
--format, -f | Output format:csv or pt |
--demo | Run using generated toy dataset |

---

## 🧬 Python API

```python from brainnet_graph.construction import load_data, validate_data, construct_graph, save_graph

df = load_data("subject001.csv") validate_data(df) graph = construct_graph(df, method_name="pearson_correlation") save_graph(graph, "subject001_graph.csv", fmt="csv") ```

---

## 📁 Example

``` Input CSV (ROI x Time):

ROI_1, ROI_2, ROI_3, ... 0.24, 0.42, 0.11 0.30, 0.39, 0.14 ...

→ Graph → Edgelist or PyTorch Data object ```

---

## 📚 Output Format

### 🔹 CSV output

`csv source,target,weight 0,1,0.82 0,2,0.57 ... `

### 🔹 PyTorch Geometric .pt

`python Data(x=[10, 1], edge_index=[2, 45], edge_attr=[45, 1]) `

---

## 📷 Visual Example

Use NetworkX + PyTorch Geometric to visualize the graph:

```python import torch import networkx as nx from torch_geometric.utils import to_networkx

graph = torch.load("demo_graph.pt") G = to_networkx(graph) nx.draw(G, with_labels=True) ```

---

## 📖 Docs

Full documentation available at: 👉 https://brainnet-graph.readthedocs.io/

---

## 🛡 License

MIT License. See [LICENSE](LICENSE) for details.

---

## 🤝 Contributing

Open to contributions, new methods, bug reports, or real data testing.

---

## 🔗 Related

Size

11.1 KB

Downloads

5

Status  Completed
Checksum (MD5) 4d76443aed56b978f8baa250f89fa832
Checksum (SHA-1) d4dbe3ac0fb58317738f5c0f6d95f4e417db1cf3
Checksum (SHA-256) 47aa0cd2bdd685ff45eddb4945130a503ed7ba7694eeb45c85c52e2c49cb8a20
Checksum (SHA-512) fdf1b23fb4d5cf150d9515de8fe3e6415b36b330caf0248f760f11342c98b96793…
GPG Signature
GPG Fingerprint 6811684bac0b8895434e97bdd4391b8fb999e537
Storage Region  Dublin, Ireland
Type  Binary (contains binaries and binary artifacts)
Uploaded At 4 months, 3 weeks ago
Uploaded By Fetched by Cloudsmith
Slug Id brainnet_graph-020-py3-none-anywhl-jitb
Unique Id q757ZpKmLCVfNKyQ
Version (Raw) 0.2.0
Version (Parsed)
  • Major: 0
  • Minor: 2
  • Patch: 0
  • Type: SemVer (Compat)
  extended metadata
Author Songlin Zhao <your_email@example.com>
Classifiers License :: OSI Approved :: MIT License | Operating System :: OS Independent | Programming Language :: Python :: 3
Homepage URL https://github.com/yourname/brainnet-graph
Metadata Version 2.4
Py Filetype bdist_wheel
Py Version py3
Requires Dist matplotlib | numpy | pandas | scikit-learn | torch | torch-geometric | tqdm
Requires Python >=3.7
pkg brainnet_graph-0.2.0-py3-none-a… 5
11.1 KB
md5 sha1 sha256 sha512
Package Contents (brainnet_graph-0.2.0-py3-none-any.whl)
Loading...

This package has 11 files/directories.

Last scanned

4 months, 3 weeks ago

Scan result

Clean

Vulnerability count

0

Max. severity

Unknown

You can embed a badge in another website that shows this or the latest version of this package.

To embed the badge for this specific package version, use the following:

[![This version of 'brainnet-graph' @ Cloudsmith](https://api.cloudsmith.com/v1/badges/version/demo-docs/awesome-repo/python/brainnet-graph/0.2.0/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/?render=true)](https://cloudsmith.io/~demo-docs/repos/awesome-repo/packages/detail/python/brainnet-graph/0.2.0/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/)
|This version of 'brainnet-graph' @ Cloudsmith|
.. |This version of 'brainnet-graph' @ Cloudsmith| image:: https://api.cloudsmith.com/v1/badges/version/demo-docs/awesome-repo/python/brainnet-graph/0.2.0/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/?render=true
   :target: https://cloudsmith.io/~demo-docs/repos/awesome-repo/packages/detail/python/brainnet-graph/0.2.0/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/
image::https://api.cloudsmith.com/v1/badges/version/demo-docs/awesome-repo/python/brainnet-graph/0.2.0/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/?render=true[link="https://cloudsmith.io/~demo-docs/repos/awesome-repo/packages/detail/python/brainnet-graph/0.2.0/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/",title="This version of 'brainnet-graph' @ Cloudsmith"]
<a href="https://cloudsmith.io/~demo-docs/repos/awesome-repo/packages/detail/python/brainnet-graph/0.2.0/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/"><img src="https://api.cloudsmith.com/v1/badges/version/demo-docs/awesome-repo/python/brainnet-graph/0.2.0/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/?render=true" alt="This version of 'brainnet-graph' @ Cloudsmith" /></a>

rendered as: This version of 'brainnet-graph' @ Cloudsmith

To embed the badge for the latest package version, use the following:

[![Latest version of 'brainnet-graph' @ Cloudsmith](https://api.cloudsmith.com/v1/badges/version/demo-docs/awesome-repo/python/brainnet-graph/latest/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/?render=true&show_latest=true)](https://cloudsmith.io/~demo-docs/repos/awesome-repo/packages/detail/python/brainnet-graph/latest/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/)
|Latest version of 'brainnet-graph' @ Cloudsmith|
.. |Latest version of 'brainnet-graph' @ Cloudsmith| image:: https://api.cloudsmith.com/v1/badges/version/demo-docs/awesome-repo/python/brainnet-graph/latest/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/?render=true&show_latest=true
   :target: https://cloudsmith.io/~demo-docs/repos/awesome-repo/packages/detail/python/brainnet-graph/latest/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/
image::https://api.cloudsmith.com/v1/badges/version/demo-docs/awesome-repo/python/brainnet-graph/latest/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/?render=true&show_latest=true[link="https://cloudsmith.io/~demo-docs/repos/awesome-repo/packages/detail/python/brainnet-graph/latest/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/",title="Latest version of 'brainnet-graph' @ Cloudsmith"]
<a href="https://cloudsmith.io/~demo-docs/repos/awesome-repo/packages/detail/python/brainnet-graph/latest/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/"><img src="https://api.cloudsmith.com/v1/badges/version/demo-docs/awesome-repo/python/brainnet-graph/latest/a=noarch;xf=bdist_wheel;xn=brainnet-graph;xv=py3/?render=true&show_latest=true" alt="Latest version of 'brainnet-graph' @ Cloudsmith" /></a>

rendered as: Latest version of 'brainnet-graph' @ Cloudsmith

These instructions assume you have setup the repository first (or read it).

To install/use brainnet-graph @ version 0.2.0 ...

pip install 'brainnet-graph==0.2.0'

You can also install the latest version of this package:

pip install --upgrade 'brainnet-graph'

If necessary, you can specify the repository directly:

pip install \
  --index-url=https://dl.cloudsmith.io/public/demo-docs/awesome-repo/python/simple/ \
  brainnet-graph==0.2.0

If you've got a project requirements.txt file, you can specify this as a dependency:

--index-url=https://dl.cloudsmith.io/public/demo-docs/awesome-repo/python/simple/
brainnet-graph==0.2.0

In addition, you can use this repository as an extra index url. However, please read our documentation on this parameter before using it. For example in a requirements.txt file:

--extra-index-url=https://dl.cloudsmith.io/public/demo-docs/awesome-repo/python/simple/
brainnet-graph==0.2.0
Warning: We highly recommend using pip (or similar) rather than installing directly.
Top