#!/usr/bin/env python import dadi import pylab import matplotlib.pyplot as plt import numpy as np from numpy import array from dadi import Misc, Spectrum, Numerics, PhiManip, Integration, Demographics1D, Demographics2D import sys infile = sys.argv[1] popid = [sys.argv[2]] proj = range(int(sys.argv[3]), int(sys.argv[4])) dd = Misc.make_data_dict(infile) for p in range(len(proj)): data = Spectrum.from_data_dict(dd, pop_ids=popid, projections=[proj[p]], polarized=False) print proj[p], data.S()
import numpy import dadi import Plotting_Functions from dadi import Numerics, PhiManip, Integration, Misc from dadi.Spectrum_mod import Spectrum #=========================================================================== # Import data to create joint-site frequency spectrum #=========================================================================== #************** #path to your input file snps = "/Users/portik/Documents/GitHub/dadi_pipeline/Two_Population_Pipeline/Example_Data/dadi_2pops_North_South_snps.txt" #Create python dictionary from snps file dd = Misc.make_data_dict(snps) #************** #pop_ids is a list which should match the populations headers of your SNPs file columns pop_ids = ["North", "South"] #************** #projection sizes, in ALLELES not individuals proj = [16, 32] #Convert this dictionary into folded AFS object #[polarized = False] creates folded spectrum object fs = Spectrum.from_data_dict(dd, pop_ids=pop_ids, projections=proj, polarized=False)