Skip to content

Instantly share code, notes, and snippets.

View isaacovercast's full-sized avatar

Isaac Overcast isaacovercast

View GitHub Profile
def dadi_to_momi(infile, outfile=None, verbose=False):
if outfile == None:
outfile = infile.split(".sfs")[0] + "_momi.sfs"
dat = open(infile).readlines()
## Get rid of comment lines
dat = [x.strip() for x in dat if not x.startswith("#")]
if not len(dat) == 3:
raise Exception("Malformed dadi sfs {}.\n Must have 3 lines, yours has {}".format(infile, len(dat)))
## Parse the info line into nsamps per pop (list of ints), folding flag, and pop names list (if they are given)
def hill(p=.99, order=0):
""" Obviously doesn't work for H1 """
## p is the frequency of the dominant species
p = p
q = 1-p
abunds = np.array([p*p, p*q, p*q, q*q])
## Normalize abundances (not necessary here I guess)
abunds = abunds/np.sum(abunds)
@isaacovercast
isaacovercast / wat
Created February 3, 2016 19:27
ipyrad conda dependencies
Trashquatch:~ labuser$ conda install -c ipyrad ipyrad
Fetching package metadata: ......
Solving package specifications: ..........................................................
Package plan for installation in environment /Users/labuser/miniconda2:
The following packages will be downloaded:
package | build
---------------------------|-----------------
libpng-1.6.17 | 0 184 KB