{"id":31296742,"url":"https://github.com/jabae/cnapse","last_synced_at":"2026-05-18T02:03:05.728Z","repository":{"id":50450735,"uuid":"440057785","full_name":"jabae/Cnapse","owner":"jabae","description":"Automated synapse detection in C. elegans EM images.","archived":false,"fork":false,"pushed_at":"2024-01-16T01:26:18.000Z","size":11881,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-05T04:31:56.950Z","etag":null,"topics":["connectomics","deep-learning","electron-microscopy","image-processing","python","python3","segmentation"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jabae.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-12-20T05:54:12.000Z","updated_at":"2023-03-25T03:23:08.000Z","dependencies_parsed_at":"2024-01-16T03:15:35.150Z","dependency_job_id":"43e9cd38-595c-448a-b873-8a2fc7da98b0","html_url":"https://github.com/jabae/Cnapse","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jabae/Cnapse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabae%2FCnapse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabae%2FCnapse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabae%2FCnapse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabae%2FCnapse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jabae","download_url":"https://codeload.github.com/jabae/Cnapse/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabae%2FCnapse/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276824963,"owners_count":25711261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-24T02:00:09.776Z","response_time":97,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["connectomics","deep-learning","electron-microscopy","image-processing","python","python3","segmentation"],"created_at":"2025-09-24T21:57:24.102Z","updated_at":"2025-09-24T21:57:28.147Z","avatar_url":"https://github.com/jabae.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cnapse: Automated synapse detection in *C*. *elegans* EM images\n\n*Cnapse* is a tool that enables automated synapse detection in *C*. *elegans* electron microscopy (EM) images. *Cnapse* is designed to detect only chemical synapses as these synapses have clear visual features in EM images such as synaptic vesicles and dark regions near the presynaptic membrane.\n\n## Installation\n```\ngit clone https://github.com/jabae/Cnapse.git\ncd Cnapse\n\npip install -e .\n```\n\n## _Cnapse_ pipeline\n![](figures/synapse_detection.png)\n\n*Cnapse* consists of two steps for the synapse detection: 1. presynaptic density prediction and 2. postsynaptic partner assignment.\n\n### Presynaptic density prediction\nThe first step, presynaptic density prediction, takes raw EM image as an input use trained convolutional neural network (CNN)[^1] to detect the synapse candidates.\n\nRefer to inference command in [detectEM](https://github.com/jabae/detectEM).\n\n### Active zone info extraction\nOnce the presynaptic densities have been identified, this step extracts active zone information: presynaptic cell and size of the active zone.\n```\npython synapse_getinfo.py --syn_seg [syn_seg.tif] --cell_seg[cell_seg.tif] --res [x] [y] [z] --outpath [outpath.csv]\n```\n- `syn_seg` : Synpase segmentation volume\n- `cell_seg` : Cell segmentation volume\n- `res` : x, y, z resolution in $nm$\n- `outpath` : Path to save result\n\nThis script outputs synapse info table with synapse ids, presynaptic cell ids, active zone sizes and locations. This synapse info file can be used for postsynaptic partner assignment in the next step.\n\n### Postsynaptic partner assignment\nThe following step, postsynaptic partner assignment, assigns partners by running Monte Carlo simulation of neurotransmitter diffusion[^2] and the size of the synaptic connections are determined by the proportion of neurotransmitters.\n```\npython synapse_diffuse.py --syn_seg [syn_seg.tif] --cell_seg [cell_seg.tif] --syn_info [syn_info.csv] --mip [mip] --outpath [outpath.csv]\n```\n- `syn_seg` : Synpase segmentation volume\n- `cell_seg` : Cell segmentation volume\n- `syn_info` : List of presynaptic density ids with assigned presynaptic cell ids\n- `mip` : Mip level of the volumes (2^[mip] $nm$ resolution)\n- `outpath` : Path to save result\n\n## Synapse table format\n| syn_id | pre | pre_id | post | post_id | x_pos | y_pos | z_pos | size | \n| --- | --- | --- | --- | --- | --- | --- | --- | --- |\n- `syn_id` : Synapse segment id\n- `pre` : Presynaptic neuron name\n- `pre_id` : Presynaptic neuron segment id\n- `post` : Postsynaptic neuron name\n- `post_id` : Postsynaptic neuron segment id\n- `x_pos` : x-axis position of synapse segment centroid in $nm$\n- `y_pos` : y-axis position of synapse segment centroid in $nm$\n- `z_pos` : z-axis position of synapse segment centroid in $nm$\n- `size` : Volume of synapse segment in $nm^3$\n\n[^1]: Ronneberger, Olaf, Philipp Fischer, and Thomas Brox. 2015. “U-Net: Convolutional Networks for Biomedical Image Segmentation.” In Medical Image Computing and Computer-Assisted Intervention – MICCAI 2015, 234–41. Springer International Publishing.\n[^2]: Witvliet, Daniel, Ben Mulcahy, James K. Mitchell, Yaron Meirovitch, Daniel R. Berger, Yuelong Wu, Yufang Liu, et al. 2021. “Connectomes across Development Reveal Principles of Brain Maturation.” Nature 596 (7871): 257–61.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabae%2Fcnapse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjabae%2Fcnapse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabae%2Fcnapse/lists"}