Skip to main content

A library for doing efficient operations on neural circuits

Project description

rusted_circuits

Exposing useful operations to manipulate the neural circuits that can be derived from Flywire, a project which maps out the Drosophila brain.

In my research, I found myself repeatedly needing to find a minimal circuit (connectivity-wise) that contains the smallest subcircuit containing all paths between a set of source and sink neurons (nodes, whatever). The python code I used was too slow, even considering various biological priors (e.g. I think it's possible to traverse from most neurons to almost any other within 5 jumps, and if you can't then it's probably not possible).

Written in Rust, exposed in Python.

Design

We support two main "modes", where the user passes in edge information as a list of tuples [(pre_1, post_1, pre_1, post_2, ...)] and as a np.ndarray of 2 dimensions. Under the hood, both use the same code, but there is a shim layer as rust doesn't have function overloads.

Example

Smallest Subcircuit

Here is a simple working example, where we have a linear path from source (1) to sink (5)

edge_list = np.asarray([(1, 2), (2, 3), (3, 4), (4, 5)])
sources = {1}
sinks = {5}
max_depth = 10
max_paths = 100

# The nid_to_cidx_map is optional, and if it is not specified, we derive the mapping of the neuron-id-to-connectivity-matrix-index.
nid_to_cidx_map = {1: 10, 2: 20, 3: 30, 4: 40, 5: 50}

# Expected: all nodes on the path from source to sink
expected = {10, 20, 30, 40, 50}
actual_np = isolate_subcircuit_np_edgelist(edge_list, sources, sinks, max_depth, max_paths, nid_to_cidx_map)

# -OR-, from a list
actual_list = isolate_subcircuit(edge_list.tolist(), sources, sinks, max_depth, max_paths, nid_to_cidx_map)

Maintainers

  1. Add whatever code using git add ...

  2. Add a commit message e.g. git commit -m '...'

Note: replace VERSION_NUMBER below by an actual version number e.g. v0.1.0

  1. git tag $VERSION_NUMBER

  2. git push origin $VERSION_NUMBER

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

circuit_rs-0.3.0.tar.gz (42.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

circuit_rs-0.3.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (363.2 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

circuit_rs-0.3.0-cp314-cp314-manylinux_2_17_i686.manylinux2014_i686.whl (389.4 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ i686

circuit_rs-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (363.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

circuit_rs-0.3.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl (389.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ i686

circuit_rs-0.3.0-cp313-cp313-macosx_11_0_arm64.whl (317.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

circuit_rs-0.3.0-cp313-cp313-macosx_10_12_x86_64.whl (327.7 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

circuit_rs-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (363.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

circuit_rs-0.3.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (389.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686

circuit_rs-0.3.0-cp312-cp312-macosx_11_0_arm64.whl (316.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

circuit_rs-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl (327.4 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

Details for the file circuit_rs-0.3.0.tar.gz.

File metadata

  • Download URL: circuit_rs-0.3.0.tar.gz
  • Upload date:
  • Size: 42.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for circuit_rs-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ca967889a78a192ab1f1855b5c3c815365364579df5e2c5bb18a4cd61bbf609f
MD5 4a2fe8d16f6222a0572e5c1918623962
BLAKE2b-256 2bbba8887be010dcce346329ee4e3e3660ab6ddd05dc79c5d94698965ae1dacc

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.0.tar.gz:

Publisher: CI.yml on oahmedlab/circuit-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file circuit_rs-0.3.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9adf4305548d763d7ebdbc7065bebb0f161268e78da182bd243c8af88b0cb88c
MD5 3e8d2ccbe4c96c453bd632393cfe634f
BLAKE2b-256 1b31226c7d8deb038910956348270eda80a3a65f86581667bab34352c510ce56

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on oahmedlab/circuit-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file circuit_rs-0.3.0-cp314-cp314-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.0-cp314-cp314-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 942ad70ca4b7f13a5a18ada55c4b17c2194fdc72427a3a1e991b7624d2ebaf29
MD5 a3cae51fb1dff12dc5914a7dbcbadf75
BLAKE2b-256 c32fa2ee75370300c8ba0947e6b5ee7f91a32c4e4888e09304d0d8ed6e1d7e84

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.0-cp314-cp314-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: CI.yml on oahmedlab/circuit-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file circuit_rs-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 398fc24e7783e7b695654b563a1205ccff061c46555e170869512be25bd89420
MD5 957484d9cf66243816e93e939bc6496c
BLAKE2b-256 771dd68b696f693e8bf147d28aae5141888dd452d4ae8c1cc4112de2f947457e

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on oahmedlab/circuit-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file circuit_rs-0.3.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 283c34ee66b6cb5a6766d6c19c0bc5a1dcb4a31fa5ab3e3c6788dfa5362ba8e4
MD5 c290f4ad67d0e4aacbec232c37e4f070
BLAKE2b-256 05685b45e2a1d4e330da5105cbdc262bb83342d3e6a0bd2273cfa664998f2116

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: CI.yml on oahmedlab/circuit-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file circuit_rs-0.3.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b4a08baf58bb9d946702aba931e0e3c233a841b748b835061262703429f8af4c
MD5 8f003502c787f6297e7ea9d4c6989302
BLAKE2b-256 afe79aec78786ccf769c8e57ed6c8f22978d4b494826e0595edc6eaccd95e616

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: CI.yml on oahmedlab/circuit-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file circuit_rs-0.3.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f938a561e85b4975d2ee407ccee123dda7ca5b30439167747380fe29ab33be4d
MD5 0f6bf88b510befb9ef4d4fed77390b29
BLAKE2b-256 0460ca9ae5ffc804e32740ed7b059acd7dc86655e7036e8ac91377b094045e73

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.0-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: CI.yml on oahmedlab/circuit-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file circuit_rs-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3fa70b08bb532c7c6960a3999c9adb0016b4d90e1cdf8062ef88f76545a1cd3c
MD5 7d5a52a33bedc6cd9a01c154c41faa97
BLAKE2b-256 cb7e2e0e6c0f1547f38f7dfd25aec43103ab17ae35131ebf8dfe18b8d3e821f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on oahmedlab/circuit-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file circuit_rs-0.3.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 49b8fa2835ca0be84cc5e33ed029913f1a008798310671836135e0be1a94334d
MD5 a1c537b0016610fc8d9e64c2bdbe47eb
BLAKE2b-256 76afa5219c3ca98de442074d7c5d2725bb1a5f4f403d1e1f283437d8b02dc63f

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: CI.yml on oahmedlab/circuit-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file circuit_rs-0.3.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 894e00b0a9a6c9b03aa86c5205eb4f8828b0f5f63490b24ab36fa49226856cb4
MD5 866685f6303c287669b4bce0f2c8e5f4
BLAKE2b-256 552db9e404791722470e6f925be4fefd1bd770cb94d357088eab16386d70e7e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: CI.yml on oahmedlab/circuit-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file circuit_rs-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2619066d5c8e4b5fed75564a909f772a1aa211cd8f7332210296b42a7f257e0a
MD5 0d79001157516b0df5f941bea2d7d748
BLAKE2b-256 8e8d02149054754969757bc49459ae2fdaa8fd29c6d7cec0510c056757cc4d8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: CI.yml on oahmedlab/circuit-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page