diff options
Diffstat (limited to 'wqflask/base')
-rwxr-xr-x | wqflask/base/GeneralObject.py | 68 | ||||
-rwxr-xr-x | wqflask/base/JinjaPage.py | 28 | ||||
-rwxr-xr-x | wqflask/base/admin.py | 86 | ||||
-rwxr-xr-x | wqflask/base/cgiData.py | 66 | ||||
-rwxr-xr-x | wqflask/base/cookieData.py | 49 | ||||
-rwxr-xr-x | wqflask/base/footer.py | 6 | ||||
-rwxr-xr-x | wqflask/base/generate_probesetfreeze_file.py | 31 | ||||
-rwxr-xr-x | wqflask/base/header.py | 6 | ||||
-rwxr-xr-x | wqflask/base/indexBody.py | 290 | ||||
-rwxr-xr-x | wqflask/base/myCookie.py | 51 | ||||
-rwxr-xr-x | wqflask/base/sessionData.py | 50 | ||||
-rwxr-xr-x | wqflask/base/templatePage.py | 222 | ||||
-rwxr-xr-x | wqflask/base/webqtlConfig.py | 6 | ||||
-rwxr-xr-x | wqflask/base/webqtlFormData.py | 6 |
14 files changed, 3 insertions, 962 deletions
diff --git a/wqflask/base/GeneralObject.py b/wqflask/base/GeneralObject.py deleted file mode 100755 index 53d1357b..00000000 --- a/wqflask/base/GeneralObject.py +++ /dev/null @@ -1,68 +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 - -class GeneralObject: - """ - Base class to define an Object. - a = [Spam(1, 4), Spam(9, 3), Spam(4,6)] - a.sort(lambda x, y: cmp(x.eggs, y.eggs)) - """ - - def __init__(self, *args, **kw): - self.contents = list(args) - for name, value in kw.items(): - setattr(self, name, value) - - def __setitem__(self, key, value): - setattr(self, key, value) - - def __getitem__(self, key): - return getattr(self, key) - - def __getattr__(self, key): - if key in self.__dict__.keys(): - return self.__dict__[key] - else: - return eval("self.__dict__.%s" % key) - - def __len__(self): - return len(self.__dict__) - 1 - - def __str__(self): - s = '' - for key in self.__dict__.keys(): - if key != 'contents': - s += '%s = %s\n' % (key,self.__dict__[key]) - return s - - def __repr__(self): - s = '' - for key in self.__dict__.keys(): - s += '%s = %s\n' % (key,self.__dict__[key]) - return s - - def __cmp__(self,other): - return len(self.__dict__.keys()).__cmp__(len(other.__dict__.keys())) diff --git a/wqflask/base/JinjaPage.py b/wqflask/base/JinjaPage.py deleted file mode 100755 index 07e485b1..00000000 --- a/wqflask/base/JinjaPage.py +++ /dev/null @@ -1,28 +0,0 @@ -import logging -logging.basicConfig(filename="/tmp/gn_log", level=logging.INFO) -_log = logging.getLogger("search") - -from pprint import pformat as pf - -import templatePage - -from utility import formatting - -import jinja2 -JinjaEnv = jinja2.Environment(loader=jinja2.FileSystemLoader('/gnshare/gn/web/webqtl/templates')) -JinjaEnv.globals['numify'] = formatting.numify - - -class JinjaPage(templatePage.templatePage): - """Class derived from our regular templatePage, but uses Jinja2 instead. - - When converting pages from Python generated templates, change the base class from templatePage - to JinjaPage - - """ - - - def write(self): - """We override the base template write so we can use Jinja2.""" - _log.info(pf(self.__dict__)) - return self.jtemplate.render(**self.__dict__) diff --git a/wqflask/base/admin.py b/wqflask/base/admin.py deleted file mode 100755 index 1ba75117..00000000 --- a/wqflask/base/admin.py +++ /dev/null @@ -1,86 +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 - - - - - -#XZ, 04/02/2009: we should put this into database. - - -###LIST of databases used into gene name query - - -ADMIN_search_dbs = { - 'rat': {'PERITONEAL FAT': ['FT_2A_0605_Rz'], - 'KIDNEY': ['KI_2A_0405_Rz'], - 'ADRENAL GLAND': ['HXB_Adrenal_1208'], - 'HEART': ['HXB_Heart_1208'] - }, - 'mouse': {'CEREBELLUM': ['CB_M_0305_R'], - 'STRIATUM': ['SA_M2_0905_R', 'SA_M2_0405_RC', 'UTHSC_1107_RankInv', 'Striatum_Exon_0209'], - 'HIPPOCAMPUS': ['HC_M2_0606_R', 'UMUTAffyExon_0209_RMA'], - 'WHOLE BRAIN': ['BR_M2_1106_R', 'IBR_M_0106_R', 'BRF2_M_0805_R', 'UCLA_BHF2_BRAIN_0605'], - 'LIVER': ['LV_G_0106_B', 'UCLA_BHF2_LIVER_0605'], - 'EYE': ['Eye_M2_0908_R'], - 'HEMATOPOIETIC STEM CELLS': ['HC_U_0304_R'], - 'KIDNEY': ['MA_M2_0806_R'], - 'MAMMARY TUMORS': ['MA_M_0704_R', 'NCI_Agil_Mam_Tum_RMA_0409'], - 'PREFRONTAL CORTEX': ['VCUSal_1206_R'], - 'SPLEEN': ['IoP_SPL_RMA_0509'], - 'NUCLEUS ACCUMBENS': ['VCUSalo_1007_R'], - 'NEOCORTEX': ['HQFNeoc_0208_RankInv'], - 'ADIPOSE': ['UCLA_BHF2_ADIPOSE_0605'], - 'RETINA': ['Illum_Retina_BXD_RankInv0410'] - }, - 'human': { - 'LYMPHOBLAST B CELL': ['Human_1008', 'UT_CEPH_RankInv0909'], - 'WHOLE BRAIN': ['GSE5281_F_RMA0709', 'GSE15222_F_RI_0409'] - } - } - - -###LIST of tissue alias - -ADMIN_tissue_alias = {'CEREBELLUM': ['Cb'], - 'STRIATUM': ['Str'], - 'HIPPOCAMPUS': ['Hip'], - 'WHOLE BRAIN': ['Brn'], - 'LIVER': ['Liv'], - 'EYE': ['Eye'], - 'PERITONEAL FAT': ['Fat'], - 'HEMATOPOIETIC STEM CELLS': ['Hsc'], - 'KIDNEY': ['Kid'], - 'ADRENAL GLAND': ['Adr'], - 'HEART': ['Hea'], - 'MAMMARY TUMORS': ['Mam'], - 'PREFRONTAL CORTEX': ['Pfc'], - 'SPLEEN': ['Spl'], - 'NUCLEUS ACCUMBENS': ['Nac'], - 'NEOCORTEX': ['Ctx'], - 'ADIPOSE': ['Wfat'], - 'RETINA': ['Ret'] - } diff --git a/wqflask/base/cgiData.py b/wqflask/base/cgiData.py deleted file mode 100755 index 155b3ec3..00000000 --- a/wqflask/base/cgiData.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 - -######################################### -#convert Field storage object to Dict object -#in order to be able to saved into a session file -######################################### - -class cgiData(dict): - '''convert Field storage object to Dict object - Filed storage object cannot be properly dumped - ''' - - def __init__(self, field_storage=None): - - if not field_storage: - field_storage={} - - for key in field_storage.keys(): - temp = field_storage.getlist(key) - if len(temp) > 1: - temp = map(self.toValue, temp) - elif len(temp) == 1: - temp = self.toValue(temp[0]) - else: - temp = None - self[key]= temp - - def toValue(self, obj): - '''fieldstorge returns different type of objects, \ - need to convert to string or None''' - try: - return obj.value - except: - return "" - - def getvalue(self, k, default= None): - try: - return self[k] - except: - return default - - getfirst = getvalue diff --git a/wqflask/base/cookieData.py b/wqflask/base/cookieData.py deleted file mode 100755 index eeb7c0cf..00000000 --- a/wqflask/base/cookieData.py +++ /dev/null @@ -1,49 +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 - -######################################### -#convert mod_python object to Dict object -#in order to be able to be pickled -######################################### - -class cookieData(dict): - 'convert mod python Cookie object to Dict object' - - def __init__(self, cookies=None): - - if not cookies: - cookies={} - - for key in cookies.keys(): - self[key.lower()]= cookies[key].value - - def getvalue(self, k, default= None): - try: - return self[k.lower()] - except: - return default - - getfirst = getvalue diff --git a/wqflask/base/footer.py b/wqflask/base/footer.py deleted file mode 100755 index 6f92fdf8..00000000 --- a/wqflask/base/footer.py +++ /dev/null @@ -1,6 +0,0 @@ -import webqtlConfig - -footer_html = open(webqtlConfig.HTMLPATH + 'footer.html', 'r').read() -footer = footer_html.replace('%"','%%"') - -footer_string = footer.replace('<!-- %s -->', '%s') diff --git a/wqflask/base/generate_probesetfreeze_file.py b/wqflask/base/generate_probesetfreeze_file.py deleted file mode 100755 index a0ff804b..00000000 --- a/wqflask/base/generate_probesetfreeze_file.py +++ /dev/null @@ -1,31 +0,0 @@ -from __future__ import absolute_import, print_function, division -import os -import math - -import json -import itertools - -from flask import Flask, g - -from base import webqtlConfig -from dbFunction import webqtlDatabaseFunction -from utility import webqtlUtil - -from MySQLdb import escape_string as escape -from pprint import pformat as pf - - -query = """ select ProbeSet.Name - from ProbeSetXRef, - ProbeSetFreeze, - ProbeSet - where ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id and - ProbeSetFreeze.Name = "EPFLMouseMuscleCDRMA1211" and - ProbeSetXRef.ProbeSetId = ProbeSet.Id; - """ - -markers = g.db.execute(query).fetchall() -print("markers: ", pf(markers)) - -if __name__ == '__main__': - main()
\ No newline at end of file diff --git a/wqflask/base/header.py b/wqflask/base/header.py deleted file mode 100755 index ec15e174..00000000 --- a/wqflask/base/header.py +++ /dev/null @@ -1,6 +0,0 @@ -import webqtlConfig - -header_string = open(webqtlConfig.HTMLPATH + 'header.html', 'r').read() -header_string = header_string.replace("\\'", "'") -header_string = header_string.replace('%"','%%"') -header_string = header_string.replace('<!-- %s -->', '%s') diff --git a/wqflask/base/indexBody.py b/wqflask/base/indexBody.py deleted file mode 100755 index a5bc4c17..00000000 --- a/wqflask/base/indexBody.py +++ /dev/null @@ -1,290 +0,0 @@ -index_body_string = """ -<TD vAlign=top width="40%" align="left" height=10 bgColor=#eeeeee> - <p style="font-size:18px;font-family:verdana;color:black"><B> Select and Search</B> - <Form METHOD="POST" ACTION="/webqtl/main.py" ENCTYPE="multipart/form-data" NAME="SEARCHFORM"> - - <TABLE width="100%"> - - <!-- 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 width="3%"> - </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 width="3%"> - </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 width="3%"> - </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> - - <!-- USER HELP --> - <TR> - <TD align=right height=20 width="10%"> - </TD> - <TD width="3%"> - </TD> - - <TD align="left" width="85%"> - <P class="fs12"> Databases marked with <B>**</B> suffix are not public yet. - <BR> Access requires <A HREF="/account.html" target="_blank" class="fs14"><small>user login</small></A>.</P> - </TD> - </TR> - - -<!-- GET ANY SEARCH --> - <TR> - <TD align=right height=35 NOWRAP="on" style="font-size:14px;font-family:verdana;color:black" width="10%"> - <B>Get Any:</B> - </TD> - - <TD width="3%"> - </TD> - - <TD NOWRAP width="85%" align="left"> - - <input id="tfor" name="ORkeyword" style="width:420px; background-color:white; font-family:verdana; font-size:14px" type="text" maxlength="500"> - </TD> - </TR> - - - -<!-- GET ANY HELP --> - <TR> - <TD align=right height=20 width="10%"> - </TD> - <TD width="3%"> - - </TD> - <TD width="85%" align="left"> - <P class="fs12"> Enter terms, genes, ID numbers in the <B>Get Any</B> field. - <BR> Use <B>*</B> or <B>?</B> wildcards (Cyp*a?, synap*). - <BR> Use <B>Combined</B> for terms such as <I>tyrosine kinase</I>.</P> - - </TD> - </TR> - - - -<!-- COMBINED SEARCH --> - - <TR> - <TD align=right height=35 NOWRAP="on" STYLE="font-size:14px;font-family:verdana;color:black" width="10%"> - <B>Combined:</B> - </TD> - - <TD width="3%"> - </TD> - - <TD NOWRAP width="85%" align="left"> - <input id="tfand" NAME="ANDkeyword" STYLE="width:420px; background-color:white; font-family:verdana; font-size:14px" type="text" maxlength="500"> - <input name="matchwhole" type="hidden" value="ON"> - </TD> - </TR> - - - -<!-- SEARCH, MAKE DEFAULT, ADVANCED SEARCH --> - - <TR ALIGN="center"> - <TD width="3%"> - </TD> - <TD width="3%"> - </TD> - <TD ALIGN="left" HEIGHT="40" COLSPAN=3> - <INPUT id="btsearch" TYPE="Submit" CLASS="button" STYLE="font-size:12px" VALUE=" Search "> - <INPUT TYPE="button" CLASS="button" STYLE="font-size:12px" VALUE=" Make Default " onClick = "setDefault(this.form);"> - <INPUT TYPE="button" CLASS="button" STYLE="font-size:12px" VALUE=" Advanced Search " onClick="javascript:window.open('/index3.html', '_self');"> - - </TD> - </TR> - </TABLE> - <INPUT TYPE="hidden" NAME="FormID" VALUE="searchResult"> - <INPUT TYPE="hidden" NAME="RISet" VALUE="BXD"> - <SCRIPT SRC="/javascript/selectDatasetMenu.js"></SCRIPT> - </FORM> - </CENTER> - - - - - -<!-- QUICK HELP --> - -<P><LEFT> ______________________________________________________ - -<P STYLE="font-size:13px;font-family:verdana;color:black"><B> - -Quick HELP Examples and </B> -<A HREF="http://www.genenetwork.org/index4.html" target="_blank" class="fs14"><B> - User's Guide</B></A></P> - -</CENTER style="font-size:12px;font-family:verdana;color:black"> - You can also use advanced commands. Copy these simple examples -<BR> into the <B>Get Any</B> or <B>Combined</B> search fields: -<UL style="font-size:12px;font-family:verdana;color:black"> - -<LI><B><I>POSITION=(chr1 25 30)</I></B> finds genes, markers, or transcripts on chromosome 1 between 25 and 30 Mb. - -<LI><B><I>MEAN=(15 16) LRS=(23 46)</I></B> in the <B>Combined</B> field finds highly expressed genes (15 to 16 log2 units) AND with peak <A HREF="http://www.genenetwork.org/glossary.html#L" target="_blank" class="fs14"><small>LRS</small></A> linkage between 23 and 46. - - -<LI><B><I>RIF=mitochondrial</I></B> searches RNA databases for <A HREF="http://www.ncbi.nlm.nih.gov/projects/GeneRIF/GeneRIFhelp.html" target="_blank" class="fs14"><small>GeneRIF</small></A> links. - -<LI><B><I>WIKI=nicotine</I></B> searches <A HREF="http://www.genenetwork.org/webqtl/main.py?FormID=geneWiki" target="_blank" class="fs14"><small>GeneWiki</small></A> for genes that you or other users have annotated with the word <I>nicotine</I>. - -<LI><B><I>GO:0045202</I></B> searches for synapse-associated genes listed in the <A HREF="http://www.godatabase.org/cgi-bin/amigo/go.cgi" target="_blank" class="fs14"><small>Gene Ontology</small></A>. - - -<LI><B><I>GO:0045202 LRS=(9 99 Chr4 122 155) cisLRS=(9 999 10)</I> </B><BR> in <B>Combined</B> finds synapse-associated genes with <A HREF="http://www.genenetwork.org/glossary.html#E" target="_blank" class="fs14"><small>cis eQTL</small></A> on Chr 4 from 122 and 155 Mb with LRS scores between 9 and 999. - -<LI><B><I>RIF=diabetes LRS=(9 999 Chr2 100 105) transLRS=(9 999 10)</I> </B><BR> in <B>Combined</B> finds diabetes-associated transcripts with peak <A HREF="http://www.genenetwork.org/glossary.html#E" target="_blank" class="fs14"><small>trans eQTLs</small></A> on Chr 2 between 100 and 105 Mb with LRS scores between 9 and 999. - - -</UL> -</DIR> - </TD> -<!-- END OF FIND SELECTOR PULL-DOWN PANEL (LEFT SIDE) --> - -<!-- START OF TOP RIGHT PANEL --> - -<TD vAlign=top width="40%" bgColor=#FFFFFF> - <p style="font-size:15px;font-family:verdana;color:black"><B>Websites Affiliated with GeneNetwork</B></p> - <p style="font-size:12px;font-family:verdana;color:black"> - <ul> - <li><a href="http://ucscbrowser.genenetwork.org/" target="_blank">Genome Browser</a> at UTHSC</li> - <li><a href="http://galaxy.genenetwork.org/" target="_blank">Galaxy</a> at UTHSC</li> - <li>GeneNetwork at <a href="http://ec2.genenetwork.org/" target="_blank">Amazon Cloud (EC2)</a></li> - <li>GeneNetwork Source Codes at <a href="http://sourceforge.net/projects/genenetwork/" target="_blank">SourceForge</a></li> - </ul> - </p> - <P>____________________________ - - <p style="font-size:15px;font-family:verdana;color:black"><B>Getting Started</B> </p> - <OL style="font-size:12px;font-family:verdana;color:black"> - <LI>Select <B>Species</B> (or select All) - <LI>Select <B>Group</B> (a specific sample) - <LI>Select <B>Type</B> of data: - <UL> - <LI>Phenotype (traits) - <LI>Genotype (markers) - <LI>Expression (mRNAs) - </UL> - <LI>Select a <B>Database</B> - <LI>Enter search terms in the <B>Get Any</B> or <B>Combined</B> field: words, genes, ID numbers, probes, advanced search commands - <LI>Click on the <B>Search</B> button - <LI>Optional: Use the <B>Make Default</B> button to save your preferences - </OL> - - <P>____________________________ - -<p style="font-size:14px;font-family:verdana;color:black"><B>How to Use GeneNetwork</B> - - <BLOCKQUOTE> - <p style="font-size:12px;font-family:verdana;color:black">Take a 20-40 minute GeneNetwork <A HREF="http://www.genenetwork.org/tutorial/WebQTLTour/" target="_blank" class="fs14"><small>Tour</small></A> that includes screen shots and typical steps in the analysis.</P> - </BLOCKQUOTE> - <BLOCKQUOTE> - <p style="font-size:12px;font-family:verdana;color:black">For information about resources and methods, select the <img src="http://www.genenetwork.org/images/upload/Info.png" alt="INFO" border= 0 valign="middle"> buttons.</P> - - - -<p style="font-size:12px;font-family:verdana;color:black">Try the <A HREF="http://alexandria.uthsc.edu/" target="_blank" class="fs14"><small>Workstation</small></A> site to explore data and features that are being implemented.</P> - - -<p style="font-size:12px;font-family:verdana;color:black">Review the <A HREF="/conditionsofUse.html" target="_blank" class="fs14"><small>Conditions</small></A> and <A HREF="/statusandContact.html" target="_blank" class="fs14"><small>Contacts</small></A> pages for information on the status of data sets and advice on their use and citation.</P> - - - </BLOCKQUOTE> - - - - <p style="font-size:14px;font-family:verdana;color:black"><B>Mirror and Development Sites</B></P> - - <UL> - <LI><A HREF="http://www.genenetwork.org/" target="_blank" style="font-size:12px;font-family:verdana;color:blue">Main GN site at UTHSC</A> (main site) - <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><A HREF="http://gn.genetics.ucla.edu/" target="_blank" style="font-size:12px;font-family:verdana;color:blue">California at UCLA</A> - <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><A HREF="https://genenetwork.hubrecht.eu/" target="_blank" style="font-size:12px;font-family:verdana;color:blue">Netherlands at the Hubrecht</A> (Development) - <LI><A HREF="http://xzhou3.memphis.edu/" target="_blank" style="font-size:12px;font-family:verdana;color:blue">Memphis at the U of M</A> - <LI><A HREF="http://webqtl.bic.nus.edu.sg/" target="_blank" style="font-size:12px;font-family:verdana;color:blue">Singapore at the NUS</A> - <LI><A HREF="http://genenetwork.epfl.ch/" target="_blank" style="font-size:12px;font-family:verdana;color:blue">Switzerland at the EPFL</A> - </UL> - - - <p style="font-size:14px;font-family:verdana;color:black"><B>History and Archive</B> - - <BLOCKQUOTE> - <p style="font-size:12px;font-family:verdana;color:black">GeneNetwork's <A HREF="http://artemis.uthsc.edu" target="_blank" class="fs14"><small>Time Machine</small></A> links to earlier versions that correspond to specific publication dates.</P> - - </BLOCKQUOTE> - - -</P> - </TD> -""" diff --git a/wqflask/base/myCookie.py b/wqflask/base/myCookie.py deleted file mode 100755 index add7e6ea..00000000 --- a/wqflask/base/myCookie.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 - -######################################### -## python cookie and mod python cookie are -## not compatible -######################################### - -class myCookie(dict): - 'define my own cookie' - - def __init__(self, name="", value="", expire = None, path="/"): - self['name']= name - self['value']= value - self['expire']= expire - self['path']= path - - def __getattr__(self, key): - if key in self.keys(): - return self[key] - else: - return None - - def __nonzero__ (self): - if self['name']: - return 1 - else: - return 0 diff --git a/wqflask/base/sessionData.py b/wqflask/base/sessionData.py deleted file mode 100755 index 4b23060f..00000000 --- a/wqflask/base/sessionData.py +++ /dev/null @@ -1,50 +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 - -######################################### -#convert mod_python object to Dict object -#in order to be able to be pickled -######################################### - -class sessionData(dict): - 'convert mod python Session object to Dict object' - - def __init__(self, mod_python_session=None): - - if not mod_python_session: - mod_python_session = {} - - for key in mod_python_session.keys(): - self[key]= mod_python_session[key] - - - def getvalue(self, k, default= None): - try: - return self[k] - except: - return default - - getfirst = getvalue diff --git a/wqflask/base/templatePage.py b/wqflask/base/templatePage.py deleted file mode 100755 index a94d5153..00000000 --- a/wqflask/base/templatePage.py +++ /dev/null @@ -1,222 +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 - -#templatePage.py -# -#--Genenetwork generates a lot of pages; this file is the generic version of them, defining routines they all use. -# -#Classes: -#templatePage -# -#Functions (of templatePage): -#__init__(...) -- class constructor, allows a more specific template to be used in addition to templatePage -#__str__(self) -- returns the object's elements as a tuple -#__del__(self) -- closes the current connection to MySQL, if there is one -#write -- explained below -#writefile -- explained below -#openMysql(self) -- opens a MySQL connection and stores the resulting cursor in the object's cursor variable -#updMysql(self) -- same as openMysql -#error -- explained below -#session -- explained below - - -import socket -import time -import shutil -import MySQLdb -import os - -from htmlgen import HTMLgen2 as HT - -import template -import webqtlConfig -import header -import footer -from utility import webqtlUtil - - - -class templatePage: - - contents = ['title','basehref','js1','js2', 'layer', 'header', 'body', 'footer'] - - # you can pass in another template here if you want - def __init__(self, fd=None, template=template.template): - - # initiate dictionary - self.starttime = time.time() - self.dict = {} - self.template = template - - for item in self.contents: - self.dict[item] = "" - - self.dict['basehref'] = "" #webqtlConfig.BASEHREF - self.cursor = None - - self.cookie = [] #XZ: list to hold cookies (myCookie object) being changed - self.content_type = 'text/html' - self.content_disposition = '' - self.redirection = '' - self.debug = '' - self.attachment = '' - - #XZ: Holding data (new data or existing data being changed) that should be saved to session. The data must be picklable!!! - self.session_data_changed = {} - - self.userName = 'Guest' - self.privilege = 'guest' - - # Commenting this out for flask - we'll have to reimplement later - Sam - #if fd.input_session_data.has_key('user'): - # self.userName = fd.input_session_data['user'] - #if fd.input_session_data.has_key('privilege'): - # self.privilege = fd.input_session_data['privilege'] - - def __str__(self): - - #XZ: default setting - thisUserName = self.userName - thisPrivilege = self.privilege - #XZ: user may just go through login or logoff page - if self.session_data_changed.has_key('user'): - thisUserName = self.session_data_changed['user'] - if self.session_data_changed.has_key('privilege'): - thisPrivilege = self.session_data_changed['privilege'] - - if thisUserName == 'Guest': - userInfo = 'Welcome! <a href=/account.html><U>Login</U></a>' - else: - userInfo = 'Hi, %s! <a href=/webqtl/main.py?FormID=userLogoff><U>Logout</U></a>' % thisUserName - - reload(header) - self.dict['header'] = header.header_string % userInfo - - serverInfo = "It took %2.3f second(s) for %s to generate this page" % (time.time()-self.starttime, socket.getfqdn()) - reload(footer) - self.dict['footer'] = footer.footer_string % serverInfo - - slist = [] - for item in self.contents: - slist.append(self.dict[item]) - return self.template % tuple(slist) - - - def __del__(self): - if self.cursor: - self.cursor.close() - - def write(self): - 'return string representation of this object' - - if self.cursor: - self.cursor.close() - - return str(self) - - def writeFile(self, filename): - 'save string representation of this object into a file' - if self.cursor: - self.cursor.close() - - try: - 'it could take a long time to generate the file, save to .tmp first' - fp = open(os.path.join(webqtlConfig.TMPDIR, filename+'.tmp'), 'wb') - fp.write(str(self)) - fp.close() - path_tmp = os.path.join(webqtlConfig.TMPDIR, filename+'.tmp') - path_html = os.path.join(webqtlConfig.TMPDIR, filename) - shutil.move(path_tmp,path_html) - except: - pass - - def openMysql(self): - try: - self.db_conn = MySQLdb.Connect(db=webqtlConfig.DB_NAME,host=webqtlConfig.MYSQL_SERVER, \ - user=webqtlConfig.DB_USER,passwd=webqtlConfig.DB_PASSWD) - self.cursor = self.db_conn.cursor() - return True - except Exception: - heading = "Connect MySQL Server" - detail = ["Can't connect to MySQL server on '"+ webqtlConfig.MYSQL_SERVER+"':100061. \ - The server may be down at this time"] - self.error(heading=heading,detail=detail,error="Error 2003") - return False - - def updMysql(self): - try: - self.db_conn = MySQLdb.Connect(db=webqtlConfig.DB_UPDNAME,host=webqtlConfig.MYSQL_UPDSERVER, \ - user=webqtlConfig.DB_UPDUSER,passwd=webqtlConfig.DB_UPDPASSWD) - self.cursor = self.db_conn.cursor() - return True - except Exception: - heading = "Connect MySQL Server" - detail = ["update: Can't connect to MySQL server on '"+ webqtlConfig.MYSQL_UPDSERVER+"':100061. \ - The server may be down at this time "] - self.error(heading=heading,detail=detail,error="Error 2003") - return False - - def error(self,heading="",intro=[],detail=[],title="Error",error="Error"): - 'generating a WebQTL style error page' - Heading = HT.Paragraph(heading) - Heading.__setattr__("class","title") - - Intro = HT.Blockquote() - if intro: - for item in intro: - Intro.append(item) - else: - Intro.append(HT.Strong('Sorry!'),' Error occurred while processing\ - your request.', HT.P(),'The nature of the error generated is as\ - follows:') - - Detail = HT.Blockquote() - Detail.append(HT.Span("%s : " % error,Class="fwb cr")) - if detail: - Detail2 = HT.Blockquote() - for item in detail: - Detail2.append(item) - Detail.append(HT.Italic(Detail2)) - - #Detail.__setattr__("class","subtitle") - TD_LR = HT.TD(height=200,width="100%",bgColor='#eeeeee',valign="top") - TD_LR.append(Heading,Intro,Detail) - self.dict['body'] = str(TD_LR) - self.dict['title'] = title - - def session(self,mytitle="",myHeading=""): - 'generate a auto-refreshing temporary html file(waiting page)' - self.filename = webqtlUtil.generate_session() - self.dict['title'] = mytitle - self.dict['basehref'] = webqtlConfig.REFRESHSTR % (webqtlConfig.CGIDIR, self.filename) + "" #webqtlConfig.BASEHREF - - TD_LR = HT.TD(align="center", valign="middle", height=200,width="100%", bgColor='#eeeeee') - Heading = HT.Paragraph(myHeading, Class="fwb fs16 cr") - # NL, 07/27/2010. variable 'PROGRESSBAR' has been moved from templatePage.py to webqtlUtil.py; - TD_LR.append(Heading, HT.BR(), webqtlUtil.PROGRESSBAR) - self.dict['body'] = TD_LR - self.writeFile(self.filename + '.html') - return self.filename diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py index 23d32233..48d8cd0a 100755 --- a/wqflask/base/webqtlConfig.py +++ b/wqflask/base/webqtlConfig.py @@ -52,13 +52,13 @@ ENSEMBLETRANSCRIPT_URL="http://useast.ensembl.org/Mus_musculus/Lucene/Details?sp GNROOT = "/home/zas1024/gene/" # Will remove this and dependent items later SECUREDIR = GNROOT + 'secure/' COMMON_LIB = GNROOT + 'support/admin' -HTMLPATH = GNROOT + 'web/' +HTMLPATH = GNROOT + 'genotype_files/' PYLMM_PATH = '/home/zas1024/plink/' SNP_PATH = '/home/zas1024/snps/' -IMGDIR = HTMLPATH +'image/' +IMGDIR = GNROOT + '/wqflask/wqflask/images/' IMAGESPATH = HTMLPATH + 'images/' UPLOADPATH = IMAGESPATH + 'upload/' -TMPDIR = '/tmp/' +TMPDIR = '/home/zas1024/tmp/' # Will remove this and dependent items later GENODIR = HTMLPATH + 'genotypes/' NEWGENODIR = HTMLPATH + 'new_genotypes/' GENO_ARCHIVE_DIR = GENODIR + 'archive/' diff --git a/wqflask/base/webqtlFormData.py b/wqflask/base/webqtlFormData.py index a3537c87..44fdcc3f 100755 --- a/wqflask/base/webqtlFormData.py +++ b/wqflask/base/webqtlFormData.py @@ -35,15 +35,9 @@ import os import reaper import webqtlConfig -import cookieData -import sessionData -from cgiData import cgiData from webqtlCaseData import webqtlCaseData from utility import webqtlUtil - - - class webqtlFormData(object): 'Represents data from a WebQTL form page, needed to generate the next page' |