### Example of analyses using lfmm ###
data("tutorial")
# creation of the genotype file, genotypes.lfmm.
# It contains 400 SNPs for 50 individuals.
write.lfmm(tutorial.R, "genotypes.lfmm")
# creation of the environment file, gradient.env.
# It contains 1 environmental variable for 40 individuals.
write.env(tutorial.C, "gradients.env")
################
# runs of lfmm #
################
# main options, K: (the number of latent factors),
# CPU: the number of CPUs.
# Toy runs with K = 3 and 2 repetitions.
# around 15 seconds per run.
project = NULL
project = lfmm("genotypes.lfmm", "gradients.env", K = 3, repetitions = 2,
iterations = 6000, burnin = 3000, project = "new")
# get the adjusted p-values using the genomic control method
res = adjusted.pvalues(project, K = 3)
hist(res$p.values, col = "yellow3")
# get the adjusted p-values with the genomic inflatino factor
res = adjusted.pvalues(project, genomic.control = FALSE,
lambda = res$genomic.inflation.factor, K = 3)
hist(res$p.values, col = "yellow3")
Run the code above in your browser using DataLab