This folder contains all the Cytosim configuration files necessary to replicate the simulation results shown in The paper "Theory of antiparallel microtubule overlap stabilization by motors and diffusible crosslinkers".
The simulation can be run using the Open Source software Cytosim.
Note that due to the stochastic nature of the simulation, your results will not be identical to the ones presented in the paper.
To run simulations with varying parameters, we use a template file with extension .cym.tpl
, from which multiple configuration files (extension .cym
) are generated.
For this we use the Python program Preconfig, from the command line:
preconfig.py config.cym.tpl
The template specifies parameters to vary, and how to vary them, which are reflected in the output.
For more information on Preconfig, please refer to this article:
preconfig: A Versatile Configuration File Generator for Varying Parameters
Journal of Open Research Software, 2017 5(1), p.9.
XXXXXXXXXXX
Python files are written in python 2. In order to run the python code you will need the following python modules:
argparse
joblib
matplotlib
numpy
pandas
scipy
We have bundled the required python scripts to run the code in a module called leraramirez2019
. To run the different versions of get_parameters.py
, one needs to import read_config.py
from this module.
To allow this, you can either:
-
Copy the folder
code/python/leraramirez2019
to any of the directories in your python path. To check which directiories are in your python path, you can run (in python):import sys print sys.path
You can copy
leraramirez2019
in any of the listed folders. -
Copy
leraramirez2019
to all the folders wereget_parameters.py
is present.
If you want to use the scripts to analyse and run simulations (described in the section Running and analyzing using a script. below), you need to define some absolute paths in the first lines of the file /code/bash/run_all.sh
:
bin_folder
: The folder with the cytosim binaries, by default atcode/cytosim/bin
python_folder
: The path to the python module, by default atcode/python/leraramirez2019
python_bin
: Your Python 2 binary file.
Typically, the simulation process goes in three steps: running, measuring, and plotting the results. We describe how to proceed through these steps in order to reproduce the figures of the paper. Simulation folders are organised accordingly, and new files and folders are added as the pipeline progresses. We provide images of how the file organisation should evolve. To run the simulations for each of the figures, the starting point is a folder named simulations/Fig*/data
.
In that folder there is:
runs*
: directories containing a template fileconfig.cym.tpl
. When runningpreconfig.py
, on each template file, individual configuration files for simulations are generated in which parameters are scanned.report_instructions.txt
: a file containing the instructions for thereport
binary from cytosim, to print information from the ran simulations (see below).get_*.py
python scripts. They extract information from the simulation folders, afterreport
has generated text files (see below).
-
Creating configuration files: from the template file, we move to the
runs*
directory, and create several configuration files for each condition. This is done using preconfig:python preconfig.py N config.cym.tpl
Where
N
is the number of desired configuration files per condition. -
Sorting configuration files: we sort the generated files, named
config%04i.cym
in directories namedscan/run%04i
, and rename the config files toconfig.cym
. The result is a tree of directories containing the individual configuration files:scan/run%04i/config.cym
. -
Running simulations: we call the binary
sim
in each of the directories, to run a simulation corresponding to each configuration file. This generates the simulation filesobjects.cmo
,properties.cmo
, andmessages.cmo
.
-
Extract the input parameters of each simulation: For each simulation, we want to extract the relevant input parameters to text files. For that we use the python script
get_parameters.py
inside the simulation folder. We run:python get_parameters.py > parameters.txt
For each figure, the parameters to be extracted are slightly different. Read the python script to see what exactly is being extracted. The file
parameters.txt
will contain a first row with the names of the parameters, and a second row with the values. -
Report information from simulation files: for each simulation folder, we use the
report
binary to print the relevant information to text files. The arguments for report that we use for each figure are stored in the filereport_instructions.txt
. Typically, for the simulations of the paper we want to know for each time point of the simulation, how many crosslinkers and motors are bound, and the distance between minus ends. For this, we use:report couples > couples.txt report fiber:end > fiber.txt
And print those results into text files inside each of the simulation folders.
-
Process the reported information: the output of
report
has to be post-processed. This is done with python scripts namedget_*.py
, typicallyget_results.py
andget_results_couples.py
. We can call this python scripts in each of the simulation folders, and store the information in text files:python get_results.py > results.txt python get_results_couples.py > results_couples.txt
get_results.py
for most figures prints a single text line containing the distance between minus ends of the filaments for each simulation time point, separated by spaces.get_results_couples.py
prints a single text line containing the number of double bound couples (crosslinkers and/or motors depending on the figure). -
Gather information into a single text file: It is not practical to have the results and parameters in scattered files. To gather the information, we create a directory,
simulations/Fig*/data_summary/runs*
, in which we create three files,results.txt
,results_couples.txt
andparameters.txt
, which contain one line for each simulation. In order to create them, for each simulation folder:# For results and results_couples '/bin/cat results.txt >> simulations/Fig*/data_summary/runs*/results.txt' # For parameters, to keep only one line with column names # In the first folder '/bin/cat parameters.txt >> simulations/Fig*/data_summary/runs*/parameters.txt' # In the rest of the folders '/usr/bin/tail -n1 parameters.txt >> simulations/Fig*/data_summary/runs*/parameters.txt'
-
Measure derived quantities: Finally, we want to measure some derived quantity beyond what we have reported from simulation snapshots. For instance, the speed of sliding or average number of bound motors/crosslinkers at steady state. For this, we use the python script
simulations/Fig*/data_summary/measure.py
, which is slightly different for each figure. The results are saved in the filesimulations/Fig*/data_summary/runs*/measurements.py
, where column names are provided, and every line corresponds to a simulation.
The previously described pipeline is written into a bash script, that can be found in /code/bash/run_all.sh
. Keep in mind that to run this script the organisation of the folders provided is important, since certain commands rely on the relative paths to other files. Also, check the section Setup before running simulations and comments in the script before you try it.
The usage is explained by calling
bash run_all.sh -h
The python scripts to generate the figures are located in simulations/figures_combined/
.
In this directory there is also other files:
data_lanksy.csv
: data from Figure 3B of Lansky et al. 2015.plot_settings.py
: python file with settings for the plottingtheory_equations.py
: python functions corresponding to the analytical and numerical solutions presented in the text