#! /usr/bin/env python3# This file contains helper functions i.e. functions# that have a one-off use and do not really fit elsewhere# NOTE: When 3-4 functions have a similar paradigm, convert# them into a different class/file.importmath# For the formulae, refer to supplementary information: https://doi.org/10.15252%2Fmsb.20177796
[docs]deftheoretical_cont_rate(motor_count,crosslinker_count,sim_params,buckling_thres,scale):""" Predicts the concentration rate for a given set of simulation parameters """s=math.pi*(sim_params['cell_radius'])**2# Area of celll=sim_params['filament']['length']f=sim_params['filament_count']x=((f*(f-1))*l*l)/(math.pi*s)# number of intersectionsdef_get_probability(obj,obj_count):""" finds the probability of couple being attached to filament """k_on=obj['binding_rate']k_off=obj['unbinding_rate']eps=obj['binding_range']v2=4*math.pi*x*(eps**2)v1=2*f*l*eps-v2a=k_on/k_offavg=obj_count*(a**2*v2/(2*s))*(1+a*((v1+v2)/s)+a*(v2**2/(2*s)))**(-1)lamda=avg/x# not a typo - lambda shouldn't be used a var name in pythonprob=1-math.e**(-lamda)returnprobprob_m=_get_probability(sim_params['plus_motor'],motor_count)prob_c=_get_probability(sim_params['binder'],crosslinker_count)returnscale*(prob_m)*(prob_c)*(1-prob_c)**(buckling_thres)