Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BBPBGLIB-1059] Integrate Oren's gap junction compensation procedure into neurodamus #195

Merged
merged 11 commits into from
Nov 20, 2024

Conversation

WeinaJi
Copy link
Collaborator

@WeinaJi WeinaJi commented Sep 4, 2024

Context

Integrate Oren's compensation script for gap junction synapses into the neurodamus main flow. Uses are expected to use predefined parameters in the SONATA simulation config files to configure the correction steps and values. In this PR, those parameters are stored in the experimental "beta_features" section of the SONATA config files. The corresponding formal SONATA parameters are to be determined in the SONATA specifications, the libsonata parser, and the future PR in neurodamus.

Scope

At the finalize step for GapJunctionManager, if users set the right gapjunction_target_population, the user corrections defined in the new file gj_user_functions.py will be triggered. This file is implemented based on Oren's script which was used for Elisabetta's publication (/gpfs/bbp.cscs.ch/project/proj55/software/gap_junctions/pylibs/manager_python.py). It provides these corrections to be enabled by users via the SONATA simulation config file:

  1. Set deterministic = 1 for StochKv mechanisms set in the simulation config file "deterministic_stoch"
  2. Update the conductance value of gap synapses to the value set in the simulation config file "gjc"
  3. Remove cell channel mechanisms set by "remove_channels"
  4. Update segment g_pas to fit the gjc with values set by the calibration file given in the simulation config file "load_g_pas_file"
  5. Add current clamps to certain cells where the gids and the amplitudes are read from the file given in the simulation config "manual_MEComboInfo_file"
  6. Add SEClamps to the certain cells where the gids and the amplitudes are read from the file given in the simulation config "vc_amp" and meanwhile save the SEClamp Data

Those SONATA parameters are chosen based on the setting in Elisabetta's publication /gpfs/bbp.cscs.ch/project/proj55/iavarone/releases/simulations/spontaneous_evoked/CorrectCTFiberAll_Backgroundwith_afferents_MLNoise25_CTNoise4/MLStim4/MLNoise0/CTNoise0/settings.p for which corrections 1,2,4,5 were used.

Testing

New test test_v5_gap_junction_corrections in test/scientific/test_simulation.py

Review

  • PR description is complete
  • Coding style (imports, function length, New functions, classes or files) are good
  • Unit/Scientific test added
  • Updated Readme, in-code, developer documentation

@bbpbuildbot

This comment has been minimized.

@bbpbuildbot

This comment has been minimized.

@bbpbuildbot

This comment has been minimized.

@WeinaJi WeinaJi changed the title Integrate gap junction compensation steps from Oren [BBPBGLIB-1059] Integrate Oren's gap junction compensation procedure into neurodamus Sep 6, 2024
@bbpbuildbot

This comment has been minimized.

@WeinaJi WeinaJi marked this pull request as ready for review September 9, 2024 08:14
@bbpbuildbot

This comment has been minimized.

@jorblancoa
Copy link
Collaborator

General comment:
Do we want to merge those in beta_features? or shall we wait to define them in the sonata-extension and then implement the necessary changes in libsonata first?

@orena1
Copy link

orena1 commented Sep 10, 2024

Hi @WeinaJi I think it looks good, but is there a way to test it?

@orena1
Copy link

orena1 commented Sep 10, 2024

Very cool, a bit off-topic, but there is also the code that generates the GJs and use them. I'll try to get it on github and we can refer to it.

@WeinaJi
Copy link
Collaborator Author

WeinaJi commented Sep 10, 2024

General comment: Do we want to merge those in beta_features? or shall we wait to define them in the sonata-extension and then implement the necessary changes in libsonata first?

Thinking about the time left, I am inclined to merge them in beta_features so @PolinaL can use in her thalamus simulation asap. This way we don't need the approval for the SONATA specs and the libsonata API.
For the SONATA specs, we need to define proper naming for all required parameters, and possibly store them in a proper section. Maybe we could brainstorm with scientists if time permits, @jamesgking ?

@WeinaJi
Copy link
Collaborator Author

WeinaJi commented Sep 10, 2024

Hi @WeinaJi I think it looks good, but is there a way to test it?

Hello @orena1 , can you access our bb5 cluster? If yes, you can clone this branch into your directory, load the thalamus module, and overwrite the neurodamus component with your local copy. Something like:

git clone [email protected]:BlueBrain/neurodamus.git -b weji/oren
module load unstable neurodamus-thalamus
export PYTHONPATH=$(pwd)/neurodamus:$PYTHONPATH
srun dplace special -mpi -python $NEURODAMUS_PYTHON/init.py --configFile=simulation_config.json

The config file simulation_config.json should contain the beta_features section like

{
"beta_features" :{
        "gapjunction_target_population": "thalamus_neurons",
        "deterministic_stoch": true,
        "procedure_type": "validation_sim",
        "gjc": 0.2,
        "load_g_pas_file": "/gpfs/bbp.cscs.ch/project/proj55/amsalem/gap_junctions/circ19_11_2019_gjs_19_20_20/rm_correction/Circ_mc2_Rt_Remove_ch_all_Det_stoch_True_Dis_holding_False_Correc_type_impedance_tool_Cm0p01_Num_iter_10/num_0/g_pas_passive.hdf5",
        "manual_MEComboInfo_file": "/gpfs/bbp.cscs.ch/project/proj55/amsalem/gap_junctions/circ19_11_2019_gjs_19_20_20_new_holding/find_holding_current/vc_ampFile/Circ_mc2_Rt_Remove_ch_none_Det_stoch_True_Dis_holding_False_gjc0p2_Change_mecomb_False_manual_MEComboInfoFile_False_Load_g_pas_True_Correc_iter_loadlast/num_0/holding_per_gid.hdf5"
    },
}

An example from my test config file /gpfs/bbp.cscs.ch/home/weji/JIRA/thalamus_elsabetta/0/simulation_config.json

Also cc @PolinaL

@WeinaJi
Copy link
Collaborator Author

WeinaJi commented Sep 10, 2024

Very cool, a bit off-topic, but there is also the code that generates the GJs and use them. I'll try to get it on github and we can refer to it.

That will be great. Please let me know if you would like to push something in this repo. I can give you the write permission.

In fact, I have another version of your script which includes these commented code:

# if load_g_pas_correction_file:
#     logging.info("Loading g_pas_correction_file")
#     exec(open('/gpfs/bbp.cscs.ch/home/amsalem/Dropbox/Blue_Brain/Experiments_Reproduction/Coupling_Coefficient/pylibs/gap_junction_conductance_search_damus.py').read())

Is it still needed? I can't find the script gap_junction_conductance_search_damus.py any more.

ferdonline
ferdonline previously approved these changes Sep 17, 2024
neurodamus/gj_user_corrections.py Outdated Show resolved Hide resolved
neurodamus/gj_user_corrections.py Show resolved Hide resolved
@bbpbuildbot

This comment has been minimized.

@bbpbuildbot

This comment has been minimized.

jorblancoa
jorblancoa previously approved these changes Oct 16, 2024
Copy link
Collaborator

@ferdonline ferdonline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicks, but it might be worth to a wider round of checks for naming and other small inconsistencies. vars starting in upcase remember class variables or constants

neurodamus/gap_junction.py Outdated Show resolved Hide resolved
neurodamus/gap_junction.py Outdated Show resolved Hide resolved
neurodamus/gj_user_corrections.py Outdated Show resolved Hide resolved
@bbpbuildbot

This comment has been minimized.

@bbpbuildbot
Copy link

@WeinaJi
Copy link
Collaborator Author

WeinaJi commented Oct 22, 2024

Very cool, a bit off-topic, but there is also the code that generates the GJs and use them. I'll try to get it on github and we can refer to it.

Hello @orena1, have you managed to test this branch on bb5? Or would you like to add your code in it?
As BBP closure is approaching, I would like to merge this feature into the main branch although it is still in "beta_futures". In this way, @PolinaL could check it out in another computing cluster after bb5 to continue her simulation.

ferdonline
ferdonline previously approved these changes Nov 20, 2024
jorblancoa
jorblancoa previously approved these changes Nov 20, 2024
@WeinaJi WeinaJi dismissed stale reviews from jorblancoa and ferdonline via 0693d7a November 20, 2024 10:46
@WeinaJi WeinaJi merged commit 6abadd7 into main Nov 20, 2024
12 checks passed
@WeinaJi WeinaJi deleted the weji/oren branch November 20, 2024 15:37
@orena1
Copy link

orena1 commented Dec 30, 2024

Hi, sorry for the late response, this file is probably relevant for the process, in general the whole Coupling_Coefficient directory
https://github.com/orena1/Experiments_Reproduction/blob/master/Coupling_Coefficient/send_sim_to_share_v1.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants