Giter Club home page Giter Club logo

moments's Introduction

Moments

This repository contains scripts for 3D and 4D demographic models using the program Moments, models were published in Farleigh et al., 2021. See the Citing this repository subheading for the references in this repository.

Purpose

Perform demographic model optimization and comparisons with the python package moments.

Overview

In the main repository there are two scripts (moments_Run_Optimizations.py & Optimize_Function.py) that must be in the working directory to run properly. These scripts were developed by Dr. Daniel Portik and have been modified for our purposes. The optimization script will perform the optimization routine proposed by Portik et al., 2017. The routine was originally written for dadi but will also work for moments.

The 3D and 4D subdirectories contain the python scripts for the respective sets of models, there are also conceptual figures that demonstrate what each model does in these subdirectories.

What you'll need

  1. A site frequency spectrum (SFS), this can be created in moments or with a program like easySFS
  2. The moments_Run_Optimizations.py and Optimize_Function.py scripts, they must be in the same directory as your SFS and Model.py script.
  3. Summarize_Outputs.py, must also be in your working directory

Workflow

  1. Create your SFS and place in your working directory
  2. Download the moments_Run_Optimizations.py and Optimize_Function.py scripts into your working directory with your SFS and Models.py script
  3. Run moments
  4. Inspect your results

Example Usage

Load python

module load anaconda-python3
source /software/python/anaconda3/etc/profile.d/conda.sh

Import the modules

python3
import moments
import matplotlib
import pylab

Run the Models (assuming that your models are named Models_3D.py), make sure you understand the optimization settings before copying mine. See Dr. Daniel Portik's repository for an explaination.

import Models_3D
import Optimize_Functions

#Set the number of rounds here
rounds = 4
#define the lists for optional arguments
#you can change these to alter the settings of the optimization routine
reps = [10,20,30,40]
maxiters = [3,5,10,15]
folds = [3,2,2,1]
prefix = "Final"
fs_folded = True

# Run the Models 
Optimize_Functions.Optimize_Routine(fs, prefix, "sim_split_no_mig", Models_3D.sim_split_no_mig, rounds, 4, fs_folded=fs_folded, reps=reps, maxiters=maxiters, folds=folds, param_labels = "nu1, nu2, nu3, T1")

# Summarize the outputn (after leaving python)
python ./Summarize_Outputs.py ./

Contact

If you have any questions or issues with this repository please post it on the issues page of this repository or email me at [email protected]. Also, if you would like to run moments but do not see the models that you want to run here feel free to reach out.

Citing this repository

If you use any of the resources from this repository please consider citing the following publications. The models were developed as a part of Farleigh et al., 2021, the optimization routine was developed by Dr. Daniel Portik and was originally published in 2017.

  • Farleigh et al., citation
  • Gutenkunst, R.N., Hernandez, R.D., Williamson, S.H., and C.D. Bustamante. 2009. Inferring the joint demographic history of multiple populations from multidimensional SNP frequency data. PLoS Genetics 5: e1000695.
  • Jouganous, J., Long, W., Ragsdale, A. P., and S. Gravel. 2017. Inferring the joint demographic history of multiple populations: Beyond the diffusion approximation. Genetics 117: 1549-1567.
  • Portik, D.M., Leache, A.D., Rivera, D., Blackburn, D.C., Rodel, M.-O., Barej, M.F., Hirschfeld, M., Burger, M., and M.K. Fujita. 2017. Evaluating mechanisms of diversification in a Guineo-Congolian forest frog using demographic model selection. Molecular Ecology 26: 5245-5263. https://doi.org/10.1111/mec.14266

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.