Calculating a pedigree inbreeding coefficent

25 views
Skip to first unread message

ckyri...@gmail.com

unread,
Mar 31, 2021, 3:31:14 PM3/31/21
to slim-discuss
Hi Ben,

I am trying to implement a way to calculate the pedigree inbreeding coefficient (Fped) for a sample of individuals in a simulation, and have a few questions. 

My approach thus far is to track pedigrees, find the parents of a focal individual, and calculate their relatedness, which I believe should be twice the inbreeding coefficient for the focal individual. Here is what that looks like so far:

i = sample(p1.individuals, 60, F);

f_ped = c();

for(ind in i){

   parents=ind.pedigreeParentIDs;

   parent1 = p1.individuals[p1.individuals.pedigreeID==parents[0]];

   parent2 = p1.individuals[p1.individuals.pedigreeID==parents[1]];

   f_ped_ind = parent1.relatedness(parent2)/2;

   f_ped = c(f_ped, f_ped_ind);

}


The issue I am running into is that most of these f_ped values do not appear to exist, I believe because one or more of the parents may no longer exist in the simulation. If that is the issue, are there any possible work-arounds? Or if not, are they any other ways you might be aware of to calculate F_ped for an individual?

Thanks,

Chris

Ben Haller

unread,
Mar 31, 2021, 3:51:19 PM3/31/21
to slim-discuss
Hi Chris,

Right, the parent individuals probably don't exist any more, in your simulation.  Depending on exactly what you want to do, you might be able to do your calculations with the pedigreeGrandparentIDs (the grandparents also won't exist any more, probably, but those IDs would let you calculate the approximate relatedness of the parents).  You could also get into recording the pedigree as you go along, similar to section 16.12 in the SLiM manual, so that you could use that saved information to calculate relatedness.  Or you could get into calculating the relatedness between all pairs of individuals, in every generation, and recording them in a big matrix for future reference in your model, so that you can answer those relatedness questions for individuals even after the individuals no longer exist.  If those approaches do not suffice, then you probably want to shift over to using tree-sequence recording, which will give you the ability to do your analysis using the full ancestry for every individual at every site.  (Indeed, this might be the simplest option anyway; this sort of thing is really what tree-sequence recording is for, and it will give you the ability to calculate relatedness even for pedigree relationships that go back further than the grandparental level.)  See section 1.7 of the SLiM manual for an overview of tree-sequence recording.

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University

Chris Kyriazis

unread,
Mar 31, 2021, 4:43:48 PM3/31/21
to Ben Haller, slim-discuss
Thanks Ben! Since posting this, I think I found an easy workaround, which is simply to store the inbreeding coefficient for each individual using their 'tagF' property immediately after they are born, while the parents are still alive. I think I will stick with this for now, but may explore using tree sequences in the future to also track inbreeding from more distant relatives. 

--
SLiM forward genetic simulation: http://messerlab.org/slim/
---
You received this message because you are subscribed to a topic in the Google Groups "slim-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/slim-discuss/mbskf7pUkn4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to slim-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/slim-discuss/ceef75eb-976b-475d-93c0-9550ccc85abfn%40googlegroups.com.

Ben Haller

unread,
Mar 31, 2021, 4:46:31 PM3/31/21
to slim-discuss
Ah, in a modifyChild() callback, or after creating the offspring with addX() in a nonWF model?  Yes, that's a good idea, indeed!  I should've thought of that, d'oh!  :->

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University

Chris Kyriazis

unread,
Mar 31, 2021, 4:51:01 PM3/31/21
to Ben Haller, slim-discuss
The latter - should have mentioned I'm using a nonWF model!

Reply all
Reply to author
Forward
0 new messages