-
-
Save rcallahan/8fc3d3ba4d43155a0bc0 to your computer and use it in GitHub Desktop.
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 setupV1bin(maxmm, binlist, ixlist, mapslice, alleles, qdlist): | |
"""Int -> [((Int,Int),String)] -> [(Int,String)] -> (Int, Int) -> [String] -> [String] -> | |
(Set Int, (Int -> String -> IO ()), IO ())""" | |
countmap = cnibls.emptyCountMap(ixlist,binlist) | |
memodict = {} | |
refdict = {} | |
def mapperClosure(cm, md, rd): | |
def innie(ix, query): | |
loc, allele = cnibls.FastMemoMapperQD(maxmm, md, mapslice, rd, alleles, qdlist, query) | |
if allele == 1: | |
cm[ix][loc].a += 1 | |
elif allele == 2: | |
cm[ix][loc].b += 1 | |
return innie | |
def finishClosure(cm): | |
def innie(): | |
for ix,ixmap in cm.iteritems(): | |
for loc, abcnt in ixmap.iteritems(): | |
print "%d\t%d\t%d\t%d" % (ix, loc, abcnt.a, abcnt,b) | |
return (set(ix for ix, _ in ixlist), mapperClosure(countmap, memodict, refdict), | |
finishClosure(countmap)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment