Ejemplo n.º 1
0
op, md5, studyName, study = web.getCore(form)
sPop = form["sp"].value
karyo = form["k"].value
#sPopURL= sPop.replace("+","%2B")
sPopURL = sPop.replace("%2B", "+")

xpehhPath = "%s/sets/%s/%s/" % (MEGA.cacheDB, karyo, md5)
ids = sql.getIds(md5)
myStudies = []
for id in ids:
    idStr = id[0]
    if idStr.find("xpEHH"):
        toks = idStr.split("/")
        myStudies.append(toks[1] + "/" + toks[-1])

web.sendPreamble(md5, None, "xpEHH")

os.chdir(xpehhPath)

print('<a href="pop.py?md5=%s">Population page</a>' % (md5,))
print("<h1>xpEHH</h1>")
print(",".join(myStudies))
print("<h2>Bulk Downloads</h2>(support %s)<br>" % sPop)

fNames = os.listdir(".")
print(web.linkFile((karyo, md5), "%s-uxpEHH.zip" % sPopURL, "Download bulk data (unstandardized)",))
print(web.linkFile((karyo, md5), "%s-xpEHH.zip" % sPopURL, "Download bulk data (standardized)",))
print(web.linkFile((karyo, md5), "xpEHH-%s.window" % sPopURL, "Download bulk data (Window)",))

cwd = os.getcwd()
os.chdir(MEGA.cacheDB + "/sets/" + karyo + '/' + md5)
Ejemplo n.º 2
0
#!/usr/bin/env python3
import cgitb
import os
import sys

# sys.stderr = sys.stdout
import configparser

cgitb.enable()
cfg = configparser.ConfigParser()
cfg.read(os.path.expanduser(os.environ.get("MEGACFG", "~/.megacfg")))

paths = cfg.get("System", "pythonInclude").split(":")
for path in paths:
    sys.path.insert(0, os.path.expanduser(path))
import MEGA
from MEGA import web

web.sendPreamble(None, None, "Citations")


print(
    """<h1>Citations</h1>
TBD
"""
)
Ejemplo n.º 3
0
paths=cfg.get("System", "pythonInclude").split(":")
for path in paths:
    sys.path.insert(0, os.path.expanduser(path))


import MEGA
from MEGA import web,sql, study
from MEGA.web import sendFile

form = cgi.FieldStorage()
op, md5, studyName, study = web.getCore(form)
name = form["n"].value

studyPath = "%s/studies/%s/" %(MEGA.cacheDB, studyName)

web.sendPreamble(md5, None, "%s - Comparison - %s" % ( studyName, name))

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
Ejemplo n.º 4
0
cgitb.enable()

cfg = configparser.ConfigParser()
cfg.read(os.path.expanduser(os.environ.get('MEGACFG', '~/.megacfg')))

paths = cfg.get("System", "pythonInclude").split(":")
for path in paths:
    sys.path.insert(0, os.path.expanduser(path))

import MEGA
from MEGA import karyo, web

form = cgi.FieldStorage()
op, md5, studyName, study = web.getCore(form)

web.sendPreamble(md5, studyName, withMaps=True)
study.configStudy()
print("<h1>%s</h1>" % (studyName,))
print(study.desc)
print("<br>")
print(study.summary)

print("<h2>Map</h2>")
web.addMap(study.pops.pops)
print("<h2>Populations</h2>")
cuts = study.ibd.cuts
print('<table border="1">')
print('<tr><td>Population</td><td>#</td>')
for cut in cuts:
    print('<td>', cut, '</td>')
print('</tr>')
Ejemplo n.º 5
0
sys.stderr = sys.stdout
import configparser

cgitb.enable()

cfg = configparser.ConfigParser()
cfg.read(os.path.expanduser(os.environ['MEGACFG']))

paths = cfg.get("System", "pythonInclude").split(":")
for path in paths:
    sys.path.insert(0, os.path.expanduser(path))

from MEGA import web
from MEGA import sql

web.sendPreamble(None, None, "Jobs")

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

jobs = sql.getJobs()
print('<table border="1">')
curr = 0
print("<tr>")
for job in jobs:
    print("<td>%s</td>" % job[0])
    print("<td>%s</td>" % job[1])
    print("<td>%s</td>" % job[2])
    print("<td><pre>%s</pre></td>" % job[3])
print("</tr><tr>")
print("</tr>")
print("</table>")
Ejemplo n.º 6
0
cfg = configparser.ConfigParser()
cfg.read(os.path.expanduser(os.environ.get('MEGACFG', '~/.megacfg')))

paths = cfg.get("System", "pythonInclude").split(":")
for path in paths:
    sys.path.insert(0, os.path.expanduser(path))


import MEGA
from MEGA import web, sql

form = cgi.FieldStorage()
op, md5, studyName, study = web.getCore(form)
karyo = form["k"].value

web.sendPreamble(md5, studyName)

print("""
<table border="0">
<tr>
<td valign="top">
""")
print("<h2>Basic info</h2>")
try:
    f = open("%s/sets/%s/%s/basic" % (MEGA.cacheDB, karyo, md5))
    print("<table border=1><tr><td><b>total</b></td><td>%s</td></tr><tr>" % (
          f.readline(),))
    for l in f:
        print("<tr><td>")
        print("</td><td>".join(l.split("\t")))
        print("</td></tr>")
Ejemplo n.º 7
0
    print("""Content-type: text/plain

""")
    chro = form["chro"].value
    f = gzip.open(MEGA.ensemblDB + "/37/annot-%s.gz" % chro)
    rs2annot = pickle.load(f)
    f.close()
    rss = form["rs"].value.split("\n")
    for rs in rss:
        rs = rs.rstrip()
        annot = list(rs2annot.get(rs, ("", "")))
        print("\t".join([rs] + annot))

    sys.exit(0)

web.sendPreamble(None, None)

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

print("""
<form method="post">
Chromosome:
<select name="chro">
""")
for i in range(22):
    print("<option>%d</option>" % (i + 1))
print("""
</select>
<br>
List of RS<br/>
<textarea name="rs" rows="20" cols="30">
Ejemplo n.º 8
0
import sys
sys.stderr = sys.stdout
import configparser

cgitb.enable()

cfg = configparser.ConfigParser()
cfg.read(os.path.expanduser(os.environ.get('MEGACFG', '~/.megacfg')))

paths=cfg.get("System", "pythonInclude").split(":")
for path in paths:
    sys.path.insert(0, os.path.expanduser(path))
import MEGA
from MEGA import karyo, web

web.sendPreamble(None, None, "Studies")


print("""<h1>Studies</h1>

<table border="1">
""")

for studyName in MEGA.studies:
    study = MEGA.studies[studyName]
    study.configStudy()
    def getHash(popStudy):
        return MEGA.getHash(study.pops.getIndivs(popStudy))
    inURLs = web.getPopsURLs(study.pops.pops, karyo.karyotype,
                             [getHash(x) for x in study.pops.pops])
    print("""
Ejemplo n.º 9
0
sys.stderr = sys.stdout
import configparser

cgitb.enable()

cfg = configparser.ConfigParser()
cfg.read(os.path.expanduser(os.environ.get('MEGACFG', '~/.megacfg')))

paths = cfg.get("System", "pythonInclude").split(":")
for path in paths:
    sys.path.insert(0, os.path.expanduser(path))

import MEGA
from MEGA import web

web.sendPreamble(None, None, "Populations")

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

pops = MEGA.pops
karyos = os.listdir(MEGA.cacheDB + "/sets/")
print('<table border="1">')
curr = 1
print("<tr>")
for pop in pops:
    indivs = MEGA.getIndivs(pop)
    hash = MEGA.getHash(indivs)
    print('<td>')
    print(pop)
    start = False
    for myKaryo in karyos:
Ejemplo n.º 10
0
#!/usr/bin/env python3
import cgi
import cgitb
import os
import sys
sys.stderr = sys.stdout
import configparser

cgitb.enable()

cfg = configparser.ConfigParser()
cfg.read(os.path.expanduser(os.environ['MEGACFG']))

paths = cfg.get("System", "pythonInclude").split(":")
for path in paths:
    sys.path.insert(0, os.path.expanduser(path))
import MEGA
from MEGA import web

web.sendPreamble(None, None, "Data Sources")


print("""<h1>Data Sources</h1>
TBD
""")


Ejemplo n.º 11
0
import MEGA
from MEGA import web, sql

form = cgi.FieldStorage()
op, md5, studyName, study = web.getCore(form)
ids = sql.getIds(md5)
karyo = form["k"].value
myStudies = []
for id in ids:
    idStr = id[0]
    if idStr.find("iHS"):
        toks = idStr.split("/")
        myStudies.append(toks[1] + "/" + toks[-1])

web.sendPreamble(md5, None, "iHS")

print('<a href="pop.py?md5=%s">Population page</a>' % (md5,))
print("<h1>iHS</h1>")
print(",".join(myStudies))
print("<h2>Bulk Downloads</h2>")
print(web.linkFile((karyo, md5), "uiHS.zip", "Download bulk data (unstandardized)",))
print(web.linkFile((karyo, md5), "iHS.zip", "Download bulk data (standardized)",))
print(web.linkFile((karyo, md5), "iHS.window", "Download bulk data (Window)",))

print("<h2>Mean, standard deviation</h2>")
try:

    print(web.linkFile((karyo, md5), "iHSCheck.png", None,
                       False, True, attrs='width="30%"'))
    print(web.linkFile((karyo, md5), "uiHS.png", None, False,
Ejemplo n.º 12
0
import os
import sys
sys.stderr = sys.stdout
import configparser

cgitb.enable()

cfg = configparser.ConfigParser()
cfg.read(os.path.expanduser(os.environ.get('MEGACFG', '~/.megacfg')))
paths = cfg.get("System", "pythonInclude").split(":")
for path in paths:
    sys.path.insert(0, os.path.expanduser(path))
import MEGA
from MEGA import web

web.sendPreamble(None, None, "MEGA browser", withMaps=True)

print("""
<h1>MEGA browser</h1>

<table>
  <tr>
    <td><a href="%s/pops.py">Populations</a>
    <td><a href="%s/studies.py">Studies</a>
    <td><a href="%s/sources.py">Data Sources</a>
  </tr>
  <tr>
    <td><a href="%s/jobs.py">Jobs</a>
    <td><a href="%s/cits.py">Citations</a>
    <td><a href="%s/links.py">Links</a>
  </tr>
Ejemplo n.º 13
0
paths = cfg.get("System", "pythonInclude").split(":")
for path in paths:
    sys.path.insert(0, os.path.expanduser(path))


import MEGA
from MEGA import web

form = cgi.FieldStorage()
op, md5, studyName, study = web.getCore(form)
no = int(form["no"].value)

studyPath = "%s/studies/%s/" % (MEGA.cacheDB, studyName)

web.sendPreamble(md5, None, "F statistics - %s - %d" % (studyName, no))

print("<h1>FST - %s - %d</h1>" % (studyName, no))
print(web.linkFile(studyName, "f%d.zip" % no, "Download bulk data", True))

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>")