mayoverse / kinship2

Pedigree creation, plotting, and analytics
GNU General Public License v2.0
13 stars 7 forks source link

inclusion of birth year in plotted pedigrees #8

Open Dejan1983 opened 2 years ago

Dejan1983 commented 2 years ago

Hello, thank you for making kinship2 - i've found the plotting of pedigrees very helpful. One question i can't seem to resolve is how to incorporate additional information into the plotted pedigrees. For example, i would love to color my plots by year of birth but there doesn't seem to be any way to do this. I know that the plots can be shaded/unshaded by affected status, but this is limited to a 0/1 option as far as i can tell. I have a pedigree that spans several breeding attempts by birds in successive years, and hence colouring each brood by year would be really informative. Also, i seem to have a couple of issues that i can't explain in my pedigrees. For instance, there's randomly repeated individuals individuals in my pedigrees (e.g. M0046 in the image below) and also the shapes don't correspond to the sexes specified in my pedigree files. Rplot01 Any suggestions would be much appreciated. thanks, D

bethatkinson commented 2 years ago

Have you tried to specify a vector for the color?

In the help file for pedigree() the object bped.id8 is created (40 people). The following code assigns them color 1-5.

plot(bped.id8,col=sample(1:5,40,replace=T))

Also, you can have up to 4 different 'affected' values (so someone could be a quarter of each) - simply provide a matrix with up to 4 columns.


From: Dejan S. @.> Sent: Sunday, March 13, 2022 10:56 PM To: mayoverse/kinship2 @.> Cc: Subscribed @.***> Subject: [EXTERNAL] [mayoverse/kinship2] inclusion of birth year in plotted pedigrees (Issue #8)

Hello, thank you for making kinship2 - i've found the plotting of pedigrees very helpful. One question i can't seem to resolve is how to incorporate additional information into the plotted pedigrees. For example, i would love to color my plots by year of birth but there doesn't seem to be any way to do this. I know that the plots can be shaded/unshaded by affected status, but this is limited to a 0/1 option as far as i can tell. I have a pedigree that spans several breeding attempts by birds in successive years, and hence colouring each brood by year would be really informative. Also, i seem to have a couple of issues that i can't explain in my pedigrees. For instance, there's randomly repeated individuals individuals in my pedigrees (e.g. M0046 in the image below) and also the shapes don't correspond to the sexes specified in my pedigree files. [Rplot01]https://user-images.githubusercontent.com/93886982/158102120-951e0111-db91-40f8-b9be-724b5f3391cf.jpeg Any suggestions would be much appreciated. thanks, D

— Reply to this email directly, view it on GitHubhttps://github.com/mayoverse/kinship2/issues/8, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACWQG5ZKVPE5LAZCUHV7PI3U722FPANCNFSM5QULC33Q. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you are subscribed to this thread.Message ID: @.***>

sinnweja commented 2 years ago

Beth's example should work for the brood year. Here is an example using "test1" that is created in example(kinship), where I add some text to the id, and birth year on a new line, but I think color might be better. Also, if you re-order the pedigree or look at how to do "hints", you can minimize the need to make extra copies of individuals. Also, for sex/gender, they need to be either 0/1 (1 for female) or 1/2, (2 for female). It gets a little tricky, especially if you have them as character.

R> ped1 <- with(test1, pedigree(id=id, dad, mom, sex)) R> test1$birthYR <- c(1950:1953, 1970:1977, 1995:1996) R> ped1 <- with(test1, pedigree(id=id, dad, mom, sex)) R> plot(ped1, id=paste0(test1$id, ": <more text> \n ", test1$birthYR), cex=0.8) ped_test1