MesserLab / SLiM

SLiM is a genetically explicit forward simulation software package for population genetics and evolutionary biology. It is highly flexible, with a built-in scripting language, and has a cross-platform graphical modeling environment called SLiMgui.
https://messerlab.org/slim/
GNU General Public License v3.0
160 stars 33 forks source link

remove slim_id == population row requirement on reading in tree sequences? #390

Closed petrelharp closed 1 year ago

petrelharp commented 1 year ago

It's not too hard for someone to make a tree sequence not readable by SLiM because of a probably overly-strict check we have on population tables: suppose the SLiM model has only p1; they write it out, do something to it, simplify it, and try to read it back in. The population table will have had an (empty) 0th row, which would be removed by simplify, so in the resulting tree sequence the 0th row has a SLiM population with slim_id=1 in the metadata; this triggers this check.

The right thing to do for users is probably to not simplify; or if they do then pass filter_populations=False. But, we really probably don't need that check, so we might as well remove it. To do so we just need a few tests, maybe in pyslim, that do weird things to the population table and check nothing bad happens - for instance, make a bunch of populations all with the same slim_id; etcetera.

(This showed up in #365.)

bhaller commented 1 year ago

Tagging this long-term, since initial exploration indicates that it is harder than anticipated, and it seems to have little urgency. The PR for the doc improvement will be merged after smooth is merged.