Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More permissive pedigree #16

Open
courtiol opened this issue Mar 1, 2023 · 3 comments
Open

More permissive pedigree #16

courtiol opened this issue Mar 1, 2023 · 3 comments

Comments

@courtiol
Copy link

courtiol commented Mar 1, 2023

For some applications, it could be useful to have plot with diamonds in the middle of the tree.

For example, I want to represent any grand mother - grand mother relationship, irrespective of whether the gdma is a maternal or paternal gdma:

To do that I had to hack a couple of checks within the pedigree function:

if(any(!sex[findex] %in% c("male", "unknown"))) {
   who <- unique((id[findex])[!sex[findex] %in% c("male", "unknown")])
   msg.n <- 1:min(5, length(who))  #Don't list a zillion
   stop(paste("Id not male (or unknown), but is a father:", 
            paste(who[msg.n], collapse= " ")))
    }

instead of:

kinship2/R/pedigree.R

Lines 121 to 126 in ba65a5f

if(any(sex[findex] != "male")) {
who <- unique((id[findex])[sex[findex] != "male"])
msg.n <- 1:min(5, length(who)) #Don't list a zillion
stop(paste("Id not male, but is a father:",
paste(who[msg.n], collapse= " ")))
}

and

if(any(!sex[mindex] %in% c("female", "unknown"))) {
    who <- unique((id[mindex])[!sex[mindex] %in% c("female", "unknown")])
    msg.n <- 1:min(5, length(who))
    stop(paste("Id not female (or unknown), but is a mother:", 
               paste(who[msg.n], collapse = " ")))
    }

instead of:

kinship2/R/pedigree.R

Lines 136 to 141 in ba65a5f

if(any(sex[mindex] != "female")) {
who <- unique((id[mindex])[sex[mindex] != "female"])
msg.n <- 1:min(5, length(who))
stop(paste("Id not female, but is a mother:",
paste(who[msg.n], collapse = " ")))
}

I understand that it should not be the default behavior, but if an option could allow for this to happen, that would be great since the plotting function seems to have no difficulty with this (although I did not test extensively).

@sinnweja
Copy link
Member

sinnweja commented Aug 4, 2023

You are certainly welcome to take the code and make your own edits for these use cases. However, the diamond is a reserved symbol for a missing sex in the pedigree (sex code of 3).

diamond_symbol

@sinnweja sinnweja closed this as completed Aug 4, 2023
@courtiol
Copy link
Author

courtiol commented Aug 6, 2023

Dear @sinnweja , I don't think you understand me.
I did not change the meaning of the diamond, it is still used to display a missing sex.
The point was to allow for individuals of missing sex to be parents.

@sinnweja
Copy link
Member

sinnweja commented Aug 7, 2023

My apologies. Now I see your point, and indeed we have had a few requests to lift this check when plotting asexual generations. We will try to incorporate this as an option.

@sinnweja sinnweja reopened this Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants