-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BBPBGLIB-1036] Implement SONATA synapse reader for gap junction
## Context Recently we have dropped the synapse-tool dependency for reading synapse parameters. SynReaderNRN is used to read the old format nrn edges files, and SonataReader is to read sonata edges. This PR is to implement a sonata reader to read gap junction synapse parameters. ## Scope In `gap_junection.py`, a GapJunctionSonata reader derived from the SonataReader. The Sonata parameters for gap junction are `efferent_junction_id` and `afferent_junction_id`. ## Testing Add a unit test to test GapJunctionSynapseReader for both NRN and SONATA edges files. ## Review * [x] PR description is complete * [x] Coding style (imports, function length, New functions, classes or files) are good * [x] Unit/Scientific test added * [ ] Updated Readme, in-code, developer documentation
- Loading branch information
1 parent
57e8d7a
commit 8263f1d
Showing
5 changed files
with
84 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Extract connections with target gid = 0 from the gap junction edges file in | ||
/gpfs/bbp.cscs.ch/project/proj12/SIT/thalamus_sonata/networks/edges/thalamus_neurons__thalamus_neurons__electrical_synapse/edges.h5 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import numpy as np | ||
import numpy.testing as npt | ||
import os | ||
import pytest | ||
from neurodamus.gap_junction import GapJunctionSynapseReader | ||
from pathlib import Path | ||
|
||
|
||
pytestmark = [ | ||
pytest.mark.forked, | ||
pytest.mark.skipif( | ||
not os.environ.get("NEURODAMUS_NEOCORTEX_ROOT"), | ||
reason="Test requires loading a neocortex model to run" | ||
) | ||
] | ||
|
||
|
||
def test_gapjunction_synreaderNRN(): | ||
nrn_file = "/gpfs/bbp.cscs.ch/project/proj12/jenkins/cellular/circuit-scx-v5-gapjunctions/gap_junctions/nrn_gj.h5" # noqa | ||
nrn_reader = GapJunctionSynapseReader.create(nrn_file, 1) | ||
syn_params_nrn = nrn_reader._load_synapse_parameters(100124) | ||
# check reading of sgid, junction_id_pre and junction_id_post | ||
ref_sgids = np.array([94669., 94723., 95634., 95823., 96581., | ||
97338., 97455., 98139., 98432., 100725., | ||
101360., 101506., 101696., 101696., 191567.]) | ||
ref_junction_id_pre = np.array([735., 736., 29., 36., 51., | ||
77., 744., 134., 148., 286., | ||
322., 337., 355., 356., 681.]) | ||
ref_junction_id_post = np.array([1251., 1259., 617., 1354., 1002., | ||
1756., 1027., 924., 709., 624., | ||
1050., 521., 592., 593., 590.]) | ||
npt.assert_allclose(syn_params_nrn.sgid, ref_sgids) | ||
npt.assert_allclose(syn_params_nrn.D, ref_junction_id_pre) | ||
npt.assert_allclose(syn_params_nrn.F, ref_junction_id_post) | ||
|
||
|
||
def test_gapjunction_sonata_reader(): | ||
SIM_DIR = Path(__file__).parent.absolute() / "simulations" | ||
sonata_file = str(SIM_DIR / "mini_thalamus_sonata/gapjunction/edges.h5") | ||
sonata_reader = GapJunctionSynapseReader.create(sonata_file, 1) | ||
syn_params_sonata = sonata_reader._load_synapse_parameters(1) | ||
ref_junction_id_pre = np.array([10257., 43930., 226003., 298841., 324744., | ||
1094745., 1167632., 1172523., 1260104.]) | ||
ref_junction_id_post = np.array([14., 52., 71., 76., 78., 84., 89., 90., 93.]) | ||
ref_weight = np.array([0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]) | ||
npt.assert_allclose(syn_params_sonata.D, ref_junction_id_pre) | ||
npt.assert_allclose(syn_params_sonata.F, ref_junction_id_post) | ||
npt.assert_allclose(syn_params_sonata.weight, ref_weight) |