Skip to main content

Linear mixed model to study multivariate genotype-environment interactions

Project description


Travis AppVeyor

Structured Linear Mixed Model (StructLMM) is a computationally efficient method to test for and characterize loci that interact with multiple environments [1].

This a standalone module that implements the basic functionalities of StructLMM. However, we recommend using StructLMM via LIMIX2 as this additionally implements:

  • Multiple methods for GWAS;
  • Methods to characterize GxE at specific variants;
  • Command line interface.


From terminal, it can be installed using pip:

pip install struct-lmm


>>> from numpy import ones, concatenate
>>> from numpy.random import RandomState
>>> from struct_lmm import StructLMM
>>> random = RandomState(1)
>>> n = 20
>>> k = 4
>>> y = random.randn(n, 1)
>>> E = random.randn(n, k)
>>> M = ones((n, 1))
>>> x = 1.0 * (random.rand(n, 1) < 0.2)
>>> lmm = StructLMM(y, M, E)
>>> pv = lmm.score_2dof_assoc(x)
>>> print(pv)
>>> M = concatenate([M, x], axis=1)
>>> lmm = StructLMM(y, M, E)
>>> pv = lmm.score_2dof_inter(x)
>>> print(pv)


If you encounter any problem, please, consider submitting a new issue.



This project is licensed under the MIT License.

[1] Moore, R., Casale, F. P., Bonder, M. J., Horta, D., Franke, L., Barroso, I., & Stegle, O. (2018). A linear mixed-model approach to study multivariate gene–environment interactions (p. 1). Nature Publishing Group.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for struct-lmm, version 0.3.1
Filename, size File type Python version Upload date Hashes
Filename, size struct-lmm-0.3.1.tar.gz (11.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page