# WireType Related predictions, model weights and relevant data available at - https://doi.org/10.5281/zenodo.23325190 The pipeline computes connectivity features for every neuron of a connectome, trains WireType, a transformer encoder, on one volume's transmitter labels, applies the frozen encoder to a second volume, and fits and scores probes on its embeddings. It reads the FlyWire v783 release of the female adult fly brain (FAFB) and the v1.0 release of the male central nervous system (MCNS), and runs in either direction. ## Model ![Connectivity features and input scaling](docs/images/connectivity_features.png) **Connectivity features.** Each neuron is described by 31 numbers in five families: degree (a), connection weights (b), random-walk return (c), trophic level (d) and local motifs (e). Every feature is standardised with the mean and standard deviation of the source volume's training neurons, and the same values are applied to the target (f). `src/wiretype/data/features.py` computes degree and connection weights, loads the other families (precomputed by `scripts/rwse.py`, `scripts/flow.py` and `scripts/local.py`), selects the 31 columns listed in `src/wiretype/data/column_sets/refined.json` and standardises them. Supplementary file 1 (`docs/supplementary/`, written by `scripts/supplementary_file_1.py`) defines all 47 candidate features. ![Tokens, encoder, training and transfer](docs/images/model.png) **Encoder, training and transfer.** (a) A neuron and its 64 strongest partners give 65 tokens (`scripts/topk.py`, `src/wiretype/model/tokens.py`). Four attention blocks read them together with a learned summary token, whose output is the neuron's embedding (`CellEncoder` in `src/wiretype/model/encoder.py`). (b) `scripts/train.py` trains the encoder to predict, from the neuron without its label, how a frozen copy's output changes when the transmitter label is added (the target is `displacement` in `tokens.py`; the predictor is `Predictor` in `encoder.py`). (c) `scripts/transfer.py` applies the frozen encoder to the target with the source's feature scaling, and probes fitted on the source (`src/wiretype/eval/transfer.py`). ## Repository layout | path | contents | |---|---| | `src/wiretype/` | the package: `data/` (intake, labels, features, splits, scope), `model/` (encoder, tokens), `eval/` (probes, transfer, release) | | `scripts/` | one entry point per pipeline stage | | `scripts/diagnostics/` | analyses of saved predictions and embeddings | | `hpc/` | Grid Engine job scripts (`hpc/jobs/`), the submission script for the paper's runs, environment setup | | `envs/` | lock files of the environments used (`envs/README.md`) | | `tests/` | `check_release.py`, run before the release tables are built | | `docs/` | Supplementary file 1 and the images above | | `data/raw/`, `data/processed/` | the input releases and the pipeline's intermediate tables (not tracked) | | `experiments/` | outputs: checkpoints, reports, predictions and embeddings (not tracked) | | `logs/` | job logs (not tracked) | ## Installation **Local** (diagnostics, label audit, release tables; no torch): ```bash uv venv --python 3.11 .venv && uv pip install --python .venv/bin/python -r envs/local.txt ``` Local scripts run the package from `src/`, as `PYTHONPATH=src .venv/bin/python