gaynorr / AlphaSimR

R package for breeding program simulations
https://gaynorr.github.io/AlphaSimR/
Other
42 stars 18 forks source link

Should we add a pedigree function? #60

Closed gregorgorjanc closed 2 years ago

gregorgorjanc commented 2 years ago

We often use code like

cbind(id = pop@id,
           mother = pop@mother,
           father = pop@father)

to get pedigree of a population. It would be handy to just use pedigree(pop).

We could also make the method to work with the SP object, say pedigree(pop, SP) to get more generations of pedigree for the pop object. We could also add generation argument here.

A nice starting issue;)

gaynorr commented 2 years ago

It would be nice to have a function to pull pedigrees from SP for an arbitrary depth. I've been using the the pedigree and pedigreemm libraries for most of my pedigree work. Something for pedigree based BLUP would be good too.

I should note that the mother, and father slots don't necessarily match what is stored in SP. This is done to allow for tracking pedigrees in a plant breeder style. For example, an F4 developed by selfing will have the parents of the F1 stored as its mother and father and not F3 plant that was selfed. Where as the pedigree in SP will track back to the F3 plant. This was done to allow the selectWithinFam and selectFam functions to work as a plant breeder would expect. Where as the pedigree in SP needs to trace unique genetic identities for the IBD tracking to work.

The id slot also isn't forced to match with the pedigree in SP, but the iid (internal id) will match. This was done to handle importing external data with genotypes that come with their own id. For example, you can import the genotype type data for a variety called "Bob" using importInbredGeno and the function will create a population with "Bob" as the id.