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. Modify Cargo.toml, the version to be the same (not strictly necessary, but it's just nicer).

  3. 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.1.tar.gz (42.6 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.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (363.3 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

circuit_rs-0.3.1-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.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (363.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

circuit_rs-0.3.1-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.1-cp313-cp313-macosx_11_0_arm64.whl (317.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

circuit_rs-0.3.1-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.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (363.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

circuit_rs-0.3.1-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.1-cp312-cp312-macosx_11_0_arm64.whl (316.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

circuit_rs-0.3.1-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.1.tar.gz.

File metadata

  • Download URL: circuit_rs-0.3.1.tar.gz
  • Upload date:
  • Size: 42.6 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.1.tar.gz
Algorithm Hash digest
SHA256 fc7941d1e38fda92924d4afb7c65da4faca539dfc5ae09d4ea5984ce26c1a11b
MD5 03277b92fe2cb042c138645c984ab4e3
BLAKE2b-256 7f3f4ec79d17e334bdf188514a88bb2eac94981976084f158a10b76dcf43e245

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.1.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.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2fa5728698d045662c9910b954d38425f30c7eb3f0c9e6f0746b32d5328275ff
MD5 84c7775800160fb439d370e513d99812
BLAKE2b-256 2c7d1ec9de4597558fa1220695d7766c7839fcba906f1d341c7444ba4f14383a

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.1-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.1-cp314-cp314-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.1-cp314-cp314-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 2dc30fce6fb920f32a5fd6eef151cc6b5ea1f25dd51df19f5b7266ad13e49341
MD5 6e1ef23e8cb9aa629a2e636bba44f7b3
BLAKE2b-256 7ce92c1843806e24b4ab2cd81d2bebd37d7511deae3eece4f9e625985735473b

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.1-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.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a8aa7f365a6a517a271eaaf01e01141e461fda6b9965d217a5c6f24256d5c11d
MD5 a821338d9839777cb7c86fc2500cfd18
BLAKE2b-256 ca75de99ab832838729d1240498c6846007643e4d360cacbb8286876e6af3a2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.1-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.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 63e447bff458a68ae82c54ccce6732798538705aa5fefe480c370e1ecb993854
MD5 92141634a19356e339f0642d41aabfa5
BLAKE2b-256 f17f122f93ad350e9aff6cafe083ac230ea9ccc2d01ce4abebd688f534d85acb

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.1-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.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 683d18ce6a740a2df056691aad3ffa80c0615b578bdb9badaaf57692fd66172b
MD5 1a718c6b0dce549c4ef314b2f2d80200
BLAKE2b-256 e815f16d5c6d884442846b0411619ca424b446f6a5992f2d84c07c02d80b382a

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.1-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.1-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4efa03bce6dd8cc6d1b9825bbba9690b725e5469ce5a884a71f0054add3ed144
MD5 ff72f31d7ad91ce80908da132cfe1598
BLAKE2b-256 7b9e50e799972e986b982039fb07527b4b3ed1fdd234188051402e7f414eea68

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.1-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.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1065bd60e28f5c32febc8c421fcb0ae323b1c6736741605e6bde1bbaa361f965
MD5 d84b11d058b6e8fb4e0cf14f92e25b68
BLAKE2b-256 3777fd388691243ddd7e5465c907926ef7f96c04be495a712a7c5f5d4f7840d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.1-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.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6688284d5568416158192c9602a3daceca3551789e36533e28a14b79d9e835c4
MD5 a3f2c616b7cd830a8ac3be29c008f0b0
BLAKE2b-256 f1b260f03de7eed7b39e4c95cf7e299bc5d3d721a3f0205544ee6f376a1ff2eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.1-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.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 61c2fd9404ad6f7113b3ec548837b2b06a758a0dd872bf5f02fb4f1b358258c4
MD5 c8c81b6e5599cf1ff4d324688a2a9947
BLAKE2b-256 39cd4640aa5dc821f80ecfbe35950d0374102a435c929e9f021e4e16240c585d

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.1-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.1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for circuit_rs-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c6755d2a036e991bda3ec855f67a937075c50cfe65a071e4d154f6d8acbb39a1
MD5 73a4e7389ee71e534d96553da277d45d
BLAKE2b-256 1f0fd1572ecd921287c950ef1cac3201fdcafd357ad2623e9e3bdd730e5f628a

See more details on using hashes here.

Provenance

The following attestation bundles were made for circuit_rs-0.3.1-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