Giter Club home page Giter Club logo

chuong_et_al's Introduction

Simulation-based inference for Chuong et al. 2024

This is the code for the simulation-based inference of the paper:

Julie N. Chuong, Nadav Ben Nun, Ina Suresh, Julia Matthews, Titir De, Grace Avecilla, Farah Abdul-Rahman, Nathan Brandt, Yoav Ram, David Gresham (2024) DNA replication errors are a major source of adaptive gene amplification.

It shares some components with the code of Avecilla et al. (2022) (graceave/cnv_sims_inference), mostly regarding network training.

To run the inference and see its results:

  1. Install sbi library: pip install sbi
  2. Create a folder named presimulated_data, and generate 100k simulations: python generate_presimulated_data.py -p 100000 -m WF -n reproduced -g Chuong_116_gens.txt
  3. Train a neural density estimator on the simulations: python infer_sbi_initial_beneficial.py -m WF -pd WF_presimulated_data_100000_reproduced.csv -pt WF_presimulated_theta_100000_reproduced.csv -g Chuong_116shares_gens.txt -s 42 -n reproduced Once done, posterior should be at posteriors/posterior_reproduced.pkl
  4. Go to Empirical Analysis.ipynb, change the posterior path, and run the notebook.

To run the collective posterior inference, run the Overall Posterior.ipynb notebook.

  • The normalizing constants are saved in posteriors/log_Cs, but can be re-generated using OverallPosterior.get_log_C method.
  • Overall posterior MAPs and samples are in the maps folder, but can be re-generated using get_map and sample methods.

To review your trained network and simulations, you can go to Simulation Analysis.ipynb. These simulations were generated from a narrow parameter range (details in the notebook). If you wish to validate your trained network on a different simulation set, you can simply generate other simulations by following step 2 above, and change the relevant cells in the notebook.

For more information, you can contact Nadav Ben Nun or the Ram lab at Tel Aviv University.

License

Source code: MIT License. Other content: Creative Commons Attribution 4.0 International License.

chuong_et_al's People

Contributors

nadavbennun1 avatar yoavram 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.