GithubHelp home page GithubHelp logo

birthdeathpy's Introduction

Discrete Self Replicating Birth Death Process

Simulates a simple. discrete time stochastic model of a self replicating object, i.e.

A -> A + A
A -> 0

In addition, objects can mutate, i.e. A->B, and B replicates with the same rules.

Examples:

  • cellular growth and death (mutation rate would e.g. be the emergence of a new genotype)
  • PCR amplification

Installation

Requirements: Just a recent python3 installation with pip, e.g. miniconda.

pip install git+https://github.com/redst4r/birthdeathpy.git

Usage

Via the script birthdeath:

birthdeath simulate_uniform_abundance ...

This simulates a population of species with equal initial abundance.

birthdeath simulate_dirichlet_abundance ...

Simulates the population of species with initial abundances drawn from a Dirichlet distribution (--alpha parameter!). This allows for skewed starting distributions.

Example

birthdeath simulate_uniform_abundance \
  --n_species 1000 \
  --abundance 1 \
  --rounds 20 \
  --mutation_rate 0.001 \
  --death_probability 0.2 \
  -output_prefix results_

This initializes the population with 1000 distinct species, each having one individual (A_i = 1, i=1...1000), replicates for 20 rounds with given death and mutation probabilities (per round) and saves the results under results_....

Outputs

Outputs are saved under the given --output_prefix:

  • ...clonesizes.csv: Sizes of all surviving species after replication
  • ...initial_clonesize.png: Histogram of initial clonesizes
  • ...final_clonesize.png: Histogram of final clonesizes

birthdeathpy's People

Contributors

redst4r avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.