diff options
Diffstat (limited to 'web/webqtl/submitTrait')
-rwxr-xr-x | web/webqtl/submitTrait/AddUserInputToPublishPage.py | 523 | ||||
-rwxr-xr-x | web/webqtl/submitTrait/BatchSubmitPage.py | 142 | ||||
-rwxr-xr-x | web/webqtl/submitTrait/CrossChoicePage.py | 233 | ||||
-rwxr-xr-x | web/webqtl/submitTrait/VarianceChoicePage.py | 174 | ||||
-rwxr-xr-x | web/webqtl/submitTrait/__init__.py | 0 |
5 files changed, 0 insertions, 1072 deletions
diff --git a/web/webqtl/submitTrait/AddUserInputToPublishPage.py b/web/webqtl/submitTrait/AddUserInputToPublishPage.py deleted file mode 100755 index f8154266..00000000 --- a/web/webqtl/submitTrait/AddUserInputToPublishPage.py +++ /dev/null @@ -1,523 +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 - -#AddUserInputToPublishPage.py -# -#Classes: -#AddUserInputToPublishPage -#-KA - -import string -from htmlgen import HTMLgen2 as HT -import os -import time - -from base.webqtlTrait import webqtlTrait -from base.webqtlDataset import webqtlDataset -from base.templatePage import templatePage -from base import webqtlConfig -from utility import webqtlUtil - - -######################################### -# AddUserInputToPublishPage -######################################### - -class AddUserInputToPublishPage(templatePage): - - def __init__(self, fd): - - templatePage.__init__(self, fd) - - if not self.updMysql(): - return - fd.incparentsf1 = 1 - if not fd.genotype: - fd.readGenotype() - fd.strainlist = fd.f1list + fd.strainlist - fd.readData() - - if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['user']: - pass - else: - heading = "Add to Published Database" - detail = ["You don't have the permission to modify this database"] - self.error(heading=heading,detail=detail,error="Error") - return - - self.cursor.execute(""" - SelecT - PublishFreeze.Name - from - PublishFreeze, InbredSet - where - PublishFreeze.InbredSetId = InbredSet.Id AND - InbredSet.Name = '%s'""" % fd.RISet) - - try: - self.db = webqtlDataset(self.cursor.fetchone()[0], self.cursor) - except: - heading = "Add to Published Database" - detail = ["The published database you requested has not been established"] - self.error(heading=heading,detail=detail,error="Error") - return - - status = fd.formdata.getvalue('curStatus') - if status == 'insertResult': - newRecord = self.readForm(fd) - if not newRecord: - return - else: - self.insertResultPage(fd, newRecord) - elif status == 'insertCheck': - newRecord = self.readForm(fd) - if not newRecord: - return - else: - self.insertCheckPage(fd, newRecord) - else: - self.dispFormPage(fd) - - def readForm(self, fd): - newRecord = {} - for field in self.db.disfield: - fieldValue = fd.formdata.getvalue(field) - if field == 'name' or field == 'sequence': - fieldValue = None - elif (not fieldValue) and (field == 'post_publication_description' or field == 'authors' or field == 'title' or field=='year'): - heading = "Add to Published Database" - detail = ["You did not enter information for %s." % webqtlUtil.formatField(field)] - self.error(heading=heading,detail=detail,error="Error") - return {} - elif fieldValue and field == 'pubmed_id': - try: - fieldValue = int(fieldValue) - except: - fieldValue = None - else: - pass - newRecord[field] = fieldValue - return newRecord - - def insertResultPage(self, fd, newRecord): - #generate html - if 1: - - #XZ: Create new publication record if necessary - PublicationId = None - if newRecord['pubmed_id']: - self.cursor.execute('SelecT Id from Publication where PubMed_ID = %d' % newRecord['pubmed_id']) - results = self.cursor.fetchall() - if not results: - pass - else: - PublicationId = results[0][0] - - if not PublicationId: - insertFields = ['Id'] - self.cursor.execute('SelecT max(Id) from Publication') - maxId = self.cursor.fetchall()[0][0] + 1 - insertValues = [maxId] - for field in self.db.disfield: - if field in ('authors', 'title', 'abstract', 'journal','volume','pages','month','year') and newRecord[field]: - insertFields.append(field) - insertValues.append(newRecord[field]) - NFields = ['%s'] * len(insertFields) - query = "insert into Publication (%s) Values (%s)" % (string.join(insertFields, ','), string.join(NFields, ',')) - - self.cursor.execute(query, tuple(insertValues)) - PublicationId = maxId - - - #XZ: Create new phenotype - self.cursor.execute('SelecT max(Id) from Phenotype') - maxId = self.cursor.fetchall()[0][0] + 1 - PhenotypeId = maxId - if not newRecord['units']: - newRecord['units'] = "Unknown" - - insertFields = ['Id'] - insertValues = [PhenotypeId] - insertFields.append( 'Post_publication_description' ) - insertValues.append( newRecord['post_publication_description'] ) - insertFields.append( 'Units' ) - insertValues.append( newRecord['units'] ) - insertFields.append( 'Post_publication_abbreviation' ) - insertValues.append( newRecord['post_publication_abbreviation'] ) - - insertFields.append( 'Submitter' ) - insertValues.append( self.userName ) - insertFields.append( 'Authorized_Users' ) - insertValues.append( self.userName ) - - if newRecord['pre_publication_description']: - insertFields.append( 'Pre_publication_description' ) - insertValues.append( newRecord['pre_publication_description'] ) - - insertFields.append( 'Original_description' ) - original_desc_string = 'Original post publication description: ' + newRecord['post_publication_description'] - if newRecord['pre_publication_description']: - original_desc_string = original_desc_string + '\n\nOriginal pre publication description: ' + newRecord['pre_publication_description'] - insertValues.append( original_desc_string ) - - if newRecord['pre_publication_abbreviation']: - insertFields.append( 'Pre_publication_abbreviation' ) - insertValues.append( newRecord['pre_publication_abbreviation'] ) - - if newRecord['lab_code']: - insertFields.append( 'Lab_code' ) - insertValues.append( newRecord['lab_code'] ) - - if newRecord['owner']: - insertFields.append( 'Owner' ) - insertValues.append( newRecord['owner'] ) - - - NFields = ['%s'] * len(insertFields) - query = "insert into Phenotype (%s) Values (%s)" % (string.join(insertFields, ','), string.join(NFields, ',')) - self.cursor.execute(query, tuple(insertValues)) - - - - - #XZ: Insert data into PublishData, PublishSE and NStrain tables. - self.cursor.execute('SelecT max(Id) from PublishData') - DataId = self.cursor.fetchall()[0][0] + 1 - - self.db.getRISet() - InbredSetId = self.db.risetid - - self.cursor.execute('Select SpeciesId from InbredSet where Id=%s' % InbredSetId) - SpeciesId = self.cursor.fetchone()[0] - - StrainIds = [] - for item in fd.strainlist: - self.cursor.execute('Select Id from Strain where SpeciesId=%s and Name = "%s"' % (SpeciesId, item) ) - StrainId = self.cursor.fetchall() - if not StrainId: - raise ValueError - else: - StrainIds.append(StrainId[0][0]) - - for i, strainName in enumerate(fd.strainlist): - if fd.allTraitData.has_key(strainName): - tdata = fd.allTraitData[strainName] - traitVal, traitVar, traitNP = tdata.val, tdata.var, tdata.N - else: - continue - - if traitVal != None: - #print 'insert into Data values(%d, %d, %s)' % (DataId, StrainIds[i], traitVal), "<BR>" - #XZ, 03/05/2009: Xiaodong changed Data to PublishData - self.cursor.execute('insert into PublishData values(%d, %d, %s)' % (DataId, StrainIds[i], traitVal)) - if traitVar != None: - #print 'insert into SE values(%d, %d, %s)' % (DataId, StrainIds[i], traitVar), "<BR>" - #XZ, 03/13/2009: Xiaodong changed SE to PublishSE - self.cursor.execute('insert into PublishSE values(%d, %d, %s)' % (DataId, StrainIds[i], traitVar)) - if traitNP != None: - #print 'insert into NStrain values(%d, %d, %s)' % (DataId, StrainIds[i], traitNP), "<BR>" - self.cursor.execute('insert into NStrain values(%d, %d, %d)' % (DataId, StrainIds[i], traitNP)) - - - self.cursor.execute('SelecT max(Sequence) from PublishXRef where InbredSetId = %d and PhenotypeId = %d and PublicationId = %d' % (InbredSetId,PhenotypeId,PublicationId)) - Sequence = self.cursor.fetchall() - if not Sequence or not Sequence[0][0]: - Sequence = 1 - else: - Sequence = Sequence[0][0] + 1 - - self.cursor.execute('SelecT max(Id) from PublishXRef where InbredSetId = %d' % InbredSetId) - try: - InsertId = self.cursor.fetchall()[0][0] + 1 - except: - InsertId = 10001 - - ctime = time.ctime() - comments = "Inserted by %s at %s\n" % (self.userName, ctime) - #print 'insert into PublishXRef(Id, PublicationId, InbredSetId, PhenotypeId, DataId, Sequence, comments) values(%s, %s, %s, %s, %s, %s, %s)' % (InsertId , PublicationId, InbredSetId, PhenotypeId, DataId, Sequence, comments) - self.cursor.execute('insert into PublishXRef(Id, PublicationId, InbredSetId, PhenotypeId, DataId, Sequence, comments) values(%s, %s, %s, %s, %s, %s, %s)', (InsertId , PublicationId, InbredSetId, PhenotypeId, DataId, Sequence, comments)) - - TD_LR = HT.TD(valign="top",colspan=2,bgcolor="#ffffff", height=200) - form = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='showDatabase', submit=HT.Input(type='hidden')) - hddn = {'FormID':'showDatabase','ProbeSetID':'_','database':'_','CellID':'_','RISet':fd.RISet, 'incparentsf1':'on'} - for key in hddn.keys(): - form.append(HT.Input(name=key, value=hddn[key], type='hidden')) - - mainTitle = HT.Paragraph("Add Trait to Published Database", Class="title") - - info = HT.Paragraph("Your Trait has been succesfully added to ", self.db.genHTML(), ".") - - thisTrait = webqtlTrait(db=self.db, cursor=self.cursor, name=InsertId) - thisTrait.retrieveInfo() - - tbl = HT.TableLite(cellSpacing=2,cellPadding=0,width="90%",border=0) - - checkBox = HT.Input(type="checkbox",name="searchResult",value="%s" % thisTrait) - tbl.append(HT.TR(HT.TD(width=30), HT.TD(thisTrait.genHTML(dispFromDatabase=1, privilege=self.privilege, userName=self.userName, authorized_users=thisTrait.authorized_users)))) - form.append(info, HT.P(), tbl) - TD_LR.append(mainTitle, HT.Blockquote(form)) - - self.dict['body'] = TD_LR - else: - heading = "Add to Published Database" - detail = ["Error occured while adding the data."] - self.error(heading=heading,detail=detail,error="Error") - return - - def insertCheckPage(self, fd, newRecord): - #generate html - form = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), name='dataInput',submit=HT.Input(type='hidden')) - hddn = {'database':self.db.name, 'curStatus':'insertResult', 'FormID':'dataEditing', 'submitID':'addPublish', 'RISet':fd.RISet} - - recordTable = HT.TableLite(border=0, align="left") - title1 = HT.Paragraph("Trait Information:", Class="subtitle") - title2 = HT.Paragraph("Trait Data:", Class="subtitle") - recordInfoContainer = HT.Div(align="left") - recordDataContainer = HT.Div(align="left") - addButton = HT.Input(type='submit',name='submit', value='Add to Publish',Class="button") - resetButton = HT.Input(type='reset',Class="button") - - recordInfoTable = HT.TableLite(border=0, cellspacing=1, cellpadding=5, align="left") - for field in self.db.disfield: - if newRecord[field]: - recordInfoTable.append(HT.TR( - HT.TD("%s :" % webqtlUtil.formatField(field), Class="fs12 fwb ff1", valign="top",align="right"), - HT.TD(width=20),HT.TD(newRecord[field]))) - hddn[field] = newRecord[field] - - recordInfoContainer.append(addButton, resetButton, HT.P(), title1, HT.BR(), recordInfoTable) - - recordDataTable = HT.TableLite(border=0, width = "80%",cellspacing=3, cellpadding=2) - recordDataTable.append(HT.TR(HT.TD('Strain Name',Class="fs12 ffl fwb",align="left"), - HT.TD('TraitData',Class="fs12 ffl fwb",align="right"), - HT.TD('SE',Class="fs12 ffl fwb",align="right"), - HT.TD('N Per Strain',Class="fs12 ffl fwb",align="right"), - HT.TD(' '*8,Class="fs12 ffl fwb",align="center"), - HT.TD('Strain Name',Class="fs12 ffl fwb",align="left"), - HT.TD('TraitData',Class="fs12 ffl fwb",align="right"), - HT.TD('SE',Class="fs12 ffl fwb",align="right"), - HT.TD('N Per Strain',Class="fs12 ffl fwb",align="right"))) - - tempTR = HT.TR(align="Center") - for i, strainName in enumerate(fd.strainlist): - if fd.allTraitData.has_key(strainName): - tdata = fd.allTraitData[strainName] - traitVal, traitVar, traitNP = tdata.val, tdata.var, tdata.N - else: - traitVal, traitVar, traitNP = None, None, None - - if traitVal != None: - traitVal = "%2.3f" % traitVal - else: - traitVal = 'x' - if traitVar != None: - traitVar = "%2.3f" % traitVar - else: - traitVar = 'x' - if traitNP != None: - traitNP = "%d" % traitNP - else: - traitNP = 'x' - - tempTR.append(HT.TD(HT.Paragraph(strainName),align='left'), - HT.TD(traitVal,align='right'), - HT.TD(traitVar,align='right'), - HT.TD(traitNP,align='right'), - HT.TD('',align='center')) - if i % 2: - recordDataTable.append(tempTR) - tempTR = HT.TR(align="Center") - - if (i+1) % 2: - tempTR.append(HT.TD('')) - tempTR.append(HT.TD('')) - recordDataTable.append(tempTR) - - info = HT.Paragraph("Please review the trait information and data in the text below. Check the values for errors. If no error is found, please click the \"Add to Publish\" button to submit it.") - recordDataContainer.append(title2, HT.BR(), info, HT.P(), recordDataTable, HT.P(), addButton, resetButton, HT.P()) - - recordTable.append(HT.TR(HT.TD(recordInfoContainer)), HT.TR(HT.TD(recordDataContainer))) - - webqtlUtil.exportData(hddn, fd.allTraitData, 1) - for key in hddn.keys(): - form.append(HT.Input(name=key, value=hddn[key], type='hidden')) - - - ############################# - TD_LR = HT.TD(valign="top",colspan=2,bgcolor="#ffffff") - - mainTitle = HT.Paragraph("Add Trait to Published Database", Class="title") - - form.append(recordTable) - - TD_LR.append(mainTitle, HT.Blockquote(form)) - - self.dict['body'] = TD_LR - - def dispFormPage(self, fd): - ###specical care, temporary trait data - fullname = fd.formdata.getvalue('fullname') - if fullname: - thisTrait = webqtlTrait(fullname=fullname, data= fd.allTraitData, cursor=self.cursor) - thisTrait.retrieveInfo() - PhenotypeValue = thisTrait.description - else: - thisTrait = webqtlTrait(data= fd.allTraitData) - PhenotypeValue = thisTrait.identification - - self.dict['title'] = 'Add to Published Database' - - form = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), name='dataInput',submit=HT.Input(type='hidden')) - - recordTable = HT.TableLite(border=0, align="left") - recordInfoContainer = HT.Div(align="left") - recordDataContainer = HT.Div(align="left") - title1 = HT.Paragraph(" Trait Information:", align="left", Class="subtitle") - title2 = HT.Paragraph(" Trait Data:", align="left", Class="subtitle") - addButton = HT.Input(type='submit',name='submit', value='Submit Trait',Class="button") - resetButton = HT.Input(type='reset',Class="button") - - recordInfoTable = HT.TableLite(border=0, cellspacing=1, cellpadding=5,align="left") - for field in self.db.disfield: - fieldValue = "" - - if field == 'comments': - continue - elif field == 'name' or field == 'sequence' or field == 'original_description' or field == 'submitter' or field == 'authorized_users': - form.append(HT.Input(type="hidden",name=field,value=fieldValue)) - continue - elif field == 'post_publication_description': - inputBox = HT.Textarea(name=field, cols=60, rows=6,text=PhenotypeValue) - elif field == 'abstract' or field == 'pre_publication_description' or field == 'owner': - inputBox = HT.Textarea(name=field, cols=60, rows=6,text=fieldValue) - elif field == 'post_publication_abbreviation' or field == 'pre_publication_abbreviation': - inputBox = HT.Input(type="text",name=field,size=60, maxlength=30,value=fieldValue) - else: - inputBox = HT.Input(type="text",name=field,size=60, maxlength=255,value=fieldValue) - if field in ('post_publication_description', 'authors', 'title', 'year'): - requiredSign = HT.Span('*', Class="cr") - else: - requiredSign = '' - - recordInfoTable.append(HT.TR( - HT.TD(requiredSign, "%s :" % webqtlUtil.formatField(field), Class="fs12 fwb ff1", valign="top",align="right"), - HT.TD(width=20),HT.TD(inputBox))) - - if field == 'pubmed_id': - recordInfoTable.append(HT.TR( - HT.TD(), HT.TD(width=20), - HT.TD("Do not enter PubMed_ID if this trait has not been Published.", - HT.BR(), "If the PubMed_ID you entered is alreday stored in our database, ", - HT.BR(), "all the following fields except Post Publication Description will be ignored.", - HT.BR(), "Do not enter any non-digit character in this field.", Class="fs11 cr") - )) - if field == 'pre_publication_description': - recordInfoTable.append(HT.TR( - HT.TD(), HT.TD(width=20), - HT.TD("If the PubMed ID is entered, the Post Publication Description will be shown to all", - HT.BR(), " users. If there is no PubMed ID, and the Pre Publication Description is entered,", - HT.BR(), "only you and authorized users can see the Post Publication Description.", Class="fs11 cr") - )) - if field == 'owner': - recordInfoTable.append(HT.TR( - HT.TD(), HT.TD(width=20), - HT.TD("Please provide detailed owner contact information including full name, title,", - HT.BR(), " institution, address, email etc", Class="fs11 cr") - )) - - recordInfoTable.append(HT.TR(HT.TD(HT.Span('*', Class="cr"), " Required field", align="center", colspan=3))) - recordInfoContainer.append(addButton, resetButton, HT.P(), title1, HT.BR(), recordInfoTable) - - recordDataTable = HT.TableLite(border=0, width = "90%",cellspacing=2, cellpadding=2) - recordDataTable.append(HT.TR(HT.TD('Strain Name',Class="fs12 ffl fwb",align="left"), - HT.TD('Trait Data',Class="fs12 ffl fwb",align="right"), - HT.TD('SE',Class="fs12 ffl fwb",align="right"), - HT.TD('N Per Strain',Class="fs12 ffl fwb",align="right"), - HT.TD(' '*8,Class="fs12 ffl fwb",align="center"), - HT.TD('Strain Name',Class="fs12 ffl fwb",align="left"), - HT.TD('Trait Data',Class="fs12 ffl fwb",align="right"), - HT.TD('SE',Class="fs12 ffl fwb",align="right"), - HT.TD('N Per Strain',Class="fs12 ffl fwb",align="right"))) - - tempTR = HT.TR(align="right") - for i, strainName in enumerate(fd.strainlist): - if thisTrait.data.has_key(strainName): - tdata = thisTrait.data[strainName] - traitVal, traitVar, traitNP = tdata.val, tdata.var, tdata.N - else: - traitVal, traitVar, traitNP = None, None, None - - if traitVal != None: - traitVal = "%2.3f" % traitVal - else: - traitVal = 'x' - if traitVar != None: - traitVar = "%2.3f" % traitVar - else: - traitVar = 'x' - if traitNP != None: - traitNP = "%d" % traitNP - else: - traitNP = 'x' - - tempTR.append(HT.TD(HT.Paragraph(strainName), width="120px", align='left'), \ - HT.TD(HT.Input(name=fd.strainlist[i], size=8, maxlength=8, value=traitVal, align="right"), width="100px", align='right'), - HT.TD(HT.Input(name='V'+fd.strainlist[i], size=8, maxlength=8, value=traitVar, align="right"), width="100px", align='right'), - HT.TD(HT.Input(name='N'+fd.strainlist[i], size=8, maxlength=8, value=traitNP, align="right"), width="120px", align='right'), - HT.TD('', align='center')) - if i % 2: - recordDataTable.append(tempTR) - tempTR = HT.TR(align="Center") - - if (i+1) % 2: - tempTR.append(HT.TD('')) - tempTR.append(HT.TD('')) - tempTR.append(HT.TD('')) - recordDataTable.append(tempTR) - - recordDataContainer.append(title2, HT.BR(), recordDataTable, HT.P(), addButton, resetButton, HT.P()) - - recordTable.append(HT.TR(HT.TD(recordInfoContainer)), HT.TR(HT.TD(recordDataContainer))) - - """ - """ - - hddn = {'database':self.db.name, 'curStatus':'insertCheck', 'FormID':'dataEditing', 'submitID':'addPublish', 'RISet':fd.RISet} - for key in hddn.keys(): - form.append(HT.Input(name=key, value=hddn[key], type='hidden')) - - - ############################# - TD_LR = HT.TD(valign="top",colspan=2,bgcolor="#ffffff") - - mainTitle = HT.Paragraph("Add Trait to Published Database", Class="title") - - form.append(recordTable) - - TD_LR.append(mainTitle, form) - - self.dict['body'] = TD_LR - diff --git a/web/webqtl/submitTrait/BatchSubmitPage.py b/web/webqtl/submitTrait/BatchSubmitPage.py deleted file mode 100755 index 1c0be1ed..00000000 --- a/web/webqtl/submitTrait/BatchSubmitPage.py +++ /dev/null @@ -1,142 +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 glob -from htmlgen import HTMLgen2 as HT -import os - -from base.templatePage import templatePage -from utility import webqtlUtil -from base import webqtlConfig - - -# XZ, 09/09/2008: From home, click "Batch Submission". -# XZ, 09/09/2008: This class generate what you see -######################################### -# BatchSubmitPage -######################################### - -class BatchSubmitPage(templatePage): - - def __init__(self, fd): - - templatePage.__init__(self, fd) - - self.dict['title'] = 'Batch Submission' - - TD_LEFT = """ - <TD vAlign=top width="40%" bgColor=#eeeeee> - <P class="title">Introduction</P> - <BLOCKQUOTE> - <P>The batch submission utility enables users to submit multiple - traits at the same time for analysis by the GeneNetwork and - WebQTL. The data will be stored on our server for no more than - 24 hours. None of the submitted data are stored or copied - elsewhere.</P> - <P>The file to be uploaded should follow correct format shown - in the <A Href="/sample.txt" class="normalsize" target="_blank"> - Sample</A>, <A Href="/sample2.txt" class="normalsize" - target="_blank">Sample2</A> text file.</P> - <P>Please follow the <A href="http://www.genenetwork.org/faq.html#Q-22" class="normalsize" target="_blank">guide</A> for naming your traits.</P> - </BLOCKQUOTE> - </TD> - """ - TD_RIGHT = HT.TD(valign="top",width="60%",bgcolor="#eeeeee") - main_title = HT.Paragraph("Batch Trait Submission Utility") - main_title.__setattr__("class","title") - - ############################# - - title1 = HT.Paragraph("1. Choose cross or RI set:") - title1.__setattr__("class","subtitle") - - STEP1 = HT.TableLite(cellSpacing=2,cellPadding=0,width="90%",border=0) - crossMenu = HT.Select(name='RISet', onChange='xchange()') - allRISets = map(lambda x: x[:-5], glob.glob1(webqtlConfig.GENODIR, '*.geno')) - allRISets.sort() - allRISets.remove("BayXSha") - allRISets.remove("ColXBur") - allRISets.remove("ColXCvi") - specMenuSub1 = HT.Optgroup(label = 'MOUSE') - specMenuSub2 = HT.Optgroup(label = 'RAT') - for item in allRISets: - if item != 'HXBBXH': - specMenuSub1.append(tuple([item,item])) - else: - specMenuSub2.append(tuple(['HXB/BXH', 'HXBBXH'])) - crossMenu.append(specMenuSub1) - crossMenu.append(specMenuSub2) - crossMenu.selected.append('BXD') - crossMenuText = HT.Paragraph('Select the cross or recombinant inbred \ - set from the menu below. ') - infoButton = HT.Input(type="button",Class="button",value="Info",\ - onClick="crossinfo2();") - # NL, 07/27/2010. variable 'IMGSTEP1' has been moved from templatePage.py to webqtlUtil.py; - TD1 = HT.TD(webqtlUtil.IMGSTEP1,width=58) - TD2 = HT.TD() - TD2.append(crossMenuText,crossMenu, infoButton) - STEP1.append(HT.TR(TD1,TD2),HT.TR(HT.TD(colspan=2,height=20))) - - ############################# - title2 = HT.Paragraph(" 2. Enter Trait Data:") - title2.__setattr__("class","subtitle") - - STEP2 = HT.TableLite(cellSpacing=2,cellPadding=0,width="90%",border=0) - Para1 = HT.Paragraph() - Para1.append('You can submit traits by entering a file name here. The \ - file should contain a number of no more than 100 traits. The file \ - should follow the file format described in this ', HT.Href(url=\ - "/sample.txt",Class="normalsize", target="_blank", \ - text= 'Sample'), ' text.') - - filebox = HT.Paragraph(HT.Input(type='file', name='batchdatafile', size=20)) - - # NL, 07/27/2010. variable 'IMGSTEP2' has been moved from templatePage.py to webqtlUtil.py; - TD1 = HT.TD(webqtlUtil.IMGSTEP2,width=58) - TD2 = HT.TD() - TD2.append(Para1,filebox) - STEP2.append(HT.TR(TD1,TD2),HT.TR(HT.TD(colspan=2,height=20))) - - ######################################### - hddn = {'FormID':'batSubmitResult'} - - form = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), \ - enctype='multipart/form-data', name='crossChoice', submit=HT.Input(type='hidden')) - - submit = HT.Input(type='button' ,name='next', value='Next',onClick=\ - 'batchSelection(this.form);',Class="button") - reset = HT.Input(type='reset' ,name='reset' ,value='Reset',Class="button") - # NL, 07/27/2010. variable 'IMGNEXT' has been moved from templatePage.py to webqtlUtil.py; - form.append(HT.Blockquote(title1,HT.Center(STEP1,webqtlUtil.IMGNEXT),title2,\ - HT.Center(STEP2,webqtlUtil.IMGNEXT)),HT.Center(HT.P(),submit,reset)) - - for key in hddn.keys(): - form.append(HT.Input(name=key, value=hddn[key], type='hidden')) - - TD_RIGHT.append(main_title,form) - - self.dict['body'] = TD_LEFT + str(TD_RIGHT) - diff --git a/web/webqtl/submitTrait/CrossChoicePage.py b/web/webqtl/submitTrait/CrossChoicePage.py deleted file mode 100755 index fd919e5b..00000000 --- a/web/webqtl/submitTrait/CrossChoicePage.py +++ /dev/null @@ -1,233 +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 glob -from htmlgen import HTMLgen2 as HT -import os - -from base.templatePage import templatePage -from utility import webqtlUtil -from base import webqtlConfig - -# XZ, 08/28/2008: From home, click "Enter Trait Data". -# XZ, 08/28/2008: This class generate what you see -######################################### -# CrossChoicePage -######################################### - -class CrossChoicePage(templatePage): - - def __init__(self, fd): - - templatePage.__init__(self, fd) - - self.dict['title'] = 'Trait Submission' - - if not self.openMysql(): - return - - authorized = 0 - if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['user']: - authorized = 1 - - TD_LEFT = """ - <TD vAlign=top width="45%" bgColor=#eeeeee> - <P class="title">Introduction</P> - <BLOCKQUOTE> - <P>The trait values that you enter are statistically compared - with verified genotypes collected at a set of microsatellite - markers in each RI set. The markers are drawn from a set of - over 750, but for each set redundant markers have been removed, - preferentially retaining those that are most informative. </P> - - <P>These error-checked RI mapping data match theoretical - expectations for RI strain sets. The cumulative adjusted length - of the RI maps are approximately 1400 cM, a value that matches - those of both MIT maps and Chromosome Committee Report maps. - See our <a Href="http://www.nervenet.org/papers/BXN.html" - class="normalsize"> full description</a> of the genetic data - collected as part of the WebQTL project. </P> - - </BLOCKQUOTE> - <P class="title">About Your Data</P> - <BLOCKQUOTE> - <P>You can open a separate <a Href="RIsample.html" target="_blank" - class="normalsize"> window </a> giving the number of strains - for each data set and sample data. </P> - <P>None of your submitted data is copied or stored by this - system except during the actual processing of your submission. - By the time the reply page displays in your browser, your - submission has been cleared from this system. </P> - </BLOCKQUOTE> - </TD> - """ - TD_RIGHT = HT.TD(valign="top",width="55%",bgcolor="#eeeeee") - main_title = HT.Paragraph(" Trait Submission Form") - main_title.__setattr__("class","title") - - ############################# - - title1 = HT.Paragraph(" 1. Choose cross or RI set:") - title1.__setattr__("class","subtitle") - - STEP1 = HT.TableLite(cellSpacing=2,cellPadding=0,width="90%",border=0) - crossMenu = HT.Select(name='RISet', onChange='xchange()') - allRISets = map(lambda x: x[:-5], glob.glob1(webqtlConfig.GENODIR, '*.geno')) - allRISets.sort() - if authorized: - self.cursor.execute("select Name from InbredSet") - else: - self.cursor.execute("select Name from InbredSet where public > %d" % webqtlConfig.PUBLICTHRESH) - results = map(lambda X:X[0], self.cursor.fetchall()) - allRISets = filter(lambda X:X in results, allRISets) - - specMenuSub1 = HT.Optgroup(label = 'MOUSE') - specMenuSub2 = HT.Optgroup(label = 'RAT') - specMenuSub3 = HT.Optgroup(label = 'ARABIDOPSIS') - specMenuSub4 = HT.Optgroup(label = 'BARLEY') - for item in allRISets: - if item == 'HXBBXH': - specMenuSub2.append(('HXB/BXH', 'HXBBXH')) - elif item in ('BayXSha', 'ColXCvi', 'ColXBur'): - specMenuSub3.append((item, item)) - elif item in ('SXM'): - specMenuSub4.append((item, item)) - elif item == 'AXBXA': - specMenuSub1.append(('AXB/BXA', 'AXBXA')) - else: - specMenuSub1.append(tuple([item,item])) - crossMenu.append(specMenuSub1) - crossMenu.append(specMenuSub2) - crossMenu.append(specMenuSub3) - crossMenu.append(specMenuSub4) - crossMenu.selected.append('BXD') - crossMenuText = HT.Paragraph('Select the cross or recombinant inbred \ - set from the menu below. If you wish, paste data or select a data \ - file in the next sections') - infoButton = HT.Input(type="button",Class="button",value="Info",\ - onClick="crossinfo2();") - # NL, 07/27/2010. variable 'IMGSTEP1' has been moved from templatePage.py to webqtlUtil.py; - TD1 = HT.TD(webqtlUtil.IMGSTEP1,width=58) - TD2 = HT.TD() - TD2.append(crossMenuText,crossMenu, infoButton) - STEP1.append(HT.TR(TD1,TD2),HT.TR(HT.TD(colspan=2,height=20))) - - ############################# - title2 = HT.Paragraph(" 2. Enter Trait Data:") - title2.__setattr__("class","subtitle") - - STEP2 = HT.TableLite(cellSpacing=2,cellPadding=0,width="90%",border=0) - Para1 = HT.Paragraph() - Para1.append(HT.Strong("From a File: ")) - Para1.append('You can enter data by entering a file name here. The file\ - should contain a series of numbers representing trait values. The \ - values can be on one line separated by spaces or tabs, or they can \ - be on separate lines. Include one value for each progeny individual\ - or recombinant inbred line. Represent missing values with a \ - non-numeric character such as "x". If you have chosen a recombinant\ - inbred set, when you submit your data will be displayed in a form \ - where you can confirm and/or edit them. If you enter a file name \ - here, any data that you paste into the next section will be ignored.') - - filebox = HT.Paragraph(HT.Input(type='file', name='traitfile', size=20)) - - OR = HT.Paragraph(HT.Center(HT.Font(HT.Strong('OR'),color="red"))) - - Para2 = HT.Paragraph() - Para2.append(HT.Strong("By Pasting or Typing Multiple Values:")) - Para2.append('You can enter data by pasting a series of numbers \ - representing trait values into this area. The values can be on one\ - line separated by spaces or tabs, or they can be on separate lines.\ - Include one value for each progeny individual or recombinant inbred\ - line. Represent missing values with a non-numeric character such \ - as "x". If you have chosen a recombinant inbred set, when you submit\ - your data will be displayed in a form where you can confirm and/or\ - edit them. If you enter a file name in the previous section, any \ - data that you paste here will be ignored. Check ', - HT.Href(url="/RIsample.html", text="sample data", target="_blank", Class="normalsize"), - ' for the correct format.') - - pastebox = HT.Paragraph(HT.Textarea(name='traitpaste', cols=45, rows=6)) - # NL, 07/27/2010. variable 'IMGSTEP2' has been moved from templatePage.py to webqtlUtil.py; - TD1 = HT.TD(webqtlUtil.IMGSTEP2,width=58) - TD2 = HT.TD() - TD2.append(Para1,filebox,OR,Para2,pastebox) - STEP2.append(HT.TR(TD1,TD2),HT.TR(HT.TD(colspan=2,height=20))) - - ############################# - title3 = HT.Paragraph(" 3. Options:") - title3.__setattr__("class","subtitle") - - STEP3 = HT.TableLite(cellSpacing=2,cellPadding=0,width="90%",border=0) - - ######## - opt1 = HT.Paragraph(HT.Strong('Enable Use of Trait Variance: ')) - opt1.append(HT.Input(type='checkbox', Class='checkbox', name=\ - 'enablevariance', value='ON', onClick='xchange()')) - opt1.append(HT.BR(),'You may use your trait variance data in WebQTL,\ - if you check this box, you will be asked to submit your trait \ - variance data later') - - ######## - opt2 = HT.Paragraph(HT.Strong('Enable Use of Parents/F1: ')) - opt2.append(HT.Input(type='checkbox', name='parentsf1', value='ON')) - opt2.append(HT.BR(),'Check this box if you wish to use Parents and F1 \ - data in WebQTL') - - ######## - opt3 = HT.Paragraph(HT.Strong("Name Your Trait ",HT.Font("(optional) ",\ - color="red"))) - opt3.append(HT.Input(name='identification', size=12, maxlength=30)) - # NL, 07/27/2010. variable 'IMGSTEP3' has been moved from templatePage.py to webqtlUtil.py; - TD1 = HT.TD(webqtlUtil.IMGSTEP3,width=58) - TD2 = HT.TD() - TD2.append(opt1,opt3) - STEP3.append(HT.TR(TD1,TD2),HT.TR(HT.TD(colspan=2,height=20))) - - ######################################### - hddn = {'FormID':'crossChoice','submitID':'next', 'incparentsf1':'yes'} - - form = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), \ - enctype= 'multipart/form-data', name='crossChoice', submit=\ - HT.Input(type='hidden')) - - submit = HT.Input(type='button' ,name='next', value='Next',onClick=\ - 'showNext(this.form);', Class="button") - reset = HT.Input(type='reset' ,name='reset' ,value='Reset',Class="button") - - sample = HT.Input(type='button' ,name='sample' ,value='Sample Data', \ - onClick='showSample(this.form);',Class="button") - # NL, 07/27/2010. variable 'IMGNEXT' has been moved from templatePage.py to webqtlUtil.py; - form.append(title1,HT.Center(STEP1,webqtlUtil.IMGNEXT),title2,HT.Center(STEP2,\ - webqtlUtil.IMGNEXT),title3,HT.Center(STEP3,webqtlUtil.IMGNEXT,HT.P(),submit,reset,sample)) - - for key in hddn.keys(): - form.append(HT.Input(name=key, value=hddn[key], type='hidden')) - - TD_RIGHT.append(main_title,form) - self.dict['body'] = TD_LEFT + str(TD_RIGHT) - - diff --git a/web/webqtl/submitTrait/VarianceChoicePage.py b/web/webqtl/submitTrait/VarianceChoicePage.py deleted file mode 100755 index bdbc47f9..00000000 --- a/web/webqtl/submitTrait/VarianceChoicePage.py +++ /dev/null @@ -1,174 +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 htmlgen import HTMLgen2 as HT -import os - -from base.templatePage import templatePage -from utility import webqtlUtil -from base import webqtlConfig - - -# XZ, 09/09/2008: From home, click "Enter Trait Data". -# XZ, 09/09/2008: If user check "Enable Use of Trait Variance", -# XZ, 09/09/2008: this class generate what you see -######################################### -# VarianceChoicePage -######################################### - -class VarianceChoicePage(templatePage): - - def __init__(self, fd): - - templatePage.__init__(self, fd) - - self.dict['title'] = 'Variance Submission' - - if not fd.genotype: - fd.readData(incf1=1) - - TD_LEFT = """ - <TD vAlign=top width="45%" bgColor=#eeeeee> - <P class="title">Introduction</P> - <BLOCKQUOTE> - <P>The variance values that you enter are statistically compared\ - with verified genotypes collected at a set of microsatellite \ - markers in each RI set. The markers are drawn from a set of \ - over 750, but for each set redundant markers have been removed,\ - preferentially retaining those that are most informative. </P> - - <P>These error-checked RI mapping data match theoretical \ - expectations for RI strain sets. The cumulative adjusted length\ - of the RI maps are approximately 1400 cM, a value that matches\ - those of both MIT maps and Chromosome Committee Report maps. \ - See our <a Href="http://www.nervenet.org/papers/BXN.html" \ - class="normalsize">full description</a> of the genetic data \ - collected as part of the WebQTL project. </P> - - </BLOCKQUOTE> - <P class="title">About Your Data</P> - <BLOCKQUOTE> - <P>You can open a separate <a target="_blank" Href=\ - "RIsample.html" class="normalsize">window</a> giving the number\ - of strains for each data set and sample data. </P> - - <P>None of your submitted data is copied or stored by this \ - system except during the actual processing of your submission. \ - By the time the reply page displays in your browser, your \ - submission has been cleared from this system. </P> - </BLOCKQUOTE> - </TD> - """ - TD_RIGHT = HT.TD(valign="top",width="55%",bgcolor="#eeeeee") - main_title = HT.Paragraph(" Variance Submission Form") - main_title.__setattr__("class","title") - - ############################# - title2 = HT.Paragraph(" 1. Enter variance Data:") - title2.__setattr__("class","subtitle") - - STEP2 = HT.TableLite(cellSpacing=2,cellPadding=0,width="90%",border=0) - Para1 = HT.Paragraph() - Para1.append(HT.Strong("From a File: ")) - Para1.append('You can enter data by entering a file name here. The file\ - should contain a series of numbers representing variance values. The \ - values can be on one line separated by spaces or tabs, or they can be \ - on separate lines. Include one value for each progeny individual or \ - recombinant inbred line. Represent missing values with a non-numeric \ - character such as "x". If you have chosen a recombinant inbred set, \ - when you submit your data will be displayed in a form where you can \ - confirm and/or edit them. If you enter a file name here, any data \ - that you paste into the next section will be ignored.') - - filebox = HT.Paragraph(HT.Input(type='file', name='variancefile', size=20)) - - OR = HT.Paragraph(HT.Center(HT.Font(HT.Strong('OR'),color="red"))) - - Para2 = HT.Paragraph() - Para2.append(HT.Strong("By Pasting or Typing Multiple Values:")) - Para2.append('You can enter data by pasting a series of numbers \ - representing variance values into this area. The values can be on one \ - line separated by spaces or tabs, or they can be on separate lines. \ - Include one value for each progeny individual or recombinant inbred \ - line. Represent missing values with a non-numeric character such as \ - "x". If you have chosen a recombinant inbred set, when you submit \ - your data will be displayed in a form where you can confirm and/or \ - edit them. If you enter a file name in the previous section, any data\ - that you paste here will be ignored.') - - pastebox = HT.Paragraph(HT.Textarea(name='variancepaste', cols=45, rows=6)) - # NL, 07/27/2010. variable 'IMGSTEP1' has been moved from templatePage.py to webqtlUtil.py; - TD1 = HT.TD(webqtlUtil.IMGSTEP1,width=58) - TD2 = HT.TD() - TD2.append(Para1,filebox,OR,Para2,pastebox) - STEP2.append(HT.TR(TD1,TD2),HT.TR(HT.TD(colspan=2,height=20))) - ######################################### - - hddn = {'FormID':'varianceChoice','submitID':'next','RISet':fd.RISet} - if fd.identification: - hddn['identification'] = fd.identification - if fd.enablevariance: - hddn['enablevariance']='ON' - - if fd.incparentsf1: - hddn['incparentsf1']='ON' - - for item, value in fd.allTraitData.items(): - if value.val: - hddn[item] = value.val - - form = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), \ - enctype='multipart/form-data', name='crossChoice', submit=HT.Input(type=\ - 'hidden')) - - submit = HT.Input(type='button' ,name='next', value='Next',onClick=\ - 'showNext(this.form);',Class="button") - reset = HT.Input(type='reset' ,name='reset' ,value='Reset',Class="button") - - ######################################### - title3 = HT.Paragraph(" 2. Submit:") - title3.__setattr__("class","subtitle") - - STEP3 = HT.TableLite(cellSpacing=2,cellPadding=0,width="90%",border=0) - - # NL, 07/27/2010. variable 'IMGSTEP2' has been moved from templatePage.py to webqtlUtil.py; - TD1 = HT.TD(webqtlUtil.IMGSTEP2,width=58) - TD2 = HT.TD() - TD2.append(HT.Blockquote("Click the next button to submit your variance\ - data for editing and mapping."),HT.Center(submit,reset)) - STEP3.append(HT.TR(TD1,TD2),HT.TR(HT.TD(colspan=2,height=20))) - - ######################################### - - # NL, 07/27/2010. variable 'IMGNEXT' has been moved from templatePage.py to webqtlUtil.py; - form.append(title2,HT.Center(STEP2,webqtlUtil.IMGNEXT),title3,HT.Center(STEP3)) - - for key in hddn.keys(): - form.append(HT.Input(name=key, value=hddn[key], type='hidden')) - - TD_RIGHT.append(main_title,form) - - self.dict['body'] = TD_LEFT + str(TD_RIGHT) diff --git a/web/webqtl/submitTrait/__init__.py b/web/webqtl/submitTrait/__init__.py deleted file mode 100755 index e69de29b..00000000 --- a/web/webqtl/submitTrait/__init__.py +++ /dev/null |