From 63d3eb0015bb063dfe7457e915f13242f7fdc937 Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Fri, 2 Feb 2018 14:41:30 +0000 Subject: [PATCH 1/5] Document uniform_map. Closes #382 --- msprime/simulations.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/msprime/simulations.py b/msprime/simulations.py index 6e52468aa..cf54f257a 100644 --- a/msprime/simulations.py +++ b/msprime/simulations.py @@ -619,6 +619,24 @@ def __init__(self, positions, rates, num_loci=None): @classmethod def uniform_map(cls, length, rate, num_loci=None): + """ + Returns a :class:`.RecombinationMap` instance in which the recombination + rate is constant over a chromosome of the specified length. The optional + ``num_loci`` controls the number of discrete loci in the underlying + simulation, and is by default large enough to be effectively be + a continuous model. + + The following map can be used to simulate a true finite locus model + with a fixed number of loci ``m``:: + + >>> recomb_map = RecombinationMap.uniform_map(m, rate, num_loci=m) + + :param float length: The length of the chromosome. + :param float rate: The rate of recombination per unit of sequence length + along this chromosome. + :param int num_loci: The number of discrete loci in the underlying + simulation. By default this is set to a large number. + """ return cls([0, length], [rate, 0], num_loci) @classmethod From d1d253779e883b9cff349a2dee467c288208ccd7 Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Fri, 2 Feb 2018 14:51:52 +0000 Subject: [PATCH 2/5] Note on edge order for sort_tables. Closes #361 --- msprime/tables.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/msprime/tables.py b/msprime/tables.py index abd1dd8f2..a586b9e08 100644 --- a/msprime/tables.py +++ b/msprime/tables.py @@ -1193,6 +1193,12 @@ def sort_tables( - child node ID, then - left endpoint. + Note that this sorting order exceeds the + :ref:`edge sorting requirements ` for a valid + tree sequence. For a valid tree sequence, we require that all edges for a + given parent ID are adjacent, but we do not require that they be listed in + sorted order. + Sites are sorted by position. Mutations are sorted by site ID. From bab5d5a53aa82d407f8579af2fde6520801eba69 Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Fri, 2 Feb 2018 15:25:59 +0000 Subject: [PATCH 3/5] Doc tweaks. Closes #84 (link to mailing list) --- README.md | 6 ++++++ docs/index.rst | 6 ++++++ docs/introduction.rst | 11 ++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4eafb66b6..d74e6c7e1 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,12 @@ If you would like to help make ``msprime`` better, please see the [developer documentation](https://msprime.readthedocs.org/en/latest/development.html) to get started. +If you are looking for help on a specific issue or would like to ask a +question to fellow ``msprime`` users, please send an email to the +[mailing list](https://groups.google.com/group/msprime-users). By asking +questions on the mailing list, you can help to build a searchable knowledge +base. + If you use ``msprime`` in your work, please cite the [PLOS Computational Biology](http://dx.doi.org/10.1371/journal.pcbi.1004842) paper. See [here](https://msprime.readthedocs.org/en/latest/CITATION.html) for diff --git a/docs/index.rst b/docs/index.rst index f5fe5e720..a8578f4c8 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,6 +9,12 @@ Welcome to msprime's documentation! This is the documentation for ``msprime``, a reimplementation of Hudson's classical :command:`ms` simulator. +If you are looking for help on a specific issue or would like to ask a +question to fellow ``msprime`` users, please send an email to the +`mailing list `_. By asking +questions on the mailing list, you can help to build a searchable knowledge +base. + Contents: ========= diff --git a/docs/introduction.rst b/docs/introduction.rst index b62fd74bd..2e499913e 100644 --- a/docs/introduction.rst +++ b/docs/introduction.rst @@ -20,7 +20,7 @@ scenarios. The library is a reimplementation of Hudson's seminal 2. ``msprime`` is primarily designed to be used through its :ref:`Python API ` to simplify the workflow associated with running and analysing simulations. (However, we do provide an - ``ms``_compatible :ref:`command line interface ` to + ``ms`` compatible :ref:`command line interface ` to plug in to existing workflows.) For many simulations we first write a script to generate the command line parameters we want to run, then fork shell processes to run the simulations, @@ -36,3 +36,12 @@ scenarios. The library is a reimplementation of Hudson's seminal format allows us to store genealogical data very concisely, particularly for large sample sizes. + +The ``msprime`` library has also evolved to support data +from external sources, and can work with data conforming to +the :ref:`sec_interchange` definitions. In the near future, the +efficient algorithms and data structures used to process tree +sequence data will be moved into a new library, provisiononally +called ``tskit``. Once this transition is complete, ``msprime`` +will depend on this library, and will become primarily concerned +with simulating backwards-in-time population processes. From 6058a6d7445757ddc922f2b9938b13984539c258 Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Fri, 2 Feb 2018 15:37:56 +0000 Subject: [PATCH 4/5] Modernised setup.py, and change README to rst. Removed ez_setup, as this seems redundant now. --- README.rst | 23 +++++++++++++++++++++++ README.txt | 27 --------------------------- setup.py | 12 +++--------- 3 files changed, 26 insertions(+), 36 deletions(-) create mode 100644 README.rst delete mode 100644 README.txt diff --git a/README.rst b/README.rst new file mode 100644 index 000000000..7d4f8958a --- /dev/null +++ b/README.rst @@ -0,0 +1,23 @@ +======= +msprime +======= + +Msprime is a coalescent simulator and library for processing +tree-based genetic data. Msprime can simulate the coalescent with +recombination over whole chromosomes for hundreds of thousands of +samples, and very efficiently process the resulting genealogies. +It is also possible to efficiently read data from external +sources via a well defined and efficient `interchange API +`_. + +If you use ``msprime`` in your work, please cite the `PLOS Computational +Biology `_ paper. +See `here `__ for +full citation details. + +Please see the `documentation `_ +for further details. + +Msprime is very portable, and provides a number of installation options. +See `here `_ for +details. diff --git a/README.txt b/README.txt deleted file mode 100644 index cc98dfed2..000000000 --- a/README.txt +++ /dev/null @@ -1,27 +0,0 @@ -======= -msprime -======= - -Msprime is a reimplementation of Hudson's classical ms program for modern -datasets. It provides a convenient Python API and HDF5-based storage format, as -well as the ``mspms`` command line interface. This program provides a fully -``ms`` compatible interface, and can be used as a drop-in replacement in -existing workflows. - -Msprime can simulate the coalescent with recombination much -faster than programs based on the Sequentially Markov Coalescent -for large sample sizes and has very reasonable memory requirements. Msprime -makes it possible to simulate chromosome sized regions with hundreds of -thousands of samples. - -If you use ``msprime`` in your work, please cite the `PLOS Computational -Biology `_ paper. -See `here `_ for -full citation details. - -Please see the `documentation `_ -for further details. - -Msprime is very portable, and provides a number of installation options. -See `here `_ for -details. diff --git a/setup.py b/setup.py index 471a30154..ab16545fc 100644 --- a/setup.py +++ b/setup.py @@ -19,6 +19,8 @@ from __future__ import division from __future__ import print_function +from setuptools import setup, Extension + import subprocess import platform import os @@ -42,14 +44,6 @@ except ImportError: warn("numpy not available. Some features will not work.") -# First, we try to use setuptools. If it's not available locally, -# we fall back on ez_setup. -try: - from setuptools import setup, Extension -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, Extension class PathConfigurator(object): @@ -170,7 +164,7 @@ def __getitem__(self, index): library_dirs=configurator.library_dirs, ) -with open("README.txt") as f: +with open("README.rst") as f: long_description = f.read() setup( From caf383586dcf4be2b3262d5e8aa4a8ce8d2cc79c Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Fri, 2 Feb 2018 15:46:22 +0000 Subject: [PATCH 5/5] Revert version number in sphinx to use setuptools_scm. --- docs/conf.py | 7 +++---- setup.py | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 92ea397bd..2600e7e3c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -138,11 +138,10 @@ def handle_item(fieldarg, content): # |version| and |release|, also used in various other places throughout the # built documents. # -# Following advice from setuptools_scm at -# https://github.com/pypa/setuptools_scm try: - release = pkg_resources.get_distribution('msprime').version - version = '.'.join(release.split('.')[:2]) + from setuptools_scm import get_version + release = get_version(root='..', relative_to=__file__) + version = release[:3] except pkg_resources.DistributionNotFound: release = "0.0.0" version = "0.0.0" diff --git a/setup.py b/setup.py index ab16545fc..3e85609db 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,6 @@ warn("numpy not available. Some features will not work.") - class PathConfigurator(object): """ A class to attempt configuration of the compile search paths