diff options
author | Sam Ockman | 2012-06-29 16:49:08 -0400 |
---|---|---|
committer | Sam Ockman | 2012-06-29 16:49:08 -0400 |
commit | 877e0832959c0ab9e7ad417cfdc233b450274a8d (patch) | |
tree | 3d8ae29720223d6204819172a68c23b820cd8c08 /wqflask | |
parent | 3a222b876cf291921194d9f0e2dd3fc8e6a999a2 (diff) | |
download | genenetwork2-877e0832959c0ab9e7ad417cfdc233b450274a8d.tar.gz |
Added dataSharing to flask directory
Diffstat (limited to 'wqflask')
-rwxr-xr-x | wqflask/dataSharing/SharingBody.py | 290 | ||||
-rwxr-xr-x | wqflask/dataSharing/SharingInfo.py | 98 | ||||
-rwxr-xr-x | wqflask/dataSharing/SharingInfoAddPage.py | 47 | ||||
-rwxr-xr-x | wqflask/dataSharing/SharingInfoDeletePage.py | 55 | ||||
-rwxr-xr-x | wqflask/dataSharing/SharingInfoEditPage.py | 51 | ||||
-rwxr-xr-x | wqflask/dataSharing/SharingInfoPage.py | 52 | ||||
-rwxr-xr-x | wqflask/dataSharing/SharingInfoUpdatePage.py | 109 | ||||
-rwxr-xr-x | wqflask/dataSharing/SharingListDataSetPage.py | 99 | ||||
-rwxr-xr-x | wqflask/dataSharing/SharingPage.py | 40 | ||||
-rwxr-xr-x | wqflask/dataSharing/__init__.py | 0 |
10 files changed, 841 insertions, 0 deletions
diff --git a/wqflask/dataSharing/SharingBody.py b/wqflask/dataSharing/SharingBody.py new file mode 100755 index 00000000..4445e0d1 --- /dev/null +++ b/wqflask/dataSharing/SharingBody.py @@ -0,0 +1,290 @@ +# 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/dataSharing/SharingInfo.py b/wqflask/dataSharing/SharingInfo.py new file mode 100755 index 00000000..10abcefa --- /dev/null +++ b/wqflask/dataSharing/SharingInfo.py @@ -0,0 +1,98 @@ +# 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 httplib + +from dbFunction import webqtlDatabaseFunction +import SharingBody + + +######################################### +# Sharing Info +######################################### +class SharingInfo: + + def __init__(self, GN_AccessionId, InfoPageName): + self.GN_AccessionId = GN_AccessionId + self.InfoPageName = InfoPageName + + def getInfo(self): + cursor = webqtlDatabaseFunction.getCursor() + if (not cursor): + return + sql = "select 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 from InfoFiles where " + 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 'No correct parameter found' + info = cursor.fetchone() + # fetch datasets file list + try: + conn = httplib.HTTPConnection("atlas.uthsc.edu") + conn.request("GET", "/scandatasets.php?GN_AccesionId=%s" % (info[32])) + response = conn.getresponse() + data = response.read() + filelist = data.split() + conn.close() + except Exception: + filelist = [] + 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 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]) diff --git a/wqflask/dataSharing/SharingInfoAddPage.py b/wqflask/dataSharing/SharingInfoAddPage.py new file mode 100755 index 00000000..8174bf68 --- /dev/null +++ b/wqflask/dataSharing/SharingInfoAddPage.py @@ -0,0 +1,47 @@ +# 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/dataSharing/SharingInfoDeletePage.py b/wqflask/dataSharing/SharingInfoDeletePage.py new file mode 100755 index 00000000..edc0be7d --- /dev/null +++ b/wqflask/dataSharing/SharingInfoDeletePage.py @@ -0,0 +1,55 @@ +# 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
\ No newline at end of file diff --git a/wqflask/dataSharing/SharingInfoEditPage.py b/wqflask/dataSharing/SharingInfoEditPage.py new file mode 100755 index 00000000..266b8602 --- /dev/null +++ b/wqflask/dataSharing/SharingInfoEditPage.py @@ -0,0 +1,51 @@ +# 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/dataSharing/SharingInfoPage.py b/wqflask/dataSharing/SharingInfoPage.py new file mode 100755 index 00000000..230ba2f3 --- /dev/null +++ b/wqflask/dataSharing/SharingInfoPage.py @@ -0,0 +1,52 @@ +# 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 Page +######################################### +class SharingInfoPage(templatePage): + + def __init__(self, fd=None): + templatePage.__init__(self, fd) + GN_AccessionId = fd.formdata.getvalue('GN_AccessionId') + InfoPageName = fd.formdata.getvalue('InfoPageName') + 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() + url = webqtlConfig.CGIDIR + "main.py?FormID=sharinginfo&GN_AccessionId=%s" % GN_AccessionId + self.redirection = url + else: + sharingInfoObject = SharingInfo.SharingInfo(GN_AccessionId, InfoPageName) + self.dict['body'] = sharingInfoObject.getBody(infoupdate="") diff --git a/wqflask/dataSharing/SharingInfoUpdatePage.py b/wqflask/dataSharing/SharingInfoUpdatePage.py new file mode 100755 index 00000000..a70238b9 --- /dev/null +++ b/wqflask/dataSharing/SharingInfoUpdatePage.py @@ -0,0 +1,109 @@ +# 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)
\ No newline at end of file diff --git a/wqflask/dataSharing/SharingListDataSetPage.py b/wqflask/dataSharing/SharingListDataSetPage.py new file mode 100755 index 00000000..ec90f5f3 --- /dev/null +++ b/wqflask/dataSharing/SharingListDataSetPage.py @@ -0,0 +1,99 @@ +# +# 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)
\ No newline at end of file diff --git a/wqflask/dataSharing/SharingPage.py b/wqflask/dataSharing/SharingPage.py new file mode 100755 index 00000000..cf1d9ac3 --- /dev/null +++ b/wqflask/dataSharing/SharingPage.py @@ -0,0 +1,40 @@ +# 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();"'
\ No newline at end of file diff --git a/wqflask/dataSharing/__init__.py b/wqflask/dataSharing/__init__.py new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/wqflask/dataSharing/__init__.py |