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

Reasoning behind matching of IDs #1 #529

Open
scienception opened this issue Dec 18, 2024 · 3 comments
Open

Reasoning behind matching of IDs #1 #529

scienception opened this issue Dec 18, 2024 · 3 comments

Comments

@scienception
Copy link

scienception commented Dec 18, 2024

Referring to file: code/example-with-provided-LD.R
in which case ind.chr3 and ind.chr2 are not the same?

## indices in 'df_beta'
ind.chr <- which(df_beta$chr == chr)
## indices in 'map_ldref'
ind.chr2 <- df_beta$`_NUM_ID_`[ind.chr]
## indices in 'corr_chr'
ind.chr3 <- match(ind.chr2, which(map_ldref$chr == chr))

'df_beta' was derived from this matching:
(info_snp <- tibble::as_tibble(snp_match(sumstats, map_ldref, return_flip_and_rev = T))), so it already contains the variants that are both in the summary statistics and map_ldref, as well as the right chromosome (which(df_beta$chr == chr)). So not sure what ind.chr3 <- match(ind.chr2, which(map_ldref$chr == chr)) is doing here.

@privefl privefl transferred this issue from privefl/paper-infer Dec 18, 2024
@privefl
Copy link
Owner

privefl commented Dec 18, 2024

What would you use instead?

@scienception
Copy link
Author

scienception commented Dec 29, 2024

I believe ind.chr2 <- df_beta$_NUM_ID_[ind.chr] already contains the same info as ind.chr3.
Since you already filter for the specific chromosome you need and you take the indices of map_ldref from _NUM_ID_ column.

@privefl
Copy link
Owner

privefl commented Jan 2, 2025

I don't follow you.
ind.chr3 is needed to get the subset of each LD matrix (the indices relative to each chromosome).
Using ind.chr2 instead of ind.chr3 wouldn't work.

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