From d67019ce6d763b983d17b6bd2fb573f61618ea09 Mon Sep 17 00:00:00 2001 From: Sam Ockman Date: Fri, 29 Jun 2012 18:23:39 -0400 Subject: working on data_sharing --- wqflask/wqflask/dataSharing/SharingBody.py | 290 +++++++ wqflask/wqflask/dataSharing/SharingInfo.py | 98 +++ wqflask/wqflask/dataSharing/SharingInfoAddPage.py | 47 ++ .../wqflask/dataSharing/SharingInfoDeletePage.py | 55 ++ wqflask/wqflask/dataSharing/SharingInfoEditPage.py | 51 ++ wqflask/wqflask/dataSharing/SharingInfoPage.py | 58 ++ .../wqflask/dataSharing/SharingInfoUpdatePage.py | 109 +++ .../wqflask/dataSharing/SharingListDataSetPage.py | 99 +++ wqflask/wqflask/dataSharing/SharingPage.py | 40 + wqflask/wqflask/dataSharing/__init__.py | 0 wqflask/wqflask/templates/data_sharing.html | 831 +++++++++++++++++++++ wqflask/wqflask/templates/index_page.html | 3 +- wqflask/wqflask/views.py | 19 +- 13 files changed, 1696 insertions(+), 4 deletions(-) create mode 100755 wqflask/wqflask/dataSharing/SharingBody.py create mode 100755 wqflask/wqflask/dataSharing/SharingInfo.py create mode 100755 wqflask/wqflask/dataSharing/SharingInfoAddPage.py create mode 100755 wqflask/wqflask/dataSharing/SharingInfoDeletePage.py create mode 100755 wqflask/wqflask/dataSharing/SharingInfoEditPage.py create mode 100755 wqflask/wqflask/dataSharing/SharingInfoPage.py create mode 100755 wqflask/wqflask/dataSharing/SharingInfoUpdatePage.py create mode 100755 wqflask/wqflask/dataSharing/SharingListDataSetPage.py create mode 100755 wqflask/wqflask/dataSharing/SharingPage.py create mode 100755 wqflask/wqflask/dataSharing/__init__.py create mode 100644 wqflask/wqflask/templates/data_sharing.html diff --git a/wqflask/wqflask/dataSharing/SharingBody.py b/wqflask/wqflask/dataSharing/SharingBody.py new file mode 100755 index 00000000..880161f5 --- /dev/null +++ b/wqflask/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 = """ + + +

Data Set Download

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Species: + + + +
+ Group: + + + +
+ Type: + + + +
+ Database: + + + +
+     +
+ + +
+ +

GeneNetwork Accession Number

+
+ + + + + + + + + + + + +
GN:  E.g. 112
+     +
+
+ + +""" + +sharinginfo_body_string = """ +List of DataSets
+

%s +modify this page +%s +

+ + + + + +
+ + + + + + + + + + + +
GN Accession: GN%s
GEO Series: %s
Title: %s
Organism: %s
Group: %s
Tissue: %s
Dataset Status: %s
Platforms: %s
Normalization: %s
+ See Contact Information
+
+
+ + + + + + + +
Download datasets and supplementary data files
%s
+
+
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Summary:
%s

About the cases used to generate this set of data:
%s

About the tissue used to generate this set of data:
%s

About downloading this data set:
%s

About the array platform:
%s

About data values and data processing:
%s

Data source acknowledgment:
%s

Experiment Type:
%s

Overall Design:
%s

Contributor:
%s

Citation:
%s

Submission Date:
%s

Laboratory:
%s

Samples:
%s

+

+ +""" + +sharinginfoedit_body_string = """ +

%s

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Principal Investigator

Contact Name:
Emails:
Phone:
URL:
Organization Name:
Department:
Laboratory:
Address:
City:
State:
ZIP:
Country:

Summary

Summary:

Biology

Experiment Design:
About the cases used to
generate this set of data:
About the tissue used to
generate this set of data:

Technique

About downloading this data set:
About the array platform:

Bioinformatics

About data values and
data processing:
Overall Design:

Misc

Contributor:
Citation:
Data source acknowledgment:

Administrator ONLY

GN Accesion Id:
DB Title in GN:
GEO Series:
Status:
Title:
Organism_Id (Taxonomy ID):
Organism:
Submission Date:
Platforms:
Species:
Tissue:
Normalization:
Inbred Set:
Info Page Name:
Samples:
Authorized Users:
Progress:
+""" diff --git a/wqflask/wqflask/dataSharing/SharingInfo.py b/wqflask/wqflask/dataSharing/SharingInfo.py new file mode 100755 index 00000000..131a4551 --- /dev/null +++ b/wqflask/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 = '