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

Definition of relatedness as implemented in somalier #74

Open
asp8200 opened this issue May 17, 2021 · 1 comment
Open

Definition of relatedness as implemented in somalier #74

asp8200 opened this issue May 17, 2021 · 1 comment

Comments

@asp8200
Copy link

asp8200 commented May 17, 2021

This might be more of a request for clarification than an actual issue or problem with the code.

I noticed that the definition of relatedness seem to have changed with the release of version 0.2.12 of somalier.

The change was, as far as I can tell, prompted by the following issue reported by Filipe Garrett Vieira (fgvieira): #55

In the Somalier-paper [ https://doi.org/10.1186/s13073-020-00761-2 ], relatedness was defined as

(shared-hets(i,j) - 2 * ibs0(i, j)) / min(hets(i), hets(j))

In #55, Filipe suggested that the definition of relatedness to be :

(shared-hets(i,j) - 2 * ibs0(i, j)) / min(hets_in_common_pos(i), hets_in_common_pos(j))

where hets_in_common_pos(i) stands for the number of hets in sample "i" among the positions shared ("n")

Judging from your reply to Filipe, I was expecting that you had implemented his suggestion, but when I looked at your commit 3e0b840

I got the impression that you didn’t implement Filipe’s suggestion but instead implemented relatedness as

r_{brent} = 2(shared-hets(i,j) - 2 * ibs0(i, j)) / hets_{ij}

where hets_{ij} is hets_in_common_pos(i) + hets_in_common_pos(j). As pointed out to me by Filipe, your definition could also be stated as

r_{brent} = (shared-hets(i,j) - 2 * ibs0(i, j)) / mean(hets_in_common_pos(i), hets_in_common_pos(j))

r_{brent} is, of course, always less than or equal to the relatedness suggested by Filipe.

It seems to me that your implementation corresponds to the following definition from Manichaikul [PMID: 20926424] equation (9) - except perhaps for a factor 2? The definition from Manichaikul et al.:

image

Can you confirm that there is this factor 2 difference between your definition and the one given my Manichaikul et al.?

In any case, if the definition of relatedness in the Somalier-paper doesn't correspond to the one used in the current version of somalier, perhaps this should be stated in the README-file?

@brentp
Copy link
Owner

brentp commented May 20, 2021

Hi Anders,
yes, I have attempted to implement the formula from the KING paper that you show. It is estimating kinship which is half of relatedness, hence the factor of 2. I'm not sure about the misunderstanding with @fgvieira, perhaps he can clarify.
Does this address your concern?

I'm certainly interested if there are real-world consequences of any assumptions. Thanks for the careful review.

You're welcome to open a PR to make a note of the change in the README.

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