This set of codes generates the figures (Figure 5A and 6A) from the manuscript "Contrasting mechanisms for hidden hearing loss: synaptopathy vs myelin defects" by Budak et al. in PLoS Computational Biology.

You need the following softwares to run the scripts:
	1) Python 2.7.16   
	2) NEURON-7.8
	3) matlab/R2018b
	4) Signal Processing Toolbox (a MATLAB tool - see https://www.mathworks.com/products/signal.html)

Before running the simulations, you need to compile mod files (ipulse.mod and vecevent.mod) so that they can be incorporated into NEURON software. For more information, see https://www.neuron.yale.edu/phpBB/viewtopic.php?t=3263.

In the manuscript, the CAPs of each population were averaged over 50 simulations of sound presentation. The codes here are designed to run the simulations in serial and that takes ~4 hours per population (~1 day to generate Figure 5A or Figure 5B). You can modify the code to run the simulations in parallel that would save some time. Alternatively, you can average over less number of simulations (see trial_no in 'runfile'), but the CAP plots would be noisier than the figures in the manuscript. 

See 'runfile' for the details of how to run the scripts.

This directory consists of:
	runfile: an executable to run the scripts and generate the figures.

	calcReleaseProbs.m: a MATLAB code that generates release probabilities from each synapse at each time step.

	neural-representations-of-speech-master: A directory that includes the model from "Steadman MA and Sumner CJ (2018) Changes in Neuronal Representations of Consonants in the Ascending Auditory System and Their Role in Speech Recognition. Front. Neurosci. 12:671. doi: 10.3389/fnins.2018.00671". See https://zenodo.org/record/1345757#.X8aHLdNKhTY for the original version of the model implementation. This model is used to generate release probabilities (called by calcReleaseProbs.m).

	generate_AN_spikes.py: A pyhton code that determines the release times based on the probabilities, simulates synaptic release and generates spike times of each auditory fiber.

	AuditoryFiberProperties.hoc: a hoc file used by NEURON software that specifies morphological and electrical properties of auditory nerve fibers. Called by generate_AN_spikes.py.

	Na_Channel.ses and K_Channel.ses: Session files generated by NEURON software that specifies Na+ and K+ channel properties.

	ipulse3.mod and vecevent.mod: Mod files used by NEURON software to simulate synaptic release. See https://github.com/neurodebian/pkg-neuron/blob/master/share/examples/nrniv/netcon/vecevent.mod and https://github.com/npyoung/conduction-block/blob/master/ipulse3.mod.

	plotConvolution.py: A python script to simulate CAPs from auditory nerve spike times and plot them.