This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |