Code Monkey home page Code Monkey logo

kerr_mean_field_paper_2021's Introduction

Python implementation of Kerr's OPMF stochastic simulator

Example usage

Simulate

num_sites, num_replicates = 100, 20
nn_simulator = NNSim(num_sites, num_replicates, 0.2, 50, 0.8)

timespan = (0, 10)
cpgs, ts = nn_simulator.run(timespan, 10_000)

result

import matplotlib.pyplot as plt

plt.rcParams['font.family'] = 'Arial'

fig, axs = plt.subplots(1, 3, constrained_layout=True, sharey=True, sharex=False)

slice_step = ts.shape[0] // 50

ax = axs[0]
ax.imshow(ts[::slice_step], cmap='magma', vmin=timespan[0], vmax=timespan[1])
ax.set_title('Time evolution')
ax.set_xlabel('Replicate')
ax.set_ylabel(r'Time step, $\times50$')

ax = axs[1]
ax.imshow(cpgs.mean(axis=1)[::slice_step], vmin=0, vmax=2, cmap='RdYlBu_r')
ax.set_title('State evolution, \nsites averaged')
ax.set_xlabel('Replicate')

ax = axs[2]
ax.imshow(cpgs[::slice_step, ::num_sites//num_replicates, 3], vmin=0, vmax=2, cmap='RdYlBu_r')
ax.set_title('State evolution, \nsingle replicate')
ax.set_xlabel(r'CpG site, $\times5$')

fig.suptitle('Cluster mean-field DNA methylation model (Kerr et al. 2022)\n'r'$a=0.2, x=50, y=0.8$')

Plot of example results.

kerr_mean_field_paper_2021's People

Contributors

lkerr34 avatar t-silvers avatar

Watchers

 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.