kr-colab / discoal

discoal is a coalescent simulation program capable of simulating models with recombination, selective sweeps, and demographic changes including population splits, admixture events, and ancient samples
GNU General Public License v3.0
48 stars 10 forks source link

How to speed up the simulation? #29

Closed jiangzy26 closed 1 year ago

jiangzy26 commented 1 year ago

Hi, I am running discoal to simulate hard, soft selection and neutral, but I found it is too slow for me, simulating one replicate need minutes, but I need to simulate 2000 replicates, so do you have any methods to speed it up? the command line for soft selection is :

discoal 12 2000 220000 \ -Pt 603.9255 5435.33 \ -Pr 1.732168 33764.92 \ -ws 0 \ -Pa 311.945 31194.5 \ -Pu 0 0.004007117 \ -Pf 0.01 0.2 \ -x 0.045454545454545456 \ -en 0.068638576 0 0.359088596 \ -en 0.108178701 0 0.288833244 \ -en 0.134816126 0 0.221769039 \ -en 0.156125998 0 0.22265817 \ -en 0.173016929 0 0.219402508 \ -en 0.191735252 0 0.137347905 \ -en 0.225324644 0 0.258311857 >> soft_0.msOut

Thanks!

andrewkern commented 1 year ago

Hi @jiangzy26 -- I'm not surprised that this is slow! The prior on rho goes up to 3.37e5, so if we assume recombination rates on the order of 1e-09 you are implying population size is in the tens of millions.

Probably the best thing you could do here to speed things up is to split up the 2000 replicate simulations across a number of machines. If you have access to a cluster, this is a perfect use case.

jiangzy26 commented 1 year ago

@andrewkern Thanks for your reply, I found that the setting of rho maybe not good, Now I used ReLERNN result, and set -Pre 1577.344 5303.564, the program run faster.