Skip to content

Allow tutes to work with stdpopsim3 #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions popgen.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ large genomic datasets.

Several simulation tools output tree sequences. Below we use the
standard library for population genetic simulation models
([stdpopsim](https://popsim-consortium.github.io/)) to generate a model of
([stdpopsim](https://popsim-consortium.github.io/stdpopsim-docs/)) to generate a model of
*Homo sapiens*, in which African, Eurasian,
and Asian populations combine to generate a mixed American population. We can use the
[demesdraw](https://pypi.org/project/demesdraw/) package to plot a schematic of the
Expand All @@ -107,7 +107,7 @@ import demesdraw
from matplotlib import pyplot as plt

species = stdpopsim.get_species("HomSap")
model = species.get_demographic_model("AmericanAdmixture_4B11")
model = species.get_demographic_model("AmericanAdmixture_4B18")

# Plot a schematic of the model
demesdraw.tubes(model.model.to_demes(), ax=plt.gca(), seed=1, log_time=True)
Expand All @@ -125,7 +125,7 @@ succinct tree sequence named `ts`:
contig = species.get_contig("chr1", mutation_rate=model.mutation_rate, right=20_000)
samples = {"AFR": 4, "EUR": 4, "ASIA": 4, "ADMIX": 4} # 16 diploid samples
engine = stdpopsim.get_engine("msprime")
ts = engine.simulate(model, contig, samples, seed=9)
ts = engine.simulate(model, contig, samples, seed=9).trim() # trim to first 20kb simulated
print(f"Simulated a tree sequence of {ts.num_samples} haploid genomes:")
print(f"{ts.num_sites} variable sites over {ts.sequence_length} base pairs")
```
Expand Down
2 changes: 1 addition & 1 deletion requirements-CI.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ numpy==1.26.4
pandas==2.2.2
pygraphviz==1.13
scikit-allel==1.3.8
stdpopsim==0.2.0
stdpopsim==0.3.0
tqdm==4.66.3
tskit==0.5.8
tskit_arg_visualizer==0.0.1
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ networkx
pandas
pygraphviz
scikit-allel
stdpopsim
stdpopsim>=0.3
tqdm
tskit>=0.5.4
tskit_arg_visualizer
Expand Down
Loading