Beispiel #1
0
os.chdir(MEGA.cacheDB + "/sets/" + karyo + '/' + md5)
for fName in os.listdir("."):
    if fName.startswith("xpEHH-%s" % sPop) and fName.endswith(".top"):
        cut = float(fName[7 + len(sPop):-4])
        print("<br><b>Cut:</b>", cut * 100, "%</br>")
        print(web.linkFile(karyo, md5, fName, "Download", False))
        if cut > 0.01:
            continue
        f = open(fName)
        print('<table border="1">')
        print("<tr><td>Chr</td><td>Start</td><td>End</td><td>P</td><td>Annotations</td></tr>")
        for l in f:
            print("<tr><td>")
            print("</td><td>".join(l.rstrip().split("\t")))
            print("</td></tr>")
        print("</table>")
        f.close()
os.chdir(cwd)


print("<h2>Data</h2>")


def outFun(toks):
    #XXX size is hardcoded
    toks[1] = '<a href="/cgi-bin/mega/gtf.py?k=%d&start=%d&end=%d">%s</a>' % (
        int(toks[0]), int(toks[1]) - 100000, int(toks[1]) + 100000, toks[1])
    return toks
web.table("xpEHH.py", cgi, "xpEHH-" + sPop + ".window",
          ["CHR", "pos", "#stats", "Mean"], outFun)
Beispiel #2
0
        f = open(fName)
        print('<table border="1">')
        print("<tr><td>Chr</td><td>Start</td><td>End</td><td>P</td><td>Annotations</td></tr>")
        for l in f:
            toks = l.rstrip().split("\t")
            #XXX size is hardcoded
            toks[1] = '<a href="%s/gtf.py?k=%d&start=%d&end=%d">%s</a>' % (
                MEGA.webRoot,
                int(toks[0]), int(toks[1]), int(toks[1]) + 200000, toks[1])
            print("<tr><td>")
            print("</td><td>".join(toks))
            print("</td></tr>")
        print("</table>")
        f.close()
os.chdir(cwd)

print("<h2>Data</h2>")

os.chdir(MEGA.cacheDB + "/sets/%s/%s" % (karyo, md5))


def outFun(toks):
    #XXX size is hardcoded
    toks[1] = '<a href="%s/gtf.py?k=%d&start=%d&end=%d">%s</a>' % (
        MEGA.webRoot,
        int(toks[0]), int(toks[1]) - 100000, int(toks[1]) + 100000, toks[1])
    return toks
web.table("iHS.py", cgi, "iHS.window", ["CHR", "pos", "#stats", "Cut",
                                        "Mean", "bucket", "P"], outFun)
os.chdir(cwd)
Beispiel #3
0
print("<h1>%s - Comparison (%s) - %s</h1>" % (studyName, study.comparisons.getType(name), name))

print("<h2>Used analysis</h2>")
if study.comparisons.getType(name)=="Overlap":
    for stat, cut, statCase in study.comparisons.getOvComponents(name):
        if stat == "iHS":
            print(web.getRefiHS(study, statCase))

    os.chdir(MEGA.cacheDB + "/studies/"+studyName)
    def outFun(toks):
        toks[1] = '<a href="%s/gtf.py?k=%d&start=%d&end=%d">%s</a>' % (
            MEGA.webRoot,
            int(toks[0]), int(toks[1]), int(toks[2]), toks[1])
        return toks
    web.table("comparison.py", cgi, "cmp.ov.%s" % name,
              ["CHR", "start", "end", "refs", "genes"], outFun)
elif study.comparisons.getType(name)=="Difference":
    for stat, cut, statCase in study.comparisons.getOvComponents(name):
        if stat == "iHS":
            print(web.getRefiHS(study, statCase))

    os.chdir(MEGA.cacheDB + "/studies/"+studyName)
    def outFun(toks):
        toks[1] = '<a href="%s/gtf.py?k=%d&start=%d&end=%d">%s</a>' % (
            MEGA.webRoot,
            int(toks[0]), int(toks[1]), int(toks[2]), toks[1])
        return toks
    web.table("comparison.py", cgi, "cmp.df.%s" % name,
              ["CHR", "start", "end", "genes"], outFun)
elif study.comparisons.getType(name)=="Top":
    popInfos = list(study.comparisons.getTopPopsInfo(name))
Beispiel #4
0
print("<h2>Populations</h2>")
for pop in study.fs.pops[no]:
    print("%s<br>" % pop)

print("<h2>Summary</h2>")
f = open(studyPath + "FST-summary-%d" % no)
header = f.readline()
vals = f.readline()
print("<table border=1><tr><td>")
print("</td><td>".join(header.split("\t")))
print("</td></td><tr><td>")
print("</td><td>".join(vals.split("\t")))
print("</td></td></table>")


print("<h2>Maximum over a window</h2>")
for i in range(24):
    chro = i + 1
    print(web.linkFile(studyName, "Fst-%d-%d.png" % (no, chro), "", True, True))

os.chdir(MEGA.cacheDB + "/studies/" + studyName)


def outFun(toks):
    #XXX size is hardcoded
    toks[1] = '<a href="%s/gtf.py?k=%s&start=%d&end=%d">%s</a>' % (
        MEGA.webRoot,
        toks[0], int(toks[1]) - 100000, int(toks[1]) + 100000, toks[1])
    return toks
web.table("Fstat.py", cgi, "FST-window-%d" % no, ["CHR", "pos", "max FST", "above 0.1"], outFun)