Skip to content

Rationale for a code line in compute_ld_eigen.R script #44

Description

@thanhle809

Hello,

Thank you very much for the tool!

I'm trying to formulate LD reference for predefined loci using the compute_ld_eigen.R script ([Zenodo](DOI: 10.5281/zenodo.14825987)).
I came across this code line which perplexed me about its intuition, specifically, line 76 for determining nb: nb <- sum(bandedR[, 2] == bandedR[1, 2]).

bandedR has 7 columns in this order: CHR_A, BP_A, SNP_A, CHR_B, BP_B, SNP_B, R.
bandedR is the output ld file, produced from this command, with custom chromosome, start, and end: plink --bfile chr_start_end --r --ld-window 501 --ld-window-kb 100000 --out chr_start_end --threads 8. The rows of bandedR are ordered according to increasing value of BP_A.
Based on this, I'm understanding that nb is the number of neighbor SNPs, determined as the number of neighbor SNPs for the first SNP in the region.

However, it seems to me that this nb value will be taken by the Rldscore function to calculate the LD score for each SNP, as the bandwidth for SNPs inclusion for the calculation of LD score. Hence, I thought that taking the neighbor number of the first SNP in the locus will strongly influence the results, especially in cases where the first SNP has very few neighbors (1 or 2).

Why do we define nb by the number of neighbors of the first SNP in the locus? If I were to take the largest number of neighbors of the SNPs in the locus as nb, how will it affect the result?

Best regards,
Thanh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions