Description Usage Arguments Value Author(s) References See Also Examples

The function returns a vector of p-values for association between loci and environmental variables adjusted for latent factors computed by `lfmm2`

. It takes an object of class `lfmm2Class`

with the data that were used to adjust the LFMM.

1 |

`object` |
An object of class |

`input` |
A genotypic matrix or a character string containing a path to the input file. The genotypic matrix must be in the |

`env` |
A matrix of environmental covariates or a character string containing a path to the environmental file. The environment matrix must be in the |

`genomic.control` |
A logical value. If |

`linear` |
A logical value indicating whether linear or generalized linear models should be used to perform the association tests. If |

`family` |
a |

`pvalues` |
A matrix of p-values for each locus and each environmental variable. |

`zscores` |
A matrix of z-scores for each locus and each environmental variable. |

`gif` |
A vector of genomic inflation factors computed for each environmental variable. |

Olivier Francois

Caye K, Jumentier B, Lepeule J, Francois O. (2019). LFMM 2: fast and accurate inference of gene-environment associations in genome-wide studies. Molecular biology and evolution, 36(4), 852-860.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ```
### Example of analysis using lfmm2 ###
# Simulation with 10 target loci, with effect sizes ranging between -10 an 10
# n = 100 individuals and L = 1000 loci
X <- as.matrix(rnorm(100)) # environmental variable
B <- rep(0, 1000)
target <- sample(1:1000, 10) # target loci
B[target] <- runif(10, -10, +10) # effect sizes
# Creating hidden factors and loadings
U <- t(tcrossprod(as.matrix(c(-1,0.5,1.5)), X)) + matrix(rnorm(300), ncol = 3)
V <- matrix(rnorm(3000), ncol = 3)
# Simulating a binarized matrix containing haploid genotypes
# Simulation performed with the generative LFMM
Y <- tcrossprod(as.matrix(X), B) + tcrossprod(U, V) + matrix(rnorm(100000, sd = .5), nrow = 100)
Y <- matrix(as.numeric(Y > 0), ncol = 1000)
######################################
# Fitting an LFMM with K = 3 factors #
######################################
mod2 <- lfmm2(input = Y, env = X, K = 3)
# Computing P-values and plotting their minus log10 values
# Target loci are highlighted
pv <- lfmm2.test(object = mod2, input = Y, env = X, linear = TRUE)
plot(-log10(pv$pvalues), col = "grey", cex = .4, pch = 19)
points(target, -log10(pv$pvalues[target]), col = "red")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.