#!/usr/bin/env python import moments import numpy as np from numpy import array from moments import Misc, Spectrum import sys infile = sys.argv[1] pop_ids = [sys.argv[2]] projections = [int(sys.argv[3])] outname = pop_ids[0] + "_sfs_folded" dd = Misc.make_data_dict(infile) data = Spectrum.from_data_dict(dd, pop_ids, projections, polarized=False) Spectrum.to_file(data, outname, precision=4, foldmaskinfo=False)
from moments import Misc, Spectrum, Numerics, Manips, Integration, Demographics1D, Demographics2D import sys infile = sys.argv[1] pop_ids = [sys.argv[2], sys.argv[3]] projections = [int(sys.argv[4]), int(sys.argv[5])] #params=[float(sys.argv[6]),float(sys.argv[7]),float(sys.argv[8]),float(sys.argv[9]),float(sys.argv[10]),float(sys.argv[11])] params = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] # mutation rate per sequenced portion of genome per generation: for A.millepora, 0.02 mu = float(sys.argv[6]) # generation time, in thousand years: 0.005 (5 years) gtime = float(sys.argv[7]) dd = Misc.make_data_dict(infile) # set Polarized=False below for folded AFS analysis data = Spectrum.from_data_dict(dd, pop_ids, projections, polarized=False) ns = data.sample_sizes np.set_printoptions(precision=3) #------------------- # split into unequal pop sizes with asymmetrical migration def sc3ei(params, ns): # p_misid: proportion of misidentified ancestral states nu1_1, nu2_1, nu1_2, nu2_2, nu1_3, nu2_3, T1, T2, T3, m12_1, m21_1, m12_3, m21_3 = params sts = moments.LinearSystem_1D.steady_state_1D(ns[0] + ns[1]) fs = moments.Spectrum(sts) fs = moments.Manips.split_1D_to_2D(fs, ns[0], ns[1]) fs.integrate([nu1_1, nu2_1], T1, m=np.array([[0, 0], [0, 0]])) fs.integrate([nu1_2, nu2_2], T2, m=np.array([[0, m12_1], [m21_1, 0]]))
#!/usr/bin/env python import moments import numpy as np from numpy import array from moments import Misc,Spectrum import sys infile=sys.argv[1] pop_ids=[sys.argv[2],sys.argv[3]] projections=[int(sys.argv[4]),int(sys.argv[5])] outname=pop_ids[0]+pop_ids[1]+"_sfs" dd = Misc.make_data_dict(infile) data = Spectrum.from_data_dict(dd, pop_ids,projections,polarized=True) Spectrum.to_file(data,outname,precision=4,foldmaskinfo=False)