コード例 #1
0
    print("python3 %s COMMAND study [file] [source] [refPop] [chro]" % (sys.argv[0]))
    print("""COMMAND is
prepareData
iHS
statIHS
XPEHH
statXPEHH

if command is prepareData, source has the phasedset and
                            refPop the reference population
""")
    sys.exit(-1)

command = sys.argv[1]
myKaryo = sys.argv[2]
karyo.loadBuiltIn(myKaryo)

lexec = MEGA.executor
maxChro = 23  # Needs refactor... No hard max


def removeFixed(tmp, final):
    fhap = open("%s.hap" % tmp)
    haplo = fhap.readline().rstrip().split(' ')
    alleles = [set([a]) for a in haplo]
    for l in fhap:
        haplo = l.rstrip().split(' ')
        for i in range(len(haplo)):
            alleles[i].add(haplo[i])
    fhap.close()
コード例 #2
0
ファイル: postSet.py プロジェクト: tiagoantao/mega-analysis
            f = open("%d.uiHS" % (knum,))
            for l in f:
                val = [x for x in l.rstrip().split(" ") if x != ''][5]
                if val.find("inf") == -1 and val.find("nan") == -1:
                    uvals.append(float(val))
            f.close()
            f = open("%d.iHS" % (knum,))
            for l in f:
                val = l.rstrip().split("\t")[2]
                if val.find("inf") == -1 and val.find("nan") == -1:
                    vals.append(float(val))
            f.close()
        pylab.clf()
        pylab.hist(vals, 100)
        pylab.hist(uvals, 100)
        pylab.savefig("uiHS.png")
        #pylab.savefig("uiHS.eps")


def doSet(setDir):
    cwd = os.getcwd()
    os.chdir(setDir)
    if args.operation in ["ALL", "iHS"]:
        doiHS(args.minSNPs, args.windowSize)
    if args.operation in ["ALL", "xpEHH"]:
        doxpEHH(args.windowSize)
    os.chdir(cwd)

karyo.loadBuiltIn(args.karyo)
doSet(MEGA.cacheDB + "/sets/" + args.karyo + "/" + args.hash)