magnusdv / pedtools

Tools for working with pedigrees in R
GNU General Public License v3.0
23 stars 3 forks source link

implementation of missing parents #24

Closed larahurban closed 4 years ago

larahurban commented 4 years ago

Hi Magnus, I was wondering if you were planning to extend your package to allow for cases where only one parent is missing? Many thanks!

magnusdv commented 4 years ago

Hi,

In pedtools and all its extension packages every pedigree members must have either 0 or 2 parents. This is a implementational design choice and will not change.

I have never seen this to be a problem or limitation. What sort of analysis are you doing? What do you mean by "missing"?

larahurban commented 4 years ago

Hi,

I am working on wild animals; often, information about just one parent (mostly the dad_ might be missing. I added fake parents to see if it works, but then figured out that kinship2/pedtools is also limited to 200 individuals, what is a problem for my data as well. I guess I will have to switch to another tool.

Thanks for responding!

Best regards, Lara

magnusdv commented 4 years ago

There is no fixed limit on the number of individuals in pedtools. (I would be interested in what made you think there was!)

In practice the pedigree size will be limited by the sort of analysis you want to do, and the available memory resources. For example, the following code creates a pedigree with 2001 individuals (and 1001 generations) and computes the complete kinship matrix in less than a second:

x = pedtools::linearPed(1000)
m = ribd::kinship(x)

However, trying to plot this pedigree will probably not work, since it will be too large to fit in the plot window.

If you tell me what sort of data you have, and what you want to do with it, I can probably tell you right away if pedtools is suitable or not.

larahurban commented 4 years ago

Sorry for the late reply! I thought that there is a limit in the number of individuals since when I type:

pedAll <- ped(id = ped$HouseName, fid = ped$Sire, mid = ped$Dam, sex = ped$Sex2) plot(pedAll)

I get the error:

Error in layout(rbind(1:N), widths = widths) : too many columns in layout, limit 200

My pedigree 'ped' contains 1,050 individuals of an inbred bird population. Sometimes one or both parents might be missing. It also varies a lot across individuals how deep a pedigree is.

I used visPedigree to visualise this pedigree, and while that works, your tool seemed to give a better overview, plus would enable me to color individuals according to disease susceptibility etc. Please let me know if you think that is still possible, and if the error comes from sth else. Many thanks!

magnusdv commented 4 years ago

Hi, thanks for the explanation.

The problem is that your data consist of more than 200 pedigrees. (The pedtools definition of a pedigree requires it to be connected). This is not a problem in itself, but the plotting function is not intended for that sort of input. (It gives an error at 200 pedigrees, but it may look strange already at 10 pedigrees.)

If visualisation is your only goal, you might want to try the kinship2 package directly, instead of going through pedtools. But I'm not sure if kinship2, or any other R package for that matter, can produce a nice-looking plot containing hundreds of pedigrees including over 1000 individuals. Its a tall order.

Good luck!