LDAS {LDAandLDAS} | R Documentation |
LDA Score
Description
Computation of the Linkage Disequilibrium of Ancestry Score (LDAS) of each single nucleotide polymorphism (SNP).
Usage
LDAS(
LDA_data,
SNPidx = NULL,
map,
window = 5,
runparallel = FALSE,
mc.cores = 8,
verbose = TRUE
)
Arguments
LDA_data |
a data frame of LDA between all pairs of SNPs that are within the 'window'.
SNPs should be in the decreasing order of physical position on a chromosome for both rows and columns.
This is the output from |
SNPidx |
a numeric vector denoting the LDAS of which SNPs (located in which rows of the map) are computed. All the SNPs' indices in the LDA_data should be included in SNPidx. By default, SNPidx=NULL which specifies the LDAS of all the SNPs in the map will be computed. |
map |
a data frame of the physical position and genetic distance of all the SNPs contained in 'LDA_data'. 'map' contains two columns. The first column is the physical distance (unit: b) of SNPs in the decreasing order. The second column is the genetic distance (unit: cM) of SNPs. |
window |
a positive number specifying the genetic distance that the LDA score of each SNP is computed within. By default, window=5. |
runparallel |
logical. Parallel programming or not (note: unavailable for Windows system). |
mc.cores |
a positive number specifying the number of cores used for parallel programming. By default, mc.cores=8. |
verbose |
logical. Print the process of calculating the LDA score for the i-th SNP. |
Details
LDA score is the total amount of genome in LDA with each SNP (measured in recombination map distance). A low LDA score is the signal of “recombinant favouring selection”.
Value
a data frame of the LDA score and its upper and lower bound at the physical position of each SNP.
References
Barrie, W., Yang, Y., Irving-Pease, E.K. et al. Elevated genetic risk for multiple sclerosis emerged in steppe pastoralist populations. Nature 625, 321–328 (2024).
Examples
# visualize the painting data
# Painting data are the average probabilities of different populations
head(LDAandLDAS::example_painting_p1[1:5,],10)
# combine the painting data for two ancestries as a list
# to make to input data for function 'LDA'.
paintings=list(LDAandLDAS::example_painting_p1,
LDAandLDAS::example_painting_p2)
# calculate the pairwise LDA of SNPs
LDA_result <- LDA(paintings)
# map is the data containing two columns
# The first column is the physical position (unit: b) (decreasing order)
# The second column is the recombination distance (unit: cM) of the SNPs
head(LDAandLDAS::example_map,10)
# calculate the LDA score for the SNPs
LDA_score <- LDAS(LDA_result,map=LDAandLDAS::example_map,window=10)
#visualize the LDA scores
plot(x=LDA_score$SNP,y=LDA_score$LDAS)
#' # if we only want to calculate the LDA of the 76th-85th SNP in the map
# based on the 31st-130th SNP, which aims at saving the memory
paintings2=list(LDAandLDAS::example_painting_p1[,31:130],
LDAandLDAS::example_painting_p2[,31:130])
# note that the 76th-85th SNP in the original dataset is only the
# (76-30)th-(85-30)th SNP in the new dataset (paintings2)
LDA_result2 <- LDA(paintings2,SNPidx=76:85-30)
# calculate the LDA score for the SNPs
LDA_score2 <- LDAS(LDA_result2,SNPidx=76:85-30,
map=LDAandLDAS::example_map[31:130,],window=5)