Skip to content

Commit

Permalink
Merge pull request #48 from popgensims/docfix
Browse files Browse the repository at this point in the history
Minor doc fixes
  • Loading branch information
andrewkern committed Apr 2, 2019
2 parents fb089a9 + 4c5c9f6 commit d6b6aa7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
6 changes: 3 additions & 3 deletions dmel_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
samples=samples,
# recombination rate placeholder for quick runtime
recombination_rate=1e-09,
mutation_rate=chrom.mean_mutation_rate,
mutation_rate=chrom.default_mutation_rate,
**model.asdict())
print("simulated:", ts.num_trees, ts.num_sites)

Expand All @@ -42,7 +42,7 @@
samples=samples,
# recombination rate placeholder for quick runtime
recombination_rate=1e-09,
mutation_rate=chrom.mean_mutation_rate,
mutation_rate=chrom.default_mutation_rate,
**model.asdict())
print("simulated:", ts.num_trees, ts.num_sites)

Expand All @@ -61,7 +61,7 @@
samples=samples,
# actual recombination map; slow
recombination_map=chrom.recombination_map(),
mutation_rate=chrom.mean_mutation_rate,
mutation_rate=chrom.default_mutation_rate,
**model.asdict())
print("simulated:", ts.num_trees, ts.num_sites)

16 changes: 11 additions & 5 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ might have:
chrom = homo_sapiens.genome.chromosomes["chr22"]
ts = msprime.simulate(
sample_size=10,
recombination_rate=chrom.mean_recombination_rate,
mutation_rate=chrom.mean_mutation_rate,
recombination_rate=chrom.default_recombination_rate,
mutation_rate=chrom.default_mutation_rate,
length=chrom.length)
(This should be a very quick simulation, and the result will have very few
variants, because although it performs a coalescent simulation of
a 51,304,566bp chromosome, it does this with the effective population size of
`Ne=1`.)

The chromosome definitions also aware of recombination maps, so we can run
more complex simulations like:
Expand All @@ -38,7 +42,7 @@ more complex simulations like:
chrom = homo_sapiens.genome.chromosomes["chr22"]
ts = msprime.simulate(
sample_size=10,
mutation_rate=chrom.mean_mutation_rate,
mutation_rate=chrom.default_mutation_rate,
recombination_map=chrom.recombination_map())
Recombination maps will be downloaded on demand and cached in a
Expand All @@ -51,7 +55,7 @@ API will use the default. We can also ask for specific maps, if we want:
chrom = homo_sapiens.genome.chromosomes["chr22"]
ts = msprime.simulate(
sample_size=10,
mutation_rate=chrom.mean_mutation_rate,
mutation_rate=chrom.default_mutation_rate,
recombination_map=chrom.recombination_map("HapmapII_GRCh37"))
Expand All @@ -69,9 +73,11 @@ Demographic models can also be used. For example
ts = msprime.simulate(
samples=samples,
recombination_map=chrom.recombination_map(),
mutation_rate=chrom.mean_mutation_rate,
mutation_rate=chrom.default_mutation_rate,
**model.asdict())
(This simulation now has a realistic effective population size,
so will produce thousands of variant sties, but still runs very fast.)

*****************
General utilities
Expand Down
2 changes: 1 addition & 1 deletion docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Overview
The ``stdpopsim`` library requires Python 3.4 or later. For ``pip`` users,
install the packages required for development using::

$ python3 -m pip install requirements/development.txt
$ python3 -m pip install -r requirements/development.txt

We do require ``msprime``, so please see the the `installation notes
<https://msprime.readthedocs.io/en/stable/installation.html>`_ if you
Expand Down
4 changes: 2 additions & 2 deletions ecoli_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

ts = msprime.simulate(
samples=samples,
mutation_rate=chrom.mean_mutation_rate,
mutation_rate=chrom.default_mutation_rate,
**model.asdict())
print("simulated:", ts.num_trees, ts.num_sites)
print("mean mut rate", chrom.mean_mutation_rate)
print("mean mut rate", chrom.default_mutation_rate)
2 changes: 1 addition & 1 deletion example.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
ts = msprime.simulate(
samples=samples,
recombination_map=chrom.recombination_map(),
mutation_rate=chrom.mean_mutation_rate,
mutation_rate=chrom.default_mutation_rate,
**model.asdict())
print("simulated:", ts.num_trees, ts.num_sites)
3 changes: 3 additions & 0 deletions stdpopsim/homo_sapiens.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

class HapmapII_GRCh37(genetic_maps.GeneticMap):
"""
Usage: `hapmap = homo_sapiens.HapmapII_GRCh37()` (note the
parentheses).
The Phase II HapMap Genetic map (lifted over to GRCh37) used in
1000 Genomes. Please see the `README
<ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/technical/working/20110106_recombination_hotspots/README_hapmapII_GRCh37_map>`_
Expand Down

0 comments on commit d6b6aa7

Please sign in to comment.