Skip to main content

moments: population genetic analyses and inference using diversity statistics

Please see the documentation for more details, examples, tutorials and API usage.

moments provides a suite of methods for demographic history and selection inference from genetic data, based on diffusion approximations to the one- and two-locus allele frequency spectrum. moments is modeled after the ∂a∂i open source package developed by Ryan Gutenkunst. For SFS-based methdos, we largely reuse ∂a∂i's API, but introduce a new simulation engine. This new method is based on the direct computation of the frequency spectrum without solving the diffusion system, removing the need for frequency grids as used in ∂a∂i. moments.LD, packaged within moments, implements methods for computing linkage disequilibrium statistics and running multi-population demographic inference using patterns of LD.

Getting started

moments now supports Python 3, and we no longer guarantee compatibility with Python 2.

The simplest way to install moments is using pip:

pip install moments-popgen

moments can then be imported using import moments. Important note: pip install moments installs a different package named moments, and our pypi package is named moments-popgen.

We can install the development branch directly from Github by running

pip install git+https://github.com/MomentsLD/moments.git@devel

Alternatively, you can clone the git repository to make an editable or development build.

git clone https://github.com/MomentsLD/moments.git

and then from within the moments directory (cd moments), run

pip install -r requirements.txt
pip install .

If you use conda, moments is available via bioconda:

conda config --add channels bioconda
conda install moments

Citing moments

If you use moments in your research, please cite:

  • Jouganous, J., Long, W., Ragsdale, A. P., & Gravel, S. (2017). Inferring the joint demographic history of multiple populations: beyond the diffusion approximation. Genetics, 206(3), 1549-1567.

If you use moments.LD in your research, please cite:

  • Ragsdale, A. P. & Gravel, S. (2019). Models of archaic admixture and recent history from two-locus statistics. PLoS Genetics, 15(6), e1008204.

  • Ragsdale, A. P. & Gravel, S. (2020). Unbiased estimation of linkage disequilibrium from unphased data. Mol Biol Evol, 37(3), 923-932.

If you use moments.TwoLocus in your research, please cite:

moments is developed in the Simon Gravel and Aaron Ragsdale research groups, at McGill University and UW-Madison, respectively. For any issues, questions or bug reports, please open an issue on Github.

Dependencies

If you install moments from source (e.g., after cloning the repository), you will need to install the dependencies. These are all listed in requirements.txt, and can be installed via pip after navigating to the moments directory:

pip install -r requirements.txt

A few more details: moments and moments.LD requires a handful of dependencies. At a minimum, these include

  • numpy

  • scipy

  • cython

  • mpmath

  • demes

We also strongly recommend installing ipython.

If you are using conda, all dependencies can be installed by navigating to the moments directory and then running

conda install --file requirements.txt

Once dependencies are installed, to install moments, run the following command in the moments directory:

python -m pip install -e .

You should then be able to import moments in your python scripts. Entering an ipython or python session, try to import moments. More details on installation can be found in the documentation. If, for any reason, you have trouble installing moments after following these steps, please submit an issue.

If you use Parsing from moments.LD, which reads VCF files and computes LD statistics to compare to predictions from moments.LD, you will need to additionally install

  • hdf5

  • scikit-allel

  • pandas

Changelog

All changes are detailed in the documentation.

Download files

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

Source Distribution

moments_popgen-1.6.1.tar.gz (4.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

moments_popgen-1.6.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

moments_popgen-1.6.1-cp314-cp314-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

moments_popgen-1.6.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

moments_popgen-1.6.1-cp313-cp313-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

moments_popgen-1.6.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

moments_popgen-1.6.1-cp312-cp312-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

moments_popgen-1.6.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

File details

Details for the file moments_popgen-1.6.1.tar.gz.

File metadata

  • Download URL: moments_popgen-1.6.1.tar.gz
  • Upload date:
  • Size: 4.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for moments_popgen-1.6.1.tar.gz
Algorithm Hash digest
SHA256 f14c4a98e8d9f21e3701c6e1df7c83b6d06e4f0ef67c2b4eb2ca6f92e4f3aa28
MD5 159e38a1c084e8763fdc966caeae4284
BLAKE2b-256 347d495296d6c7ffbed03db2f2e99777220814cc0690f1911380f88d5b65cc9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for moments_popgen-1.6.1.tar.gz:

Publisher: wheels.yml on MomentsLD/moments

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moments_popgen-1.6.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for moments_popgen-1.6.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 d354e59fd51c67f1e07786ad731411c6fab1daa575037441f3b90d01c5840a69
MD5 e982e5cc0bf0c2a3febf9f20206f3f68
BLAKE2b-256 97e379e421dad1a7b9621f9c32d607a5242e66d456d64f2d656219256508d838

See more details on using hashes here.

Provenance

The following attestation bundles were made for moments_popgen-1.6.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl:

Publisher: wheels.yml on MomentsLD/moments

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moments_popgen-1.6.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for moments_popgen-1.6.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd67ac429bf7010a90e56a5f2609bd372ac2d08a2513cc446e52a739ec1995f5
MD5 da7d5f12780fabf025e3b36d2a752190
BLAKE2b-256 4adcf6df973dc31a74157e505350000ea262a03d1b96f689dd037427f34ab7d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for moments_popgen-1.6.1-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: wheels.yml on MomentsLD/moments

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moments_popgen-1.6.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for moments_popgen-1.6.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 1db6bb62194e03d456aca70f4e55a41c028e44ab8cbd0c129e7a2c31fa48d5c2
MD5 69d0df1b3741eac9a9f943ec9467918f
BLAKE2b-256 d13973c4ae76e96c20c975f19b752add214f060b594c7d44b6c76bf12132fa3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for moments_popgen-1.6.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl:

Publisher: wheels.yml on MomentsLD/moments

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moments_popgen-1.6.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for moments_popgen-1.6.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d1e9bf3dea6207ea5071a2f337a6ca5aa24088d8fc6a48afa81b85201709328a
MD5 b0b24d6f1a509eebc0ab2315702c3585
BLAKE2b-256 8bd0b4883214828e59a70329fbb05be8d34f7e84c54523fdb077c37e74d3039c

See more details on using hashes here.

Provenance

The following attestation bundles were made for moments_popgen-1.6.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: wheels.yml on MomentsLD/moments

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moments_popgen-1.6.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for moments_popgen-1.6.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 10c9cb1c9fb48d780e7aacda642ac47ef925fbbba6d6d37a0d36acbe19c4e6a9
MD5 0454b899dbd1a84a07427a528c97c376
BLAKE2b-256 de898114b5353292610e41595785b5cc6a086186d837da416ee6228faa6d4bf3

See more details on using hashes here.

Provenance

The following attestation bundles were made for moments_popgen-1.6.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl:

Publisher: wheels.yml on MomentsLD/moments

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moments_popgen-1.6.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for moments_popgen-1.6.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4bf8ad1c485616682a4adfc4aac008572fab4054550e0764a8f86873afefcc28
MD5 58be9f77e8303dac8fa282db0b90b0ef
BLAKE2b-256 320ad983913f26f5b0f485664b5e5223dd854b0ec9c4c286bb7d37ef8271f708

See more details on using hashes here.

Provenance

The following attestation bundles were made for moments_popgen-1.6.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: wheels.yml on MomentsLD/moments

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moments_popgen-1.6.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for moments_popgen-1.6.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 8ece9a4a51145468aa94fb9e01f2c61abf1de78159f1fa1ec8860eb3f63a9507
MD5 017226f8674091735f4e9eeb1944cd7e
BLAKE2b-256 1d04c790c9e44b401b9cd0dd3b142d910f2bbacf4a4026aad6a9887a2e6b6f3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for moments_popgen-1.6.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl:

Publisher: wheels.yml on MomentsLD/moments

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.6.1 This release

8 files

1.6.0

8 files

1.5.4

8 files

1.5.3

8 files

1.5.2

8 files

1.5.1

8 files

1.5.0

7 files

1.4.6

7 files

1.4.5

9 files

1.4.4

9 files

1.4.3

9 files

1.4.2

9 files

1.4.1

9 files

1.4.0

9 files

1.3.1

10 files

1.3.0

10 files

1.2.2

10 files

1.2.1

10 files

1.2.0

10 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page