diff options
28 files changed, 114 insertions, 1024 deletions
@@ -6,3 +6,5 @@ web/new_genotypes/HSNIH.json *.cross *webqtlConfig.py +wqflask/secure_server.py + diff --git a/web/images/edit.png b/web/images/edit.png Binary files differnew file mode 100644 index 00000000..dda50521 --- /dev/null +++ b/web/images/edit.png diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index ade2d242..aa37c29e 100755 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -45,7 +45,6 @@ from utility.THCell import THCell from utility.TDCell import TDCell from base.trait import GeneralTrait from base import data_set -from base.templatePage import templatePage from utility import webqtlUtil, helper_functions, corr_result_helpers from dbFunction import webqtlDatabaseFunction import utility.webqtlUtil #this is for parallel computing only. diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py index d734117e..e1df5b24 100755 --- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py +++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py @@ -48,7 +48,6 @@ from utility.THCell import THCell from utility.TDCell import TDCell from base.trait import GeneralTrait from base import data_set -from base.templatePage import templatePage from utility import webqtlUtil, helper_functions, corr_result_helpers from dbFunction import webqtlDatabaseFunction import utility.webqtlUtil #this is for parallel computing only. diff --git a/wqflask/wqflask/dataSharing/SharingBody.py b/wqflask/wqflask/dataSharing/SharingBody.py deleted file mode 100755 index 880161f5..00000000 --- a/wqflask/wqflask/dataSharing/SharingBody.py +++ /dev/null @@ -1,290 +0,0 @@ -# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License -# as published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Affero General Public License for more details. -# -# This program is available from Source Forge: at GeneNetwork Project -# (sourceforge.net/projects/genenetwork/). -# -# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) -# at rwilliams@uthsc.edu and xzhou15@uthsc.edu -# -# -# -# This module is used by GeneNetwork project (www.genenetwork.org) -# -# Created by GeneNetwork Core Team 2010/08/10 -# -# Last updated by GeneNetwork Core Team 2010/10/20 - -sharing_body_string = """ -<TD vAlign=top width="100%" align="left" height=10 bgColor=#eeeeee> - - <p style="font-size:18px;font-family:verdana;color:black"><B> Data Set Download</B></p> - <Form METHOD="get" ACTION="/webqtl/main.py" name="SEARCHFORM"> - - <TABLE width="800" border="0"> - - <!-- SPECIES SELECTION --> - <TR> - <TD align=right height="35" style="font-size:14px;font-family:verdana;color:black" width="16%"> - <B>Species:</B> - </TD> - <TD width="3%"> - </TD> - <TD NOWRAP width="85%" align="left"> - <DIV Id="menu0"> - <Select NAME="species" size=1 id="species" onchange="fillOptions('species');"> - </Select> - </DIV> - </TD> - </TR> - - <!-- GROUP SELECTION --> - <TR> - <TD align="right" height="35" style="font-size:14px;font-family:verdana;color:black"> - <B>Group:</B> - </TD> - <TD> - </TD> - <TD NOWRAP width="85%" align="left"> - <DIV Id="menu1"> - - <Select NAME="cross" size=1 id="cross" onchange="fillOptions('cross');"> - </Select> - <input type="button" class="button" value=" Info " onCLick="javascript:crossinfo();"> - </DIV> - </TD> - </TR> - - <!-- TYPE SELECTION --> - <TR> - <TD align=right height=35 style="font-size:14px;font-family:verdana;color:black"> - <B>Type:</B> - </TD> - <TD> - </TD> - <TD NOWRAP width="85%" align="left"> - <DIV Id="menu2"> - <Select NAME="tissue" size=1 id="tissue" onchange="fillOptions('tissue');"> - - </Select> - </DIV> - </TD> - </TR> - - <!-- DATABASE SELECTION --> - <TR> - <TD align=right height=35 style="font-size:14px;font-family:verdana;color:black"> - <B>Database:</B> - </TD> - <TD> - </TD> - <TD NOWRAP width="85%" align="left"> - <DIV Id="menu3"> - <Select NAME="database" size=1 id="database"> - </Select> - <input type="button" class="button" value=" Info " onCLick="javascript:databaseinfo();"> - </DIV> - </TD> - </TR> - -<!-- SEARCH, MAKE DEFAULT, ADVANCED SEARCH --> - <TR> - <td></td> - <td></td> - <TD ALIGN="left" HEIGHT="40"> - <INPUT TYPE="button" CLASS="button" STYLE="font-size:12px" VALUE=" Download " onCLick="javascript:datasetinfo();"> - </TD> - </TR> - </TABLE> - - <SCRIPT SRC="/javascript/selectDatasetMenu.js"></SCRIPT> - </FORM> - - <p style="font-size:18px;font-family:verdana;color:black"><B> GeneNetwork Accession Number</B></p> - <form method="get" action="/webqtl/main.py" name="f2" target="_blank"> - <INPUT TYPE="hidden" NAME="FormID" VALUE="sharinginfo"> - <TABLE width="800" border="0"> - <tr> - <td align=right height="35" style="font-size:14px;font-family:verdana;color:black" width="16%"><b>GN:</b></td> - <td width=3%></td> - <td><input type="text" name="GN_AccessionId" size="40" /> E.g. 112</td> - </tr> - <tr> - <td></td> - <td></td> - <td HEIGHT="40"> - <input type="Submit" class="button" STYLE="font-size:12px" VALUE=" Submit "> - </td> - </tr> - </table> - </form> - -</td> -""" - -sharinginfo_body_string = """<td> -<a href="/webqtl/main.py?FormID=sharingListDataset">List of DataSets</a><br> -<H1 class="title" id="parent-fieldname-title">%s -<a href="/webqtl/main.py?FormID=sharinginfoedit&GN_AccessionId=%s"><img src="/images/modify.gif" alt="modify this page" border="0" valign="middle"></a> -<span style="color:red;">%s</span> -</H1> -<table border="0" width="100%%"> -<tr> -<td valign="top" width="50%%"> -<TABLE cellSpacing=0 cellPadding=5 width=100%% border=0> - <TR><td><b>GN Accession:</b> GN%s</TD></tr> - <TR><TD><b>GEO Series:</b> %s</TD></TR> - <TR><TD><b>Title:</b> %s</TD></TR> - <TR><TD><b>Organism:</b> <a href=http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=%s>%s</a></TD></tr> - <tr><TD><b>Group:</b> %s</TD></TR> - <TR><TD><b>Tissue:</b> %s</TD></tr> - <tr><TD><b>Dataset Status:</b> %s</TD></tr> - <TR><TD><b>Platforms:</b> %s</TD></TR> - <TR><TD><b>Normalization:</b> %s</TD></TR> - <TR><TD><!--Code below to Show hide Contact information --> - <a href="#" onclick="colapse('answer1')">See Contact Information</a><br> - <span id="answer1" style="display: none; return: false;"> - %s<br> - %s<br> - %s<br> - %s<br> - %s, %s %s %s<br> - Tel. %s<br> - %s<br> - <a href="%s">%s</a> - </span><!--Code above to Show hide Contact information --></TD></TR> -</TABLE> -</td> -<td valign="top" width="50%%"> -<table border="0" width="100%%"> -<tr> - <td bgcolor="#dce4e1"><b>Download datasets and supplementary data files</b></td> -</tr> -<tr> - <td>%s</td> -</tr> -</table> -</td> -</tr> -</table> -<HR> -<p> -<table width="100%%" border="0" cellpadding="5" cellspacing="0"> -<tr><td><span style="font-size:115%%;font-weight:bold;">Summary:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">About the cases used to generate this set of data:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">About the tissue used to generate this set of data:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">About downloading this data set:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">About the array platform:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">About data values and data processing:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">Data source acknowledgment:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">Experiment Type:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">Overall Design:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">Contributor:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">Citation:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">Submission Date:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">Laboratory:</span></td></tr> - <tr><td> %s<br><br></td></tr> -<tr><td><span style="font-size:115%%;font-weight:bold;">Samples:</span></td></tr> - <tr><td> %s<br><br></td></tr> -</table> -</p> -</td> -""" - -sharinginfoedit_body_string = """<td> -<H1 class="title">%s</H1> -<script language="javascript"> -function CheckGNAccesionId(){ - if (document.sharinginfoupdate.GN_AccesionId.value.length == 0){ - alert("Please input GN Accesion Id"); - document.sharinginfoupdate.GN_AccesionId.focus(); - return false; - } else { - return true; - } -} -</script> -<table border="0" CELLSPACING="0" CELLPADDING="8"> -<form name="sharinginfoupdate" method="post" action="/webqtl/main.py?FormID=sharinginfoupdate" onsubmit="return CheckGNAccesionId();"> -<input type="hidden" name="Id" value="%s"> - - <tr><TH COLSPAN=2><h2 class="title">Principal Investigator</h2></TH></tr> - <tr><td align="right" width="100"><b>Contact Name:</b></td><td width="200"><input type='text' name='Contact_Name' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Emails:</b></td><td><input type='text' name='Emails' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Phone:</b></td><td><input type='text' name='Phone' size='90' value='%s'></td></tr> - <tr><td align="right"><b>URL:</b></td><td><input type='text' name='URL' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Organization Name:</b></td><td><input type='text' name='Organization_Name' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Department:</b></td><td><input type='text' name='Department' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Laboratory:</b></td><td><input type='text' name='Laboratory' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Address:</b></td><td><input type='text' name='Street' size='90' value='%s'></td></tr> - <tr><td align="right"><b>City:</b></td><td><input type='text' name='City' size='90' value='%s'></td></tr> - <tr><td align="right"><b>State:</b></td><td><input type='text' name='State' size='90' value='%s'></td></tr> - <tr><td align="right"><b>ZIP:</b></td><td><input type='text' name='ZIP' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Country:</b></td><td><input type='text' name='Country' size='90' value='%s'></td></tr> - - <tr><TH COLSPAN=2><h2 class="title">Summary</h2></TH></tr> - <tr><td align="right"><b>Summary: </b></td><td><TEXTAREA NAME="Summary" cols="77" rows="15">%s</textarea></td></tr> - - <tr><TH COLSPAN=2><h2 class="title">Biology</h2></TH></tr> - <tr><td align="right"><b>Experiment Design:</b></td><td><TEXTAREA NAME="Experiment_Type" cols="77" rows="15">%s</textarea></td></tr> - <tr><td align="right"><b>About the cases used to<br>generate this set of data:</b></td><td><TEXTAREA NAME="About_Cases" cols="77" rows="15">%s</textarea></td></tr> - <tr><td align="right"><b>About the tissue used to<br>generate this set of data:</b></td><td><TEXTAREA NAME="About_Tissue" cols="77" rows="15">%s</textarea></td></tr> - - <tr><TH COLSPAN=2><h2 class="title">Technique</h2></TH></tr> - <tr><td align="right"><b>About downloading this data set:</b></td><td><TEXTAREA NAME="About_Download" cols="77" rows="15">%s</textarea></td></tr> - <tr><td align="right"><b>About the array platform:</b></td><td><TEXTAREA NAME="About_Array_Platform" cols="77" rows="15">%s</textarea></td></tr> - - <tr><TH COLSPAN=2><h2 class="title">Bioinformatics</h2></TH></tr> - <tr><td align="right"><b>About data values and<br>data processing:</b></td><td><TEXTAREA NAME="About_Data_Values_Processing" cols="77" rows="15">%s</textarea></td></tr> - <tr><td align="right"><b>Overall Design:</b></td><td><TEXTAREA NAME="Overall_Design" cols="77" rows="15">%s</textarea></td></tr> - - <tr><TH COLSPAN=2><h2 class="title">Misc</h2></TH></tr> - <tr><td align="right"><b>Contributor:</b></td><td><TEXTAREA NAME="Contributor" cols="77" rows="15">%s</textarea></td></tr> - <tr><td align="right"><b>Citation:</b></td><td><TEXTAREA NAME="Citation" cols="77" rows="5">%s</textarea></td></tr> - <tr><td align="right"><b>Data source acknowledgment:</b></td><td><TEXTAREA NAME="Data_Source_Acknowledge" cols="77" rows="15">%s</textarea></td></tr> - - <tr><TH COLSPAN=2><h2 class="title">Administrator ONLY</h2></TH></tr> - <tr><td align="right"><b>GN Accesion Id:</b></td><td><input type='text' name='GN_AccesionId' size='90' value='%s'></td></tr> - <tr><td align="right"><b>DB Title in GN:</b></td><td><input type='text' name='InfoPageTitle' size='90' value='%s'></td></tr> - <tr><td align="right"><b>GEO Series:</b></td><td><input type='text' name='GEO_Series' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Status:</b></td><td><input type='text' name='Status' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Title:</b></td><td><input type='text' name='Title' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Organism_Id (Taxonomy ID):</b></td><td><input type='text' name='Organism_Id' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Organism:</b></td><td><input type='text' name='Organism' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Submission Date:</b></td><td><input type='text' name='Submission_Date' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Platforms:</b></td><td><input type='text' name='Platforms' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Species:</b></td><td><input type='text' name='Species' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Tissue:</b></td><td><input type='text' name='Tissue' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Normalization:</b></td><td><input type='text' name='Normalization' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Inbred Set:</b></td><td><input type='text' name='InbredSet' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Info Page Name:</b></td><td><input type='text' name='InfoPageName' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Samples:</b></td><td><input type='text' name='Samples' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Authorized Users:</b></td><td><input type='text' name='AuthorizedUsers' size='90' value='%s'></td></tr> - <tr><td align="right"><b>Progress:</b></td><td><input type='text' name='Progress' size='90' value='%s'></td></tr> - - <tr><td> <colspan='2' align="center"><input type="Submit" class="button" style="font-size:12px" value=" Submit "></td></tr> - -</form> -</table> -</td>""" diff --git a/wqflask/wqflask/dataSharing/SharingInfo.py b/wqflask/wqflask/dataSharing/SharingInfo.py deleted file mode 100755 index 41a75222..00000000 --- a/wqflask/wqflask/dataSharing/SharingInfo.py +++ /dev/null @@ -1,146 +0,0 @@ -# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License -# as published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Affero General Public License for more details. -# -# This program is available from Source Forge: at GeneNetwork Project -# (sourceforge.net/projects/genenetwork/). -# -# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) -# at rwilliams@uthsc.edu and xzhou15@uthsc.edu -# -# -# -# This module is used by GeneNetwork project (www.genenetwork.org) -# -# Created by GeneNetwork Core Team 2010/08/10 -# -# Last updated by GeneNetwork Core Team 2010/10/20 - -from __future__ import print_function, division - -from pprint import pformat as pf -from collections import namedtuple - -import requests - -from dbFunction import webqtlDatabaseFunction -import SharingBody - -#import logging -#logging.basicConfig(filename="/tmp/flask_gn_log", level=logging.INFO) -# -#_log = logging.getLogger("search") -#_ch = logging.StreamHandler() -#_log.addHandler(_ch) - - - -######################################### -# Sharing Info -######################################### -class SharingInfo(object): - - def __init__(self, GN_AccessionId, InfoPageName): - print("In SharingInfo") - self.GN_AccessionId = GN_AccessionId - self.InfoPageName = InfoPageName - - def getInfo(self): - cursor = webqtlDatabaseFunction.getCursor() - if (not cursor): - return - - field_names = """Id, GEO_Series, Status, Title, Organism, Experiment_Type, - Summary, Overall_Design, Contributor, Citation, Submission_Date, - Contact_Name, Emails, Phone, URL, Organization_Name, Department, - Laboratory, Street, City, State, ZIP, Country, Platforms, - Samples, Species, Normalization, InbredSet, InfoPageName, - DB_Name, Organism_Id, InfoPageTitle, GN_AccesionId, Tissue, - AuthorizedUsers, About_Cases, About_Tissue, About_Download, - About_Array_Platform, About_Data_Values_Processing, - Data_Source_Acknowledge, Progreso """ - - # We can use string interpolation here cause we own the string - sql = """select %s from InfoFiles where """ % (field_names) - if self.GN_AccessionId: - sql += "GN_AccesionId = %s" - cursor.execute(sql, self.GN_AccessionId) - elif self.InfoPageName: - sql += "InfoPageName = %s" - cursor.execute(sql, self.InfoPageName) - else: - raise Exception('No correct parameter found') - info = cursor.fetchone() - - info = todict(field_names, info) - - # fetch datasets file list - filelist = [] - if info["GN_AccesionId"]: - url = "http://atlas.uthsc.edu/scandatasets.php?GN_AccesionId=%s" % ( - info["GN_AccesionId"]) - try: - response = requests.get(url) - except Exception as why: - log.exception("Problem conneting to:", url) - if response: - data = response.text - filelist = data.split() - - return info, filelist - - - def getBody(self, infoupdate=""): - info, filelist = self.getInfo() - if filelist: - htmlfilelist = '<ul style="line-height:160%;">\n' - for i in range(len(filelist)): - if i%2==0: - filename = filelist[i] - filesize = filelist[i+1] - htmlfilelist += "<li>" - htmlfilelist += '<a href="ftp://atlas.uthsc.edu/users/shared/Genenetwork/GN%s/%s">%s</a>' % (self.GN_AccessionId, filename, filename) - htmlfilelist += ' ' - #r=re.compile(r'(?<=\d)(?=(\d\d\d)+(?!\d))') - #htmlfilelist += '[%s B]' % r.sub(r',',filesize) - if 12 < len(filesize): - filesize=filesize[0:-12] - filesize += ' T' - elif 9 < len(filesize): - filesize=filesize[0:-9] - filesize += ' G' - elif 6 < len(filesize): - filesize=filesize[0:-6] - filesize += ' M' - elif 3 < len(filesize): - filesize=filesize[0:-3] - filesize += ' K' - htmlfilelist += '[%sB]' % filesize - htmlfilelist += "</li>\n" - htmlfilelist += "</ul>" - else: - htmlfilelist = "Data sets are not available or are not public yet." - - return info, htmlfilelist - #return SharingBody.sharinginfo_body_string % (info[31], info[32], infoupdate, info[32], info[1], info[3], info[30], info[4], info[27], info[33], info[2], info[23], info[26], info[11], info[15], info[16], info[18], info[19], info[20], info[21], info[22], info[13], info[12], info[14], info[14], htmlfilelist, info[6], info[35], info[36], info[37], info[38], info[39], info[40], info[5], info[7], info[8], info[9], info[10], info[17], info[24]) - - -def todict(fields, values): - """Converts sql results into a user friendly dictionary""" - new_dict = {} - fields = fields.split(",") - for counter, field in enumerate(fields): - field = field.strip() - value = values[counter] - if isinstance(value, str): - value = unicode(value, "utf-8") - new_dict[field] = value - return new_dict diff --git a/wqflask/wqflask/dataSharing/SharingInfoAddPage.py b/wqflask/wqflask/dataSharing/SharingInfoAddPage.py deleted file mode 100755 index 452fb474..00000000 --- a/wqflask/wqflask/dataSharing/SharingInfoAddPage.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License -# as published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Affero General Public License for more details. -# -# This program is available from Source Forge: at GeneNetwork Project -# (sourceforge.net/projects/genenetwork/). -# -# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) -# at rwilliams@uthsc.edu and xzhou15@uthsc.edu -# -# -# -# This module is used by GeneNetwork project (www.genenetwork.org) -# -# Created by GeneNetwork Core Team 2010/08/10 -# -# Last updated by GeneNetwork Core Team 2010/10/20 - -from base.templatePage import templatePage -from base import webqtlConfig -import SharingBody -import SharingInfo - - -######################################### -# Sharing Info Edit Page -######################################### -class SharingInfoAddPage(templatePage): - - def __init__(self, fd=None): - templatePage.__init__(self, fd) - if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['admin']: - pass - else: - heading = "Adding Info" - detail = ["You don't have the permission to add new dataset"] - self.error(heading=heading,detail=detail,error="Error") - return - self.dict['body'] = SharingBody.sharinginfoedit_body_string % ("Add new dataset", "-1", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "") diff --git a/wqflask/wqflask/dataSharing/SharingInfoDeletePage.py b/wqflask/wqflask/dataSharing/SharingInfoDeletePage.py deleted file mode 100755 index a9c785c6..00000000 --- a/wqflask/wqflask/dataSharing/SharingInfoDeletePage.py +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License -# as published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Affero General Public License for more details. -# -# This program is available from Source Forge: at GeneNetwork Project -# (sourceforge.net/projects/genenetwork/). -# -# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) -# at rwilliams@uthsc.edu and xzhou15@uthsc.edu -# -# -# -# This module is used by GeneNetwork project (www.genenetwork.org) -# -# Created by GeneNetwork Core Team 2010/08/10 -# -# Last updated by GeneNetwork Core Team 2010/10/20 - -from base.templatePage import templatePage -from base import webqtlConfig -from dbFunction import webqtlDatabaseFunction -import SharingBody -import SharingInfo - - -######################################### -# Sharing Info Delete Page -######################################### -class SharingInfoDeletePage(templatePage): - - def __init__(self, fd=None): - templatePage.__init__(self, fd) - if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['admin']: - pass - else: - heading = "Deleting Info" - detail = ["You don't have the permission to delete this dataset"] - self.error(heading=heading,detail=detail,error="Error") - return - cursor = webqtlDatabaseFunction.getCursor() - if (not cursor): - return - GN_AccessionId = fd.formdata.getvalue('GN_AccessionId') - sql = "delete from InfoFiles where GN_AccesionId=%s" - cursor.execute(sql, GN_AccessionId) - re = cursor.fetchone() - self.dict['body'] = "Delete dataset info record (GN_AccesionId=%s) successfully." % GN_AccessionId diff --git a/wqflask/wqflask/dataSharing/SharingInfoEditPage.py b/wqflask/wqflask/dataSharing/SharingInfoEditPage.py deleted file mode 100755 index c5f4ed22..00000000 --- a/wqflask/wqflask/dataSharing/SharingInfoEditPage.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License -# as published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Affero General Public License for more details. -# -# This program is available from Source Forge: at GeneNetwork Project -# (sourceforge.net/projects/genenetwork/). -# -# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) -# at rwilliams@uthsc.edu and xzhou15@uthsc.edu -# -# -# -# This module is used by GeneNetwork project (www.genenetwork.org) -# -# Created by GeneNetwork Core Team 2010/08/10 -# -# Last updated by GeneNetwork Core Team 2010/10/20 - -from base.templatePage import templatePage -from base import webqtlConfig -import SharingBody -import SharingInfo - - -######################################### -# Sharing Info Edit Page -######################################### -class SharingInfoEditPage(templatePage): - - def __init__(self, fd=None): - templatePage.__init__(self, fd) - if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['admin']: - pass - else: - heading = "Editing Info" - detail = ["You don't have the permission to edit this dataset"] - self.error(heading=heading,detail=detail,error="Error") - return - GN_AccessionId = fd.formdata.getvalue('GN_AccessionId') - InfoPageName = fd.formdata.getvalue('InfoPageName') - sharingInfoObject = SharingInfo.SharingInfo(GN_AccessionId, InfoPageName) - info, filelist = sharingInfoObject.getInfo() - self.dict['body'] = SharingBody.sharinginfoedit_body_string % (info[31], info[0], info[11], info[12], info[13], info[14], info[15], info[16], info[17], info[18], info[19], info[20], info[21], info[22], info[6], info[5], info[35], info[36], info[37], info[38], info[39], info[7], info[8], info[9], info[40], info[32], info[31], info[1], info[2], info[3], info[30], info[4], info[10], info[23], info[25], info[33], info[26], info[27], info[28], info[24], info[34], info[41]) diff --git a/wqflask/wqflask/dataSharing/SharingInfoPage.py b/wqflask/wqflask/dataSharing/SharingInfoPage.py deleted file mode 100755 index 7ad44440..00000000 --- a/wqflask/wqflask/dataSharing/SharingInfoPage.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License -# as published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Affero General Public License for more details. -# -# This program is available from Source Forge: at GeneNetwork Project -# (sourceforge.net/projects/genenetwork/). -# -# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) -# at rwilliams@uthsc.edu and xzhou15@uthsc.edu -# -# -# -# This module is used by GeneNetwork project (www.genenetwork.org) -# -# Created by GeneNetwork Core Team 2010/08/10 -# -# Last updated by GeneNetwork Core Team 2010/10/20 - -from __future__ import print_function, division - -from pprint import pformat as pf - -import urlparse - -import flask - -from base.templatePage import templatePage -from base import webqtlConfig -from dbFunction import webqtlDatabaseFunction -import SharingBody -import SharingInfo - - -######################################### -# Sharing Info Page -######################################### -class SharingInfoPage(templatePage): - - def __init__(self, fd): - templatePage.__init__(self, fd) - self.redirect_url = None # Set if you want a redirect - print("fd is:", pf(fd.__dict__)) - # Todo: Need a [0] in line below????d - GN_AccessionId = fd.get('GN_AccessionId') # Used under search datasharing - InfoPageName = fd.get('database') # Might need to add a [0] - cursor = webqtlDatabaseFunction.getCursor() - if InfoPageName and not GN_AccessionId: - sql = "select GN_AccesionId from InfoFiles where InfoPageName = %s" - cursor.execute(sql, InfoPageName) - GN_AccessionId = cursor.fetchone() - self.redirect_url = urlparse.urljoin(webqtlConfig.ROOT_URL, "/data_sharing?GN_AccessionId=%s" % GN_AccessionId) - #self.redirect_url = flask.url_for('data_sharing', GN_AccessionId=GN_AccessionId[0]) - print("set self.redirect_url") - #print("before redirect") - #return flask.redirect(url) - #print("after redirect") - else: - CauseError diff --git a/wqflask/wqflask/dataSharing/SharingInfoUpdatePage.py b/wqflask/wqflask/dataSharing/SharingInfoUpdatePage.py deleted file mode 100755 index 181f2eed..00000000 --- a/wqflask/wqflask/dataSharing/SharingInfoUpdatePage.py +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License -# as published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Affero General Public License for more details. -# -# This program is available from Source Forge: at GeneNetwork Project -# (sourceforge.net/projects/genenetwork/). -# -# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) -# at rwilliams@uthsc.edu and xzhou15@uthsc.edu -# -# -# -# This module is used by GeneNetwork project (www.genenetwork.org) -# -# Created by GeneNetwork Core Team 2010/08/10 -# -# Last updated by GeneNetwork Core Team 2010/10/20 - -import MySQLdb - -from base.templatePage import templatePage -from base import webqtlConfig -from dbFunction import webqtlDatabaseFunction -import SharingBody -import SharingInfo - -######################################### -# Sharing Info Update Page -######################################### -class SharingInfoUpdatePage(templatePage): - - def __init__(self, fd=None): - templatePage.__init__(self, fd) - if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['admin']: - pass - else: - heading = "Editing Info" - detail = ["You don't have the permission to modify this file"] - self.error(heading=heading,detail=detail,error="Error") - return - cursor = webqtlDatabaseFunction.getCursor() - if (not cursor): - return - Id=fd.formdata.getvalue('Id') - GN_AccesionId=fd.formdata.getvalue('GN_AccesionId') - GEO_Series=fd.formdata.getvalue('GEO_Series') - Status=fd.formdata.getvalue('Status') - Title=fd.formdata.getvalue('Title') - Organism_Id=fd.formdata.getvalue('Organism_Id') - Organism=fd.formdata.getvalue('Organism') - Experiment_Type =fd.formdata.getvalue('Experiment_Type') - Summary=fd.formdata.getvalue('Summary') - Overall_Design=fd.formdata.getvalue('Overall_Design') - Contributor=fd.formdata.getvalue('Contributor') - Citation=fd.formdata.getvalue('Citation') - Submission_Date=fd.formdata.getvalue('Submission_Date') - Contact_Name=fd.formdata.getvalue('Contact_Name') - Emails=fd.formdata.getvalue('Emails') - Phone=fd.formdata.getvalue('Phone') - URL=fd.formdata.getvalue('URL') - Organization_Name=fd.formdata.getvalue('Organization_Name') - Department=fd.formdata.getvalue('Department') - Laboratory=fd.formdata.getvalue('Laboratory') - Street=fd.formdata.getvalue('Street') - City=fd.formdata.getvalue('City') - State=fd.formdata.getvalue('State') - ZIP=fd.formdata.getvalue('ZIP') - Country=fd.formdata.getvalue('Country') - Platforms=fd.formdata.getvalue('Platforms') - Samples=fd.formdata.getvalue('Samples') - Species=fd.formdata.getvalue('Species') - Tissue=fd.formdata.getvalue('Tissue') - Normalization=fd.formdata.getvalue('Normalization') - InbredSet=fd.formdata.getvalue('InbredSet') - InfoPageName=fd.formdata.getvalue('InfoPageName') - InfoPageTitle=fd.formdata.getvalue('InfoPageTitle') - About_Cases=fd.formdata.getvalue('About_Cases') - About_Tissue=fd.formdata.getvalue('About_Tissue') - About_Download=fd.formdata.getvalue('About_Download') - About_Array_Platform=fd.formdata.getvalue('About_Array_Platform') - About_Data_Values_Processing=fd.formdata.getvalue('About_Data_Values_Processing') - Data_Source_Acknowledge=fd.formdata.getvalue('Data_Source_Acknowledge') - AuthorizedUsers=fd.formdata.getvalue('AuthorizedUsers') - Progress=fd.formdata.getvalue('Progress') - if Id=='-1': - sharingInfoObject = SharingInfo.SharingInfo(GN_AccesionId, InfoPageName) - info, filelist = sharingInfoObject.getInfo() - if info: - heading = "Editing Info" - detail = ["The new dataset info record is duplicate."] - self.error(heading=heading, detail=detail, error="Error") - return - sql = """INSERT INTO InfoFiles SET GN_AccesionId=%s, GEO_Series=%s, Status=%s, Title=%s, Organism_Id=%s, Organism=%s, Experiment_Type=%s, Summary=%s, Overall_Design=%s, Contributor=%s, Citation=%s, Submission_Date=%s, Contact_Name=%s, Emails=%s, Phone=%s, URL=%s, Organization_Name=%s, Department=%s, Laboratory=%s, Street=%s, City=%s, State=%s, ZIP=%s, Country=%s, Platforms=%s, Samples=%s, Species=%s, Tissue=%s, Normalization=%s, InbredSet=%s, InfoPageName=%s, InfoPageTitle=%s, About_Cases=%s, About_Tissue=%s, About_Download=%s, About_Array_Platform=%s, About_Data_Values_Processing=%s, Data_Source_Acknowledge=%s, AuthorizedUsers=%s, Progreso=%s""" - cursor.execute(sql, tuple([GN_AccesionId, GEO_Series, Status, Title, Organism_Id, Organism, Experiment_Type, Summary, Overall_Design, Contributor, Citation, Submission_Date, Contact_Name, Emails, Phone, URL, Organization_Name, Department, Laboratory, Street, City, State, ZIP, Country, Platforms, Samples, Species, Tissue, Normalization, InbredSet, InfoPageName, InfoPageTitle, About_Cases, About_Tissue, About_Download, About_Array_Platform, About_Data_Values_Processing, Data_Source_Acknowledge, AuthorizedUsers, Progress])) - infoupdate="This record has been succesfully added." - else: - sql = """UPDATE InfoFiles SET GN_AccesionId=%s, GEO_Series=%s, Status=%s, Title=%s, Organism_Id=%s, Organism=%s, Experiment_Type=%s, Summary=%s, Overall_Design=%s, Contributor=%s, Citation=%s, Submission_Date=%s, Contact_Name=%s, Emails=%s, Phone=%s, URL=%s, Organization_Name=%s, Department=%s, Laboratory=%s, Street=%s, City=%s, State=%s, ZIP=%s, Country=%s, Platforms=%s, Samples=%s, Species=%s, Tissue=%s, Normalization=%s, InbredSet=%s, InfoPageName=%s, InfoPageTitle=%s, About_Cases=%s, About_Tissue=%s, About_Download=%s, About_Array_Platform=%s, About_Data_Values_Processing=%s, Data_Source_Acknowledge=%s, AuthorizedUsers=%s, Progreso=%s WHERE Id=%s""" - cursor.execute(sql, tuple([GN_AccesionId, GEO_Series, Status, Title, Organism_Id, Organism, Experiment_Type, Summary, Overall_Design, Contributor, Citation, Submission_Date, Contact_Name, Emails, Phone, URL, Organization_Name, Department, Laboratory, Street, City, State, ZIP, Country, Platforms, Samples, Species, Tissue, Normalization, InbredSet, InfoPageName, InfoPageTitle, About_Cases, About_Tissue, About_Download, About_Array_Platform, About_Data_Values_Processing, Data_Source_Acknowledge, AuthorizedUsers, Progress, Id])) - infoupdate="This record has been succesfully updated." - sharingInfoObject = SharingInfo.SharingInfo(GN_AccesionId, InfoPageName) - self.dict['body'] = sharingInfoObject.getBody(infoupdate=infoupdate) diff --git a/wqflask/wqflask/dataSharing/SharingListDataSetPage.py b/wqflask/wqflask/dataSharing/SharingListDataSetPage.py deleted file mode 100755 index 8685ac65..00000000 --- a/wqflask/wqflask/dataSharing/SharingListDataSetPage.py +++ /dev/null @@ -1,99 +0,0 @@ -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License -# as published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Affero General Public License for more details. -# -# This program is available from Source Forge: at GeneNetwork Project -# (sourceforge.net/projects/genenetwork/). -# -# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) -# at rwilliams@uthsc.edu and xzhou15@uthsc.edu -# -# -# -# This module is used by GeneNetwork project (www.genenetwork.org) -# -# Created by GeneNetwork Core Team 2010/08/10 -# -# Last updated by GeneNetwork Core Team 2010/10/20 - -from htmlgen import HTMLgen2 as HT -from base import webqtlConfig - -from base.templatePage import templatePage - - -######################################### -# Sharing List DataSet Page -######################################### -class SharingListDataSetPage(templatePage): - - def __init__(self, fd=None): - templatePage.__init__(self, fd) - - if not self.openMysql(): - return - - if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['admin']: - pass - else: - heading = "Editing Info" - detail = ["You don't have the permission to list the datasets"] - self.error(heading=heading,detail=detail,error="Error") - return - - - TD_LR = HT.TD(height=200,width="100%",bgColor='#eeeeee') - - query = """select GN_AccesionId, InfoPageTitle, Progreso from InfoFiles order by GN_AccesionId""" - self.cursor.execute(query) - result = self.cursor.fetchall() - - heading = HT.Paragraph('Dataset Table', Class="title") - - newrecord = HT.Href(text="New Record", url="/webqtl/main.py?FormID=sharinginfoadd") - - info = "Click the accession id to view the dataset info. Click the dataset name to edit the dataset info." - - datasetTable = HT.TableLite(border=0, cellpadding=0, cellspacing=0, Class="collap", width="100%") - - tableHeaderRow = HT.TR() - tableHeaderRow.append(HT.TD("Accession Id", Class='fs14 fwb ffl b1 cw cbrb', align="center")) - tableHeaderRow.append(HT.TD("Dataset name", Class='fs14 fwb ffl b1 cw cbrb', align="center")) - tableHeaderRow.append(HT.TD("Progress", Class='fs14 fwb ffl b1 cw cbrb', align="center")) - tableHeaderRow.append(HT.TD("Operation", Class='fs14 fwb ffl b1 cw cbrb', align="center")) - datasetTable.append(tableHeaderRow) - - for one_row in result: - Accession_Id, InfoPage_title, Progress = one_row - datasetRow = HT.TR() - datasetRow.append(HT.TD(HT.Href(text="GN%s" % Accession_Id, url="/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=%s" % Accession_Id, Class='fs12 fwn'), Class="fs12 fwn b1 c222")) - datasetRow.append(HT.TD(HT.Href(text="%s" % InfoPage_title, url="/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=%s" % Accession_Id, Class='fs12 fwn'), Class="fs12 fwn b1 c222")) - datasetRow.append(HT.TD("%s" % Progress, Class='fs12 fwn ffl b1 c222')) - operation_edit = HT.Href(text="Edit", url="/webqtl/main.py?FormID=sharinginfoedit&GN_AccessionId=%s" % Accession_Id) - operation_delete = HT.Href(text="Delete", onClick="deleteRecord(%s); return false;" % Accession_Id) - operation = HT.TD(Class="fs12 fwn b1 c222", align="center") - operation.append(operation_edit) - operation.append(" ") - operation.append(operation_delete) - datasetRow.append(operation) - datasetTable.append(datasetRow) - - TD_LR.append(heading, HT.P(), newrecord, HT.P(), info, HT.P(), datasetTable) - - js1 = """ <script language="javascript" type="text/javascript"> - function deleteRecord(id){ - question = confirm("Are you sure you want to delete the dataset info record (Accession Id="+id+")?") - if (question != "0"){ - window.open("/webqtl/main.py?FormID=sharinginfodelete&GN_AccessionId="+id, "_self"); - } - } - </script>""" - self.dict['js1'] = js1 - self.dict['body'] = str(TD_LR) diff --git a/wqflask/wqflask/dataSharing/SharingPage.py b/wqflask/wqflask/dataSharing/SharingPage.py deleted file mode 100755 index b244a6bd..00000000 --- a/wqflask/wqflask/dataSharing/SharingPage.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License -# as published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Affero General Public License for more details. -# -# This program is available from Source Forge: at GeneNetwork Project -# (sourceforge.net/projects/genenetwork/). -# -# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) -# at rwilliams@uthsc.edu and xzhou15@uthsc.edu -# -# -# -# This module is used by GeneNetwork project (www.genenetwork.org) -# -# Created by GeneNetwork Core Team 2010/08/10 -# -# Last updated by GeneNetwork Core Team 2010/10/20 - -from base.templatePage import templatePage -import SharingBody - -######################################### -# SharingPage -######################################### - -class SharingPage(templatePage): - - def __init__(self, fd): - templatePage.__init__(self, fd) - self.dict['title'] = 'GeneNetwork Data Sharing Zone' - self.dict['body'] = SharingBody.sharing_body_string - self.dict['js2'] = 'onload="javascript:initialDatasetSelection();"' diff --git a/wqflask/wqflask/dataSharing/__init__.py b/wqflask/wqflask/dataSharing/__init__.py deleted file mode 100755 index e69de29b..00000000 --- a/wqflask/wqflask/dataSharing/__init__.py +++ /dev/null diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py index 65255987..07b0b81a 100755 --- a/wqflask/wqflask/docs.py +++ b/wqflask/wqflask/docs.py @@ -11,5 +11,6 @@ class Docs(object): WHERE Docs.entry LIKE '%s' """ result = g.db.execute(sql % (entry)).fetchone() + self.entry = entry self.title = result[0] self.content = result[1] diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 3fb9915b..7708356b 100755 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -701,7 +701,7 @@ class MarkerRegression(object): no_val_samples = self.identify_empty_samples() trimmed_genotype_data = self.trim_genotypes(genotype_data, no_val_samples) - genotype_matrix = np.array(trimmed_genotype_data).T + genotype_matrix = np.array(genotype_data).T #print("pheno_vector: ", pf(pheno_vector)) #print("genotype_matrix: ", pf(genotype_matrix)) diff --git a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py index 6f03eaf7..b2067b27 100644 --- a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py +++ b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py @@ -43,13 +43,14 @@ Redis = Redis() import sys sys.path.append("/home/zas1024/gene/wqflask/") -sys.path.append("/home/danny/GeneNetwork/wqflask/wqflask/my_pylmm/pyLMM/") -print("sys.path2:", sys.path) has_gn2=True from utility.benchmark import Bench from utility import temp_data + +sys.path.append("/home/zas1024/gene/wqflask/wqflask/my_pylmm/pyLMM/") + from kinship import kinship, kinship_full, kvakve import genotype import phenotype diff --git a/wqflask/wqflask/my_pylmm/pyLMM/tsvreader.py b/wqflask/wqflask/my_pylmm/pyLMM/tsvreader.py index 27daf43f..66b34ee2 100644 --- a/wqflask/wqflask/my_pylmm/pyLMM/tsvreader.py +++ b/wqflask/wqflask/my_pylmm/pyLMM/tsvreader.py @@ -56,7 +56,8 @@ def geno(fn): print fn with open(fn,'r') as tsvin: - assert(tsvin.readline().strip() == "# Genotype format version 1.0") + line = tsvin.readline().strip() + assert line == "# Genotype format version 1.0", line tsvin.readline() tsvin.readline() tsvin.readline() diff --git a/wqflask/wqflask/news.py b/wqflask/wqflask/news.py new file mode 100755 index 00000000..62dc1bbb --- /dev/null +++ b/wqflask/wqflask/news.py @@ -0,0 +1,16 @@ +from __future__ import absolute_import, print_function, division +import sys +reload(sys) +sys.setdefaultencoding('utf8') +from flask import g + +class News(object): + + def __init__(self): + sql = """ + SELECT News.id, News.date, News.details + FROM News + order by News.date desc + """ + self.title = "GeneNetwork News" + self.newslist = g.db.execute(sql).fetchall() diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 11fd2644..929f5abb 100755 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -19,7 +19,6 @@ from utility import webqtlUtil, Plot, Bunch, helper_functions from base.trait import GeneralTrait from base import data_set from dbFunction import webqtlDatabaseFunction -from base.templatePage import templatePage from basicStatistics import BasicStatisticsFunctions from pprint import pformat as pf diff --git a/wqflask/wqflask/static/packages/bootstrap/css/docs.css b/wqflask/wqflask/static/packages/bootstrap/css/docs.css index b95c44ed..2d6a713c 100755 --- a/wqflask/wqflask/static/packages/bootstrap/css/docs.css +++ b/wqflask/wqflask/static/packages/bootstrap/css/docs.css @@ -25,25 +25,28 @@ h3 code { /* Tweak navbar brand link to be super sleek -------------------------------------------------- */ - +/* body > .navbar { font-size: 12px; font-weight: bold; } +*/ /* Change the docs' brand */ -body > .navbar .brand { - padding-right: 0; - padding-left: 0; + +body > .navbar .navbar-brand { + padding-right: 20px; + padding-left: 20px; margin-left: 20px; float: left; font-weight: bold; - color: #336699; + color: #ffffff; text-shadow: 0 1px 0 rgba(255,255,255,.1), 0 0 30px rgba(255,255,255,.125); -webkit-transition: all .2s linear; -moz-transition: all .2s linear; transition: all .2s linear; } + body > .navbar .brand:hover { text-decoration: none; text-shadow: 0 1px 0 rgba(255,255,255,.1), 0 0 30px rgba(255,255,255,.4); diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 3d4e6d28..462a59a2 100755 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -74,6 +74,13 @@ <a href="/">Search</a> </li> <li class=""> + <a href="/collections/list">Collections + {% if g.user_session.user_ob %} + <span class="badge badge-info">{{ g.user_session.user_ob.display_num_collections() }}</span> + {% endif %} + </a> + </li> + <li class=""> <a href="/help">Help</a> </li> <li class=""> @@ -92,14 +99,6 @@ <a href="/environments">Environments</a> </li> <li class=""> - <a href="/collections/list">Collections - {% if g.user_session.user_ob %} - <span class="badge badge-info">{{ g.user_session.user_ob.display_num_collections() }}</span> - {% endif %} - </a> - </li> - - <li class=""> {% if g.user_session.logged_in %} <a id="login_out" title="Signed in as {{ g.user_session.user_ob.name_and_org }}." href="/n/logout">Sign out</a> {% else %} diff --git a/wqflask/wqflask/templates/testhtmleditor.html b/wqflask/wqflask/templates/docedit.html index 1d258d0e..1a9e8ca8 100755 --- a/wqflask/wqflask/templates/testhtmleditor.html +++ b/wqflask/wqflask/templates/docedit.html @@ -1,18 +1,18 @@ {% extends "base.html" %} -{% block title %}Test html editor{% endblock %} +{% block title %}Edit: {{title}}{% endblock %} {% block content %} <div class="container"> - <h2>Test HTML Editor</h2> + <h3>Edit: {{title}}</h3> <form> <textarea name="ckcontent" id="ckcontent"> - Test HTML + {{content|safe}} </textarea> <script type="text/javascript" src="/static/packages/ckeditor/ckeditor.js"></script> <script type="text/javascript"> CKEDITOR.replace('ckcontent', { - height: '500px', + height: '650px', }); </script> </form> diff --git a/wqflask/wqflask/templates/docs.html b/wqflask/wqflask/templates/docs.html index cbaf1e70..08f95721 100755 --- a/wqflask/wqflask/templates/docs.html +++ b/wqflask/wqflask/templates/docs.html @@ -5,6 +5,11 @@ {% block content %} <div class="container"> <h3>{{title}}</h3> + <div style="text-align: right;"> + <a href="docedit?entry={{entry}}"> + <img style="width: 25px;" src="/static/images/edit.png"> + </a> + </div> {{content|safe}} </div> {% endblock %} diff --git a/wqflask/wqflask/templates/index_page.html b/wqflask/wqflask/templates/index_page.html index 538a6799..5e0a92e3 100755 --- a/wqflask/wqflask/templates/index_page.html +++ b/wqflask/wqflask/templates/index_page.html @@ -29,19 +29,19 @@ <div class="form-group"> <label for="species" class="col-xs-1 control-label" style="width: 65px !important;">Species:</label> - <div class="col-xs-10 controls"> + <div class="col-xs-10 controls input-append" style="padding-right: 0px;"> <div class="col-xs-8"> <select name="species" id="species" class="form-control selectpicker span3" style="width: 280px !important;"></select> </div> <div class="col-xs-4"> - <input id="make_default" class="btn btn-default form-control" value="Make Default"> + <input id="make_default" class="btn btn-primary form-control" value="Make Default"> </div> </div> </div> <div class="form-group"> <label for="group" class="col-xs-1 control-label" style="width: 65px !important;">Group:</label> - <div class="col-xs-4 controls input-append"> + <div class="col-xs-10 controls input-append"> <div class="col-xs-8"> <select name="group" id="group" class="form-control selectpicker span3" style="width: 280px !important;"></select> <i class="icon-question-sign"></i> @@ -51,7 +51,7 @@ <div class="form-group"> <label for="tissue" class="col-xs-1 control-label" style="width: 65px !important;">Type:</label> - <div class="col-xs-4 controls"> + <div class="col-xs-10 controls"> <div class="col-xs-8"> <select name="type" id="type" class="form-control selectpicker span3" style="width: 280px !important;"></select> </div> @@ -60,7 +60,7 @@ <div class="form-group"> <label for="dataset" class="col-xs-1 control-label" style="width: 65px !important;">Dataset:</label> - <div class="col-xs-4 controls input-append"> + <div class="col-xs-10 controls input-append"> <div class="col-xs-8"> <select name="dataset" id="dataset" class="form-control selectpicker span5" style="width: 450px !important;"></select> <i class="icon-question-sign"></i> @@ -86,15 +86,15 @@ <!-- GET ANY HELP --> <div class="form-group"> - <label for="tfor" class="col-xs-1 control-label" style="width: 65px !important;"></label> + <label for="btsearch" class="col-xs-1 control-label" style="width: 65px !important;"></label> <div class="col-xs-10 controls"> - <div class="col-xs-10"> - <p>Enter terms, genes, ID numbers in the - <b>Search</b> field<br> - Use <b>*</b> or <b>?</b> wildcards (Cyp*a?, - synap*)<br> - Use <b>quotes</b> for terms such as <i>"tyrosine - kinase"</i></p> + <div class="col-xs-2 controls" style="width: 100px !important;"> + <input id="btsearch" type="submit" class="btn btn-primary form-control" value="Search"> + </div> + <div class="col-xs-9 controls"> + Enter terms, genes, ID numbers in the <b>Search</b> field + Use <b>*</b> or <b>?</b> wildcards (Cyp*a?, synap*) + Use <b>quotes</b> for terms such as <i>"tyrosine kinase"</i> </div> </div> </div> @@ -103,10 +103,6 @@ <!-- SEARCH, MAKE DEFAULT --> <div class="form-group"> - - <div class="col-xs-3 controls" style="width: 100px !important;"> - <input id="btsearch" type="submit" class="btn btn-primary form-control" value="Search"> - </div> </div> <input type="hidden" name="FormID" value="searchResult" class="form-control"> @@ -159,7 +155,7 @@ </ul> </section> </div> - <div style="padding-left:120px" class="col-xs-6" style="width: 600px !important;"> + <div style="padding-left:120px" class="col-xs-4" style="width: 600px !important;"> <!-- <section id="tour-info"> <div class="page-header"> @@ -207,32 +203,15 @@ <li>GeneNetwork Source Code at <a href="https://github.com/genenetwork/genenetwork" target="_blank">GitHub</a></li> </ul> - <h3>Mirror and development sites</h3> - <ul> - <li><a href="http://www.genenetwork.org/" target="_blank"> - Main GN site</a> at UTHSC</li> - - <li><a href="http://www.genenetwork.waimr.uwa.edu.au/" target="_blank"> - Australia</a> at the UWA</li> + <h3>GN1 Mirror and development sites</h3> - <li><a href="http://gn.genetics.ucla.edu/" target="_blank"> - California</a> at UCLA</li> - - <li><a href="http://genenetwork.helmholtz-hzi.de/" target="_blank"> - Germany</a> at the HZI</li> - - <li><a href="https://genenetwork.hubrecht.eu/" target="_blank"> - Netherlands</a> at the Hubrecht - (development)</li> - - <li><a href="http://genenetwork.memphis.edu/" target="_blank"> - Memphis</a> at the U of M</li> - - <li><a href="http://webqtl.bic.nus.edu.sg/" target="_blank"> - Singapore</a> at the NUS</li> - - <li><a href="http://genenetwork.epfl.ch/" target="_blank"> - Switzerland</a> at the EPFL</li> + <ul> + <li><a href="http://www.genenetwork.org/" target="_blank" style="font-size:12px;font-family:verdana;color:blue">Main GN1 site at UTHSC</a> (main site)</li> + <li><a href="http://www.genenetwork.waimr.uwa.edu.au/" target="_blank" style="font-size:12px;font-family:verdana;color:blue">Australia at the UWA</a></li> + <li><a href="http://gn.genetics.ucla.edu/" target="_blank" style="font-size:12px;font-family:verdana;color:blue">California at UCLA</a></li> + <li><a href="http://genenetwork.helmholtz-hzi.de/" target="_blank" style="font-size:12px;font-family:verdana;color:blue">Germany at the HZI</a></li> + <li><a href="http://genenetwork.memphis.edu/" target="_blank" style="font-size:12px;font-family:verdana;color:blue">Memphis at the U of M</a></li> + <li><a href="http://genenetwork.epfl.ch/" target="_blank" style="font-size:12px;font-family:verdana;color:blue">Switzerland at the EPFL</a></li> </ul> </section> diff --git a/wqflask/wqflask/templates/news.html b/wqflask/wqflask/templates/news.html new file mode 100755 index 00000000..4f0032b8 --- /dev/null +++ b/wqflask/wqflask/templates/news.html @@ -0,0 +1,21 @@ +{% extends "base.html" %} + +{% block title %}{{title}}{% endblock %} + +{% block content %} +<div class="container"> + <h3>{{title}}</h3> + <table class="table table-hover table-striped" style="width: 600px;"> + <tbody> + {% for newsitem in newslist %} + <tr> + <td style="width: 90px; text-wrap:none;" nowrap> + <span style="font-weight: bold;">{{newsitem.date}}</span> + </td> + <td>{{newsitem.details|safe}}</td> + </tr> + {% endfor %} + </tbody> + </table> +</div> +{% endblock %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 7fec0456..39004f07 100755 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -33,6 +33,7 @@ from flask import (render_template, request, make_response, Response, from wqflask import search_results from wqflask import docs +from wqflask import news from base.data_set import DataSet # Used by YAML in marker_regression from base.data_set import create_datasets_list from wqflask.show_trait import show_trait @@ -45,8 +46,6 @@ from wqflask.correlation_matrix import show_corr_matrix from wqflask.correlation import corr_scatter_plot from utility import temp_data -from wqflask.dataSharing import SharingInfo, SharingInfoPage - from base import webqtlFormData from utility.benchmark import Bench @@ -100,20 +99,20 @@ def tmp_page(img_path): img_base64 = bytesarray ) -@app.route("/data_sharing") -def data_sharing_page(): - print("In data_sharing") - fd = webqtlFormData.webqtlFormData(request.args) - print("1Have fd") - sharingInfoObject = SharingInfo.SharingInfo(request.args['GN_AccessionId'], None) - info, htmlfilelist = sharingInfoObject.getBody(infoupdate="") - print("type(htmlfilelist):", type(htmlfilelist)) - htmlfilelist = htmlfilelist.encode("utf-8") - #template_vars = SharingInfo.SharingInfo(request.args['GN_AccessionId'], None) - print("1 Made it to rendering") - return render_template("data_sharing.html", - info=info, - htmlfilelist=htmlfilelist) +#@app.route("/data_sharing") +#def data_sharing_page(): +# print("In data_sharing") +# fd = webqtlFormData.webqtlFormData(request.args) +# print("1Have fd") +# sharingInfoObject = SharingInfo.SharingInfo(request.args['GN_AccessionId'], None) +# info, htmlfilelist = sharingInfoObject.getBody(infoupdate="") +# print("type(htmlfilelist):", type(htmlfilelist)) +# htmlfilelist = htmlfilelist.encode("utf-8") +# #template_vars = SharingInfo.SharingInfo(request.args['GN_AccessionId'], None) +# print("1 Made it to rendering") +# return render_template("data_sharing.html", +# info=info, +# htmlfilelist=htmlfilelist) @app.route("/search", methods=('GET',)) @@ -152,9 +151,10 @@ def search_page(): else: return render_template("search_result_page.html", **result) -@app.route("/testhtmleditor") -def testhtmleditor_page(): - return render_template("testhtmleditor.html") +@app.route("/docedit") +def docedit(): + doc = docs.Docs(request.args['entry']) + return render_template("docedit.html", **doc.__dict__) @app.route("/help") def help(): @@ -162,15 +162,9 @@ def help(): return render_template("docs.html", **doc.__dict__) @app.route("/news") -def news(): - #variables = whats_new.whats_new() - with open("/home/sam/gene/wqflask/wqflask/yaml_data/whats_new.yaml") as fh: - contents = fh.read() - yamilized = yaml.safe_load(contents) - news_items = yamilized['news'] - for news_item in news_items: - print("\nnews_item is: %s\n" % (news_item)) - return render_template("whats_new.html", news_items=news_items) +def news_route(): + newsobject = news.News() + return render_template("news.html", **newsobject.__dict__) @app.route("/references") def references(): diff --git a/wqflask/wqflask/yaml_data/whats_new.yaml b/wqflask/wqflask/yaml_data/whats_new.yaml deleted file mode 100755 index 8f41a8f2..00000000 --- a/wqflask/wqflask/yaml_data/whats_new.yaml +++ /dev/null @@ -1,26 +0,0 @@ -news: -- - date: 2012-1-20 - title: Mouse SNPs from dbSNP have been added to GeneNetwork - details: - 10 million mouse SNPs from dbSNP (build 128) have been added to Variant Browser. - They could be searched by name (e.g. rs31192936) (Implemented by Xiaodong Zhou and Ning Liu). - -- - date: 2012-1-20 - title: Literature correlation has been update to 2011 version - details: - Dr. Ramin Homayouni and Dr. Lijing Xu kindly provide the 2011 version of mouse gene-gene - literature correlation matrix to GeneNetwork. (Implemented by Xiaodong Zhou). - -- - date: 2012-1-16 - title: Expression data set for EPFL/LISP BXD Muscle Affy Mouse Gene 1.0 ST (Dec11) RMA ** has been entered in GeneNetwork - details: - Laboratory of Integrative and Systems Physiology - (<a href="http://auwerx-lab.epfl.ch/">LISP</a>). - This data set is not yet freely available for global analysis. - This data set has not yet been used or described in any publication. - Please contact Johan Auwerx or Evan Williams at evan.williams@epfl.ch - regarding use of these data. (Implemented by J Auwerx, E Williams, LA Rose, - RW Williams and A Centeno).
\ No newline at end of file |