Parameterization with BioNetGen2¶
Prepare the model
Pleione finds which variables will be calibrated using the symbol
#
(number sign, hash or pound sign) followed by:- An initial distribution type:
uniform
,loguniform
,lognormal
- An initial search space:
[min max]
or[mean standard_deviation]
in the case iflognormal
was selected. - A type of parameter mutation:
uniform
orloguniform
to use a new search space; orfactor
to perform a local mutation search - A search space for mutated parameters:
[min max]
or[probability fold_change]
in the case iffactor
was selected. - An optional mutation rate per parameter. Without it, the global mutation rate is used.
For instace:
- An initial distribution type:
KD1__FREE__ 1.000000e+00 # loguniform[0.01 100] factor[0.2 0.1]
km1__FREE__ 1.000000e+00 # loguniform[0.01 100] factor[0.2 0.1]
K2RT__FREE__ 1.000000e+00 # loguniform[0.01 100] factor[0.2 0.1]
km2__FREE__ 1.000000e+00 # loguniform[0.01 100] factor[0.2 0.1]
kphos__FREE__ 1.000000e+00 # loguniform[0.01 100] factor[0.2 0.1]
kdephos__FREE__ 1.000000e+00 # loguniform[0.01 100] factor[0.2 0.1]
Note
Factor mutation: This type of mutation strategy comes from BioNetFit and
selects a random value from the range 0.9 * old_value, 1.1 * old_value
if the declared value is 0.1
with probability 0.2
.
Prepare the data files
BNG2 produce simulations files with the following format. Please prepare data files with the same format, including the initial space in each row.
# time RLbonds pR
0.00000000E+00 0.00000000E+00 3.55300000E+02
1.00000000E+01 1.14072000E+02 3.56440000E+02
2.00000000E+01 1.39183800E+02 3.49960000E+02
3.00000000E+01 1.49153400E+02 3.43980000E+02
4.00000000E+01 1.56868400E+02 3.42600000E+02
5.00000000E+01 1.56788000E+02 3.35620000E+02
6.00000000E+01 1.63666800E+02 3.37480000E+02
Prepare a sbatch configuration file
Use the following code as template to make a shell script and queue it with sbatch. Note that the
export
statement is inside the code to tell SLURM to add the path and ensure proper execution when pleione was cloned with git. Also,python3
redirects to either the system installed executable (with pandas installed either as admin or user) or redirects to the user compiled executable if an alias exists for it.
#!/bin/sh
export PYTHONPATH="$PYTHONPATH:$HOME/opt/pleione"
#SBATCH --no-requeue
#SBATCH --partition=cpu
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --job-name=pleione-bng2
#SBATCH --output=stdout.txt
#SBATCH --error=stderr.txt
MODEL=pysbmodel-example6-bng2.bngl # the model should have the .bngl extension
PARTITION=$SLURM_JOB_PARTITION
DATA=../exp-data/bng2/data-*.txt
NUM_ITER=100
NUM_SIMS=10
POP_SIZE=100
POP_BEST=0
SWAP=0.5
RATE=0.5
ERROR="SDA"
python3 -m pleione.bng2 --model=$MODEL \
--iter=$NUM_ITER --pops=$POP_SIZE --sims=$NUM_SIMS --best=$POP_BEST \
--data=$DATA --rate=$RATE --swap=$SWAP --error=$ERROR \
--slurm=$PARTITION
Note
sbatch or python multiproccesing? To execute Pleione outside a SLURM
queue, simple execute the shell script with sh
, bash
or any shell
interpreter without the slurm
option. Be aware that, if SLURM is
running in the same machine, Pleione subprocess would impact negatively in
other user’s threads, and vice versa, since SLURM could allow oversubscribe
(see https://slurm.schedmd.com/sbatch.htm for more information)
Note
Need help? type python3 -m pleione.bng2 --help
to find out the
available command options.