Saving parents pedigree_id in tree sequence file

55 views
Skip to first unread message

Anita Lerch

unread,
Mar 1, 2022, 10:21:25 AM3/1/22
to slim-discuss
Hi,

I was wondering how I can make sure that the parents pedigree_id or the tree sequence individual id of the parents are saved in the tree sequence file. Most of the time the "ts.tables.individuals.parents" field is empty and there is no field for parents in the metadata.
Currently I write the offspring pedigree_id and parents pedigree_id into a separate csv formate matingTable file, which is very inefficient. Storing this information in the tree sequence would greatly save storage and make the whole process simpler.

Attached a simplified recipe of my slim model where I use sim.treeSeqRememberIndividuals() to save only adult individuals.

Thanks,
Anita
writePedigreeToTreeSeqFile.slim

Ben Haller

unread,
Mar 3, 2022, 2:31:18 PM3/3/22
to slim-discuss
Hi Anita.  At present I don't think there's an easy solution to this; SLiM does not have a flag to keep the *parents* of individuals in which an ancestry-relevant recombination event occurred.  It might be possible to add that; but that probably won't happen terribly soon, since I'm now pretty immersed in working on SLiM 4.0 and I'm hoping not to roll another release in the 3.x family.  If you would like to see that feature, though, please open an issue on GitHub for it and we'll see what we can do; if a SLiM 3.7.2 turns out to be necessary because somebody finds an important bug or something, maybe this could get rolled in opportunistically.

In the meantime, I guess there are two approaches that occur to me.  One is to just remember *everybody*, and that way you'll have the information you want; but unless your model is small, that probably uses more memory than you can afford to use.  The other would be to maybe remember everybody, but save out to a .trees every, say, 1000 generations, load into Python, simplify down to only the individuals you need, save out a new .trees, load that back into SLiM, and resume simulation for another 1000 generations, lather rinse repeat.  With a bit of scripting in R or Python or Bash that probably wouldn't be *that* hard to do, but I don't know whether it would be an improvement on the workaround that it sounds like you've already designed.  I think perhaps msprime does have an option named record_full_arg for simplify that keeps what you want to keep, so you might be able to use that in such a pipeline; SLiM just doesn't make that flag visible in its Eidos interface at present. Sorry; good luck!

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University

Reply all
Reply to author
Forward
0 new messages