question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simulate genotypes for unit tests

See original GitHub issue

I’m trying to simulate some genotype calls for unit tests using a simple model from msprime. At @jeromekelleher’s suggestion, I tried this:

# Using 1.x code, not yet released
!pip install git+https://github.com/tskit-dev/msprime.git#egg=msprime

import msprime
model = msprime.Demography.island_model(2, migration_rate=1e-3, Ne=10**4)
samples = model.sample(10, 10) # 10 haploids from each pop
ts = msprime.simulate(
     samples=samples,
     demography=model, # what should this be?
     mutation_rate=1e-8,
     recombination_rate=1e-8
)
list(ts.variants())
[]

What is demography supposed to be? I saw a “FIXME” for documenting it in simulate but I wasn’t sure what to set it to if not the Demography instance that comes back from island_model.

Also, is this why I’m not getting any variants back out?

I am ultimately trying to simulate hardy weinberg equilibrium. I’d like to have some fraction of the variants be in or near perfect equilibrium and the remainder way out of it. If you get a chance, could I get an assist @jeromekelleher?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
eric-czechcommented, Jul 8, 2020

+1 @eric-czech when we figure out the right toolset for (test) data generation it could be valuable to expose them as strategies in hypothesis (this could be a separate test module within this repo). wdyt?

Yea, I don’t see why not

0reactions
jeromekellehercommented, Oct 20, 2020

I think we can - closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Simulating autosomal genotypes with realistic linkage ... - NCBI
Our method can simulate genetically homogeneous or stratified populations and can simulate case-parents studies, case-control studies, case-only ...
Read more >
cophesim: A comprehensive phenotype simulator for testing ...
genotype data prepared with a genetic simulator. The output of cophesim can be used as a direct input for different genome wide.
Read more >
a fast method for simulation of large scale case–control GWAS ...
A common method used by GWAS simulators is to proceed by adding phenotypes to a sample of genotype data that is either simulated...
Read more >
A computer program to simulate multilocus genotype data with ...
This paper proposes a model and simulation method implemented in a computer program to flexibly simulate data displaying such patterns. The ...
Read more >
MAPITR_TestData_Genotypes: MAPITR TestData Genotypes in ...
Description. A simulated dataset of genotypes for use in unit tests · Format. A data frame with 500 rows (individuals) and 750 variables...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found