Can -s/setSeed() be given a value that does not change the seed?

10 views
Skip to first unread message

Chase W. Nelson

unread,
Oct 3, 2021, 5:26:22 AM10/3/21
to slim-discuss
I am using SLiM in a pipeline, where I would like the ability to provide a random seed using the -s parameter. To keep things consistent, I am hoping to code something like -s ${SEED} in a bash script. SEED could be set as a particular value if the user wishes to replicate a particular replication; however, I am wondering if there is some default value I could use that would leave the default (randomly chosen) seed UNCHANGED? For example, in Python, one can call random.seed(None) and the default seed remains unchanged. Is there anything similar in SLiM, e.g., -s NULL / setSeed(NULL)?

Thanks a ton!
Chase

Ben Haller

unread,
Oct 3, 2021, 10:43:04 AM10/3/21
to slim-discuss
Hi Chase.  There is nothing similar in SLiM, but it's very straightforward to do yourself.  Just pass the value you want to use in to the script using -D, including NULL if you don't want the value to change.  Then, in your script, do "if (!isNULL(SEED)) setSeed(SEED);".  It wouldn't be a hard thing to add to Eidos, but it would just be one more little bit of clutter in the APIs, and it seems unnecessary since it's so easy to do oneself.  If there is some drawback to this solution that I'm not seeing, I could certainly add it.

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University

Ben Haller

unread,
Oct 3, 2021, 10:44:27 AM10/3/21
to slim-discuss
Sorry, -d not -D.  Been staring at compiler flags too much lately.  :->

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University


Chase W. Nelson

unread,
Oct 4, 2021, 1:08:22 PM10/4/21
to slim-discuss
Thank you so much! This solution works perfectly, with -d "NULL" being interpreted as the NULL value rather than a string, etc. — which in hindsight makes sense because of quote-stripping. Thank you so much!

Chase

Reply all
Reply to author
Forward
0 new messages