# \donttest{
# 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)
# }
Run the code above in your browser using DataLab