Hi Hannes!
First of all, yes, you could as you say use tree-sequence recording and
remember every individual in every generation. That would provide you
not only with a complete pedigree, but also all of the information about
inheritance along the chromosome; but it would grow very large, for
large/long simulations, to the point where you would likely run out of
memory. Perhaps you could allow simplification to trim away extinct
branches of the tree (if you don't need those), but set
retainCoalescentOnly=F so that ancestors of the extant individuals are
kept even if they are not a coalescent node in the ancestry tree; and
perhaps you could remember individuals with treeSeqRememberIndividuals()
with permanent=F, allowing them to be simplified away in cases where
they are no longer relevant to the final generation, but keeping them
otherwise? I'm not sure whether that would then give you a complete
pedigree for the final generation or not; honestly I find these flags
(which are tskit flags, not SLiM flags, really) a bit confusing in their
exact effects. :-> The pyslim documentation at
https://tskit.dev/pyslim/docs/latest/tutorial.html has discussion and
diagrams regarding this, which you could try to figure out, and perhaps
Peter can weigh in to whether some combination of the available options
would produce a recorded pedigree (plus inheritance information), in
effect, or if there is some difference.
Second, yes, as you say, you could "write down" each individual's ID and
parents to produce a recorded pedigree. There is an example recipe to
do this in section 15.10 that does not even use SLiM's "pedigree
tracking" feature, instead tagging each individual; but you could
certainly use the IDs from pedigree tracking instead. It's just a
couple of extra lines of code.
Third, no, there is no built-in facility for this; but doing it
yourself, as in section 15.10, is really not difficult at all. I guess
there's no built-in facility for doing it because (a) it's easy to
script, (b) everybody would probably want it to do different things,
keep different information, save in different formats, etc.; it seems
like a feature with so much variation in the desired functionality that
it might be better to let people just implement what they want, and (c)
nobody has asked for it. :-> If you wanted to write up a precise,
detailed feature request in a GitHub issue, it might well happen
eventually, but since I know little about how people use pedigrees in
the real world, what file format would be desired, etc., your writeup
should really specify all the relevant details or I won't know how to
proceed with it. :-> I'm certainly open to the idea of adding such a
feature, if you think it is a well-defined problem with a clear
solution that would actually make people happy.
And fourth, there is a package called py_ped_sim that does a bunch of
stuff related to pedigrees in SLiM that you might want to look at.
Section 1.10 of the SLiM manual has more information on it. I don't
think (?) it provides a way to record a pedigree in SLiM automatically,
but I think it perhaps *does* provide a way for you to use some other
software package to simulate a pedigree and record it, and then simulate
along that recorded pedigree in SLiM, which might or might not solve
your problem, depending on what exactly you're trying to do.
I hope this helps; happy modeling!
Cheers,
-B.
Benjamin C. Haller
Messer Lab
Cornell University
Hannes Becher wrote on 1/17/25 6:20 AM: