aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/base/data_set.py5
-rwxr-xr-xwqflask/base/webqtlFormData.py26
-rwxr-xr-xwqflask/base/webqtlTrait.py146
-rwxr-xr-xwqflask/dbFunction/webqtlDatabaseFunction.py4
-rw-r--r--wqflask/wqflask/do_search.py237
-rw-r--r--wqflask/wqflask/search_results.py18
-rwxr-xr-xwqflask/wqflask/show_trait/show_trait.py83
-rw-r--r--wqflask/wqflask/templates/index_page.html4
-rw-r--r--wqflask/wqflask/templates/search_result_page.html2
-rw-r--r--wqflask/wqflask/views.py3
10 files changed, 241 insertions, 287 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index d9d3a52b..633f7545 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -392,8 +392,9 @@ class MrnaAssayDataSet(DataSet):
if len(description_display) > 1 and description_display != 'N/A' and len(target_string) > 1 and target_string != 'None':
description_display = description_display + '; ' + target_string.strip()
- # Save it for the jinja2 tablet
+ # Save it for the jinja2 template
this_trait.description_display = description_display
+ #print(" xxxxdd [%s]: %s" % (type(this_trait.description_display), description_display))
#XZ: trait_location_value is used for sorting
trait_location_repr = 'N/A'
@@ -418,7 +419,7 @@ class MrnaAssayDataSet(DataSet):
where ProbeSetXRef.ProbeSetFreezeId = %s and
ProbeSet.Id = ProbeSetXRef.ProbeSetId and
ProbeSet.Name = '%s'
- """ % (self.db_conn.escape_string(str(this_trait.db.id)),
+ """ % (self.db_conn.escape_string(str(this_trait.dataset.id)),
self.db_conn.escape_string(this_trait.name)))
print("query is:", pf(query))
diff --git a/wqflask/base/webqtlFormData.py b/wqflask/base/webqtlFormData.py
index ff1db0e8..a3537c87 100755
--- a/wqflask/base/webqtlFormData.py
+++ b/wqflask/base/webqtlFormData.py
@@ -47,7 +47,7 @@ from utility import webqtlUtil
class webqtlFormData(object):
'Represents data from a WebQTL form page, needed to generate the next page'
- attrs = ('formID','RISet','genotype','samplelist','allsamplelist', 'display_variance'
+ attrs = ('formID','group','genotype','samplelist','allsamplelist', 'display_variance'
'suggestive','significance','submitID','identification', 'enablevariance',
'nperm','nboot','email','incparentsf1','genotype_1','genotype_2','traitInfo')
@@ -104,11 +104,11 @@ class webqtlFormData(object):
self.ppolar = None
self.mpolar = None
- print("[yellow] self.RISet is:", self.RISet)
- if self.RISet:
+ print("[yellow] self.group is:", self.group)
+ if self.group:
#try:
# # NL, 07/27/2010. ParInfo has been moved from webqtlForm.py to webqtlUtil.py;
- _f1, _f12, self.mpolar, self.ppolar = webqtlUtil.ParInfo[self.RISet]
+ _f1, _f12, self.mpolar, self.ppolar = webqtlUtil.ParInfo[self.group]
#except:
# f1 = f12 = self.mpolar = self.ppolar = None
@@ -129,8 +129,8 @@ class webqtlFormData(object):
#self.readGenotype()
#self.readData()
- if self.RISet == 'BXD300':
- self.RISet = 'BXD'
+ if self.group == 'BXD300':
+ self.group = 'BXD'
def __getitem__(self, key):
@@ -153,17 +153,17 @@ class webqtlFormData(object):
def readGenotype(self):
'''read genotype from .geno file'''
- if self.RISet == 'BXD300':
- self.RISet = 'BXD'
+ if self.group == 'BXD300':
+ self.group = 'BXD'
- assert self.RISet, "self.RISet needs to be set"
+ assert self.group, "self.group needs to be set"
#genotype_1 is Dataset Object without parents and f1
#genotype_2 is Dataset Object with parents and f1 (not for intercross)
self.genotype_1 = reaper.Dataset()
- full_filename = os.path.join(webqtlConfig.GENODIR, self.RISet + '.geno')
+ full_filename = os.path.join(webqtlConfig.GENODIR, self.group + '.geno')
# reaper barfs on unicode filenames, so here we ensure it's a string
full_filename = str(full_filename)
@@ -173,12 +173,12 @@ class webqtlFormData(object):
try:
# NL, 07/27/2010. ParInfo has been moved from webqtlForm.py to webqtlUtil.py;
- _f1, _f12, _mat, _pat = webqtlUtil.ParInfo[self.RISet]
+ _f1, _f12, _mat, _pat = webqtlUtil.ParInfo[self.group]
except KeyError:
_f1 = _f12 = _mat = _pat = None
self.genotype_2 = self.genotype_1
- if self.genotype_1.type == "riset" and _mat and _pat:
+ if self.genotype_1.type == "group" and _mat and _pat:
self.genotype_2 = self.genotype_1.add(Mat=_mat, Pat=_pat) #, F1=_f1)
#determine default genotype object
@@ -333,7 +333,7 @@ class webqtlFormData(object):
def Sample(self):
'Create some dummy data for testing'
- self.RISet = 'BXD'
+ self.group = 'BXD'
self.incparentsf1 = 'on'
#self.display = 9.2
#self.significance = 16.1
diff --git a/wqflask/base/webqtlTrait.py b/wqflask/base/webqtlTrait.py
index 29087721..cc0e2321 100755
--- a/wqflask/base/webqtlTrait.py
+++ b/wqflask/base/webqtlTrait.py
@@ -24,11 +24,11 @@ class webqtlTrait:
print("in webqtlTrait")
self.db_conn = db_conn
self.cursor = self.db_conn.cursor()
- self.db = None # database object
+ self.dataset = None # database object
self.name = '' # Trait ID, ProbeSet ID, Published ID, etc.
self.cellid = ''
self.identification = 'un-named trait'
- self.riset = ''
+ self.group = ''
self.haveinfo = 0
self.sequence = '' # Blat sequence, available for ProbeSet
self.data = {}
@@ -41,22 +41,22 @@ class webqtlTrait:
elif name == 'fullname':
name2 = value.split("::")
if len(name2) == 2:
- self.db, self.name = name2
+ self.dataset, self.name = name2
elif len(name2) == 3:
- self.db, self.name, self.cellid = name2
+ self.dataset, self.name, self.cellid = name2
else:
raise KeyError, repr(value) + ' parameter format error.'
else:
raise KeyError, repr(name) + ' not a valid parameter for this class.'
- if self.db and isinstance(self.db, basestring):
+ if self.dataset and isinstance(self.dataset, basestring):
assert self.cursor, "Don't have a cursor"
- self.db = create_dataset(self.db_conn, self.db)
+ self.dataset = create_dataset(self.db_conn, self.dataset)
- #if self.db == None, not from a database
- print("self.db is:", self.db, type(self.db))
- if self.db:
- if self.db.type == "Temp":
+ #if self.dataset == None, not from a database
+ print("self.dataset is:", self.dataset, type(self.dataset))
+ if self.dataset:
+ if self.dataset.type == "Temp":
self.cursor.execute('''
SELECT
InbredSet.Name
@@ -66,9 +66,11 @@ class webqtlTrait:
Temp.InbredSetId = InbredSet.Id AND
Temp.Name = "%s"
''', self.name)
- self.riset = self.cursor.fetchone()[0]
+ self.group = self.cursor.fetchone()[0]
else:
- self.riset = self.db.get_group()
+ self.group = self.dataset.get_group()
+
+ print("trinity, self.group is:", self.group)
#
# In ProbeSet, there are maybe several annotations match one sequence
@@ -82,8 +84,8 @@ class webqtlTrait:
# The variable self.sequence should be changed to self.BlatSeq
# It also should be changed in other places where it are used.
- if self.db:
- if self.db.type == 'ProbeSet':
+ if self.dataset:
+ if self.dataset.type == 'ProbeSet':
print("Doing ProbeSet Query")
query = '''
SELECT
@@ -95,7 +97,7 @@ class webqtlTrait:
ProbeSetFreeze.Id = ProbeSetXRef.ProbeSetFreezeId and
ProbeSet.Name = %s and
ProbeSetFreeze.Name = %s
- ''', (self.name, self.db.name)
+ ''', (self.name, self.dataset.name)
print("query is:", query)
self.cursor.execute(*query)
self.sequence = self.cursor.fetchone()[0]
@@ -104,8 +106,8 @@ class webqtlTrait:
def getName(self):
str = ""
- if self.db and self.name:
- str = "%s::%s" % (self.db, self.name)
+ if self.dataset and self.name:
+ str = "%s::%s" % (self.dataset, self.name)
if self.cellid:
str += "::" + self.cellid
else:
@@ -124,8 +126,8 @@ class webqtlTrait:
#
def getGivenName(self):
str = self.name
- if self.db and self.name:
- if self.db.type=='Temp':
+ if self.dataset and self.name:
+ if self.dataset.type=='Temp':
self.cursor.execute('SELECT description FROM Temp WHERE Name=%s', self.name)
desc = self.cursor.fetchone()[0]
if desc.__contains__('PCA'):
@@ -137,16 +139,16 @@ class webqtlTrait:
def displayName(self):
str = ""
- if self.db and self.name:
- if self.db.type=='Temp':
+ if self.dataset and self.name:
+ if self.dataset.type=='Temp':
desc = self.description
if desc.__contains__('PCA'):
desc = desc[desc.rindex(':')+1:].strip()
else:
desc = desc[:desc.index('entered')].strip()
- str = "%s::%s" % (self.db, desc)
+ str = "%s::%s" % (self.dataset, desc)
else:
- str = "%s::%s" % (self.db, self.name)
+ str = "%s::%s" % (self.dataset, self.name)
if self.cellid:
str += "::" + self.cellid
else:
@@ -156,7 +158,7 @@ class webqtlTrait:
#def __str__(self):
- # #return "%s %s" % (self.getName(), self.riset)
+ # #return "%s %s" % (self.getName(), self.group)
# return self.getName()
#__str__ = getName
#__repr__ = __str__
@@ -207,7 +209,7 @@ class webqtlTrait:
#
def getSequence(self):
assert self.cursor
- if self.db.type == 'ProbeSet':
+ if self.dataset.type == 'ProbeSet':
self.cursor.execute('''
SELECT
ProbeSet.BlatSeq
@@ -218,7 +220,7 @@ class webqtlTrait:
ProbeSetFreeze.Id = ProbeSetXRef.ProbSetFreezeId and
ProbeSet.Name = %s
ProbeSetFreeze.Name = %s
- ''', self.name, self.db.name)
+ ''', self.name, self.dataset.name)
#self.cursor.execute(query)
results = self.fetchone()
@@ -230,9 +232,9 @@ class webqtlTrait:
if samplelist == None:
samplelist = []
- assert self.db and self.cursor
+ assert self.dataset and self.cursor
- if self.db.type == 'Temp':
+ if self.dataset.type == 'Temp':
query = '''
SELECT
Strain.Name, TempData.value, TempData.SE, TempData.NStrain, TempData.Id
@@ -246,7 +248,7 @@ class webqtlTrait:
Strain.Name
''' % self.name
#XZ, 03/02/2009: Xiaodong changed Data to PublishData, SE to PublishSE
- elif self.db.type == 'Publish':
+ elif self.dataset.type == 'Publish':
query = '''
SELECT
Strain.Name, PublishData.value, PublishSE.error, NStrain.count, PublishData.Id
@@ -263,7 +265,7 @@ class webqtlTrait:
PublishFreeze.Id = %d AND PublishData.StrainId = Strain.Id
Order BY
Strain.Name
- ''' % (self.name, self.db.id)
+ ''' % (self.name, self.dataset.id)
#XZ, 03/02/2009: Xiaodong changed Data to ProbeData, SE to ProbeSE
elif self.cellid:
@@ -287,9 +289,9 @@ class webqtlTrait:
ProbeData.StrainId = Strain.Id
Order BY
Strain.Name
- ''' % (self.cellid, self.name, self.db.name)
+ ''' % (self.cellid, self.name, self.dataset.name)
#XZ, 03/02/2009: Xiaodong added this block for ProbeSetData and ProbeSetSE
- elif self.db.type == 'ProbeSet':
+ elif self.dataset.type == 'ProbeSet':
#ProbeSet Data
query = '''
SELECT
@@ -306,7 +308,7 @@ class webqtlTrait:
ProbeSetData.StrainId = Strain.Id
Order BY
Strain.Name
- ''' % (self.name, self.db.name)
+ ''' % (self.name, self.dataset.name)
#XZ, 03/02/2009: Xiaodong changeded Data to GenoData, SE to GenoSE
else:
#Geno Data
@@ -326,7 +328,7 @@ class webqtlTrait:
GenoData.StrainId = Strain.Id
Order BY
Strain.Name
- ''' % (webqtlDatabaseFunction.retrieveSpeciesId(self.cursor, self.db.riset), self.name, self.db.name)
+ ''' % (webqtlDatabaseFunction.retrieveSpeciesId(self.cursor, self.dataset.group), self.name, self.dataset.name)
self.cursor.execute(query)
@@ -341,7 +343,7 @@ class webqtlTrait:
if not samplelist or (samplelist and name in samplelist):
#if value != None:
# num_cases = None
- # if self.db.type in ('Publish', 'Temp'):
+ # if self.dataset.type in ('Publish', 'Temp'):
# ndata = item[3]
name = item[0]
self.data[name] = webqtlCaseData(*item) #name, value, variance, num_cases)
@@ -352,7 +354,7 @@ class webqtlTrait:
# if val != None:
# var = item[2]
# ndata = None
- # if self.db.type in ('Publish', 'Temp'):
+ # if self.dataset.type in ('Publish', 'Temp'):
# ndata = item[3]
# self.data[item[0]] = webqtlCaseData(val, var, ndata)
# #end for
@@ -370,9 +372,9 @@ class webqtlTrait:
# return self.__dict__.items()
def retrieveInfo(self, QTL = None):
- assert self.db and self.cursor
- if self.db.type == 'Publish':
- #self.db.DisField = ['Name','PubMed_ID','Phenotype','Abbreviation','Authors','Title',\
+ assert self.dataset and self.cursor
+ if self.dataset.type == 'Publish':
+ #self.dataset.DisField = ['Name','PubMed_ID','Phenotype','Abbreviation','Authors','Title',\
# 'Abstract', 'Journal','Volume','Pages','Month','Year','Sequence',\
# 'Units', 'comments']
query = '''
@@ -393,11 +395,11 @@ class webqtlTrait:
Publication.Id = PublishXRef.PublicationId AND
PublishXRef.InbredSetId = PublishFreeze.InbredSetId AND
PublishFreeze.Id =%s
- ''' % (self.name, self.db.id)
+ ''' % (self.name, self.dataset.id)
#XZ, 05/08/2009: Xiaodong add this block to use ProbeSet.Id to find the probeset instead of just using ProbeSet.Name
#XZ, 05/08/2009: to avoid the problem of same probeset name from different platforms.
- elif self.db.type == 'ProbeSet':
- display_fields_string = ',ProbeSet.'.join(self.db.display_fields)
+ elif self.dataset.type == 'ProbeSet':
+ display_fields_string = ',ProbeSet.'.join(self.dataset.display_fields)
display_fields_string = 'ProbeSet.' + display_fields_string
query = """
SELECT %s
@@ -407,11 +409,11 @@ class webqtlTrait:
ProbeSetXRef.ProbeSetId = ProbeSet.Id AND
ProbeSetFreeze.Name = '%s' AND
ProbeSet.Name = '%s'
- """ % (display_fields_string, self.db.name, self.name)
+ """ % (display_fields_string, self.dataset.name, self.name)
#XZ, 05/08/2009: We also should use Geno.Id to find marker instead of just using Geno.Name
# to avoid the problem of same marker name from different species.
- elif self.db.type == 'Geno':
- display_fields_string = string.join(self.db.display_fields,',Geno.')
+ elif self.dataset.type == 'Geno':
+ display_fields_string = string.join(self.dataset.display_fields,',Geno.')
display_fields_string = 'Geno.' + display_fields_string
query = """
SELECT %s
@@ -421,10 +423,10 @@ class webqtlTrait:
GenoXRef.GenoId = Geno.Id AND
GenoFreeze.Name = '%s' AND
Geno.Name = '%s'
- """ % (display_fields_string, self.db.name, self.name)
+ """ % (display_fields_string, self.dataset.name, self.name)
else: #Temp type
query = 'SELECT %s FROM %s WHERE Name = "%s"' % \
- (string.join(self.db.display_fields,','), self.db.type, self.name)
+ (string.join(self.dataset.display_fields,','), self.dataset.type, self.name)
self.cursor.execute(query)
@@ -433,16 +435,16 @@ class webqtlTrait:
self.haveinfo = 1
#XZ: assign SQL query result to trait attributes.
- for i, field in enumerate(self.db.display_fields):
+ for i, field in enumerate(self.dataset.display_fields):
setattr(self, field, traitInfo[i])
- if self.db.type == 'Publish':
+ if self.dataset.type == 'Publish':
self.confidential = 0
if self.pre_publication_description and not self.pubmed_id:
self.confidential = 1
self.homologeneid = None
- if self.db.type == 'ProbeSet' and self.riset and self.geneid:
+ if self.dataset.type == 'ProbeSet' and self.group and self.geneid:
#XZ, 05/26/2010: From time to time, this query get error message because some geneid values in database are not number.
#XZ: So I have to test if geneid is number before execute the query.
#XZ: The geneid values in database should be cleaned up.
@@ -463,7 +465,7 @@ class webqtlTrait:
InbredSet.Name = '%s' AND
InbredSet.SpeciesId = Species.Id AND
Species.TaxonomyId = Homologene.TaxonomyId
- """ % (self.geneid, self.riset)
+ """ % (self.geneid, self.group)
self.cursor.execute(query)
result = self.cursor.fetchone()
else:
@@ -473,7 +475,7 @@ class webqtlTrait:
self.homologeneid = result[0]
if QTL:
- if self.db.type == 'ProbeSet' and not self.cellid:
+ if self.dataset.type == 'ProbeSet' and not self.cellid:
query = '''
SELECT
ProbeSetXRef.Locus, ProbeSetXRef.LRS, ProbeSetXRef.pValue, ProbeSetXRef.mean
@@ -483,14 +485,14 @@ class webqtlTrait:
ProbeSetXRef.ProbeSetId = ProbeSet.Id AND
ProbeSet.Name = "%s" AND
ProbeSetXRef.ProbeSetFreezeId =%s
- ''' % (self.name, self.db.id)
+ ''' % (self.name, self.dataset.id)
self.cursor.execute(query)
traitQTL = self.cursor.fetchone()
if traitQTL:
self.locus, self.lrs, self.pvalue, self.mean = traitQTL
else:
self.locus = self.lrs = self.pvalue = self.mean = ""
- if self.db.type == 'Publish':
+ if self.dataset.type == 'Publish':
query = '''
SELECT
PublishXRef.Locus, PublishXRef.LRS
@@ -500,7 +502,7 @@ class webqtlTrait:
PublishXRef.Id = %s AND
PublishXRef.InbredSetId = PublishFreeze.InbredSetId AND
PublishFreeze.Id =%s
- ''' % (self.name, self.db.id)
+ ''' % (self.name, self.dataset.id)
self.cursor.execute(query)
traitQTL = self.cursor.fetchone()
if traitQTL:
@@ -514,7 +516,7 @@ class webqtlTrait:
if not self.haveinfo:
self.retrieveInfo()
- if self.db.type == 'Publish':
+ if self.dataset.type == 'Publish':
PubMedLink = ""
if self.pubmed_id:
PubMedLink = HT.Href(text="PubMed %d : " % self.pubmed_id,
@@ -524,10 +526,10 @@ class webqtlTrait:
if formName:
setDescription2 = HT.Href(url="javascript:showDatabase3('%s','%s','%s','')" %
- (formName, self.db.name, self.name), Class = "fs14")
+ (formName, self.dataset.name, self.name), Class = "fs14")
else:
setDescription2 = HT.Href(url="javascript:showDatabase2('%s','%s','')" %
- (self.db.name,self.name), Class = "fs14")
+ (self.dataset.name,self.name), Class = "fs14")
if self.confidential and not webqtlUtil.hasAccessToConfidentialPhenotypeTrait(privilege=privilege, userName=userName, authorized_users=authorized_users):
setDescription2.append('RecordID/%s - %s' % (self.name, self.pre_publication_description))
@@ -545,20 +547,20 @@ class webqtlTrait:
setDescription2.append(HT.Italic('%s, and colleagues' % a1))
setDescription = HT.Span(PubMedLink, setDescription2)
- elif self.db.type == 'Temp':
+ elif self.dataset.type == 'Temp':
setDescription = HT.Href(text="%s" % (self.description),url="javascript:showDatabase2\
- ('%s','%s','')" % (self.db.name,self.name), Class = "fs14")
+ ('%s','%s','')" % (self.dataset.name,self.name), Class = "fs14")
setDescription = HT.Span(setDescription)
- elif self.db.type == 'Geno': # Genome DB only available for single search
+ elif self.dataset.type == 'Geno': # Genome DB only available for single search
if formName:
setDescription = HT.Href(text="Locus %s [Chr %s @ %s Mb]" % (self.name,self.chr,\
'%2.3f' % self.mb),url="javascript:showDatabase3('%s','%s','%s','')" % \
- (formName, self.db.name, self.name), Class = "fs14")
+ (formName, self.dataset.name, self.name), Class = "fs14")
else:
setDescription = HT.Href(text="Locus %s [Chr %s @ %s Mb]" % (self.name,self.chr,\
'%2.3f' % self.mb),url="javascript:showDatabase2('%s','%s','')" % \
- (self.db.name,self.name), Class = "fs14")
+ (self.dataset.name,self.name), Class = "fs14")
setDescription = HT.Span(setDescription)
@@ -566,20 +568,20 @@ class webqtlTrait:
if self.cellid:
if formName:
setDescription = HT.Href(text="ProbeSet/%s/%s" % (self.name, self.cellid),url=\
- "javascript:showDatabase3('%s','%s','%s','%s')" % (formName, self.db.name,self.name,self.cellid), \
+ "javascript:showDatabase3('%s','%s','%s','%s')" % (formName, self.dataset.name,self.name,self.cellid), \
Class = "fs14")
else:
setDescription = HT.Href(text="ProbeSet/%s/%s" % (self.name,self.cellid),url=\
- "javascript:showDatabase2('%s','%s','%s')" % (self.db.name,self.name,self.cellid), \
+ "javascript:showDatabase2('%s','%s','%s')" % (self.dataset.name,self.name,self.cellid), \
Class = "fs14")
else:
if formName:
setDescription = HT.Href(text="ProbeSet/%s" % self.name, url=\
- "javascript:showDatabase3('%s','%s','%s','')" % (formName, self.db.name,self.name), \
+ "javascript:showDatabase3('%s','%s','%s','')" % (formName, self.dataset.name,self.name), \
Class = "fs14")
else:
setDescription = HT.Href(text="ProbeSet/%s" % self.name, url=\
- "javascript:showDatabase2('%s','%s','')" % (self.db.name,self.name), \
+ "javascript:showDatabase2('%s','%s','')" % (self.dataset.name,self.name), \
Class = "fs14")
if self.symbol and self.chr and self.mb:
setDescription.append(' [')
@@ -591,9 +593,9 @@ class webqtlTrait:
setDescription.append('; %s' % self.probe_target_description)
setDescription = HT.Span(setDescription)
- if self.db.type != 'Temp' and dispFromDatabase:
+ if self.dataset.type != 'Temp' and dispFromDatabase:
setDescription.append( ' --- FROM : ')
- setDescription.append(self.db.genHTML(Class='cori'))
+ setDescription.append(self.dataset.genHTML(Class='cori'))
return setDescription
@property
@@ -654,13 +656,13 @@ class webqtlTrait:
select ProbeFreeze.Name from ProbeFreeze, ProbeSetFreeze
where
ProbeFreeze.Id = ProbeSetFreeze.ProbeFreezeId AND
- ProbeSetFreeze.Id = %d""" % thisTrait.db.id)
+ ProbeSetFreeze.Id = %d""" % thisTrait.dataset.id)
probeDBName = self.cursor.fetchone()[0]
return dict(name = probeDBName,
url = None)
else:
- return dict(name = self.db.fullname,
- url = webqtlConfig.INFOPAGEHREF % self.db.name)
+ return dict(name = self.dataset.fullname,
+ url = webqtlConfig.INFOPAGEHREF % self.dataset.name)
def calculate_correlation(self, values, method):
"""Calculate the correlation value and p value according to the method specified"""
diff --git a/wqflask/dbFunction/webqtlDatabaseFunction.py b/wqflask/dbFunction/webqtlDatabaseFunction.py
index 8f923b8a..1e028ecc 100755
--- a/wqflask/dbFunction/webqtlDatabaseFunction.py
+++ b/wqflask/dbFunction/webqtlDatabaseFunction.py
@@ -80,9 +80,9 @@ def getAllSpecies(cursor=None):
#function: retrieve specie's name info based on RISet
###########################################################################
-def retrieveSpecies(cursor=None, RISet=None):
+def retrieveSpecies(cursor=None, group=None):
try:
- cursor.execute("select Species.Name from Species, InbredSet where InbredSet.Name = '%s' and InbredSet.SpeciesId = Species.Id" % RISet)
+ cursor.execute("select Species.Name from Species, InbredSet where InbredSet.Name = '%s' and InbredSet.SpeciesId = Species.Id" % group)
return cursor.fetchone()[0]
except:
return None
diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py
index 2b8efd68..92a754e3 100644
--- a/wqflask/wqflask/do_search.py
+++ b/wqflask/wqflask/do_search.py
@@ -20,7 +20,7 @@ class DoSearch(object):
def __init__(self, search_term, search_operator, dataset, cursor, db_conn):
self.search_term = search_term
# Make sure search_operator is something we expect
- assert search_operator in ("=", "<", ">", "<=", ">="), "Bad search operator"
+ assert search_operator in (None, "=", "<", ">", "<=", ">="), "Bad search operator"
self.search_operator = search_operator
self.dataset = dataset
self.db_conn = db_conn
@@ -41,6 +41,12 @@ class DoSearch(object):
def escape(self, stringy):
"""Shorter name than self.db_conn.escape_string"""
return self.db_conn.escape_string(str(stringy))
+
+ def mescape(self, *items):
+ """Multiple escape"""
+ escaped = [self.escape(item) for item in items]
+ print("escaped is:", escaped)
+ return tuple(escaped)
def normalize_spaces(self, stringy):
"""Strips out newlines/extra spaces and replaces them with just spaces"""
@@ -91,8 +97,7 @@ class ProbeSetSearch(DoSearch):
"""Generates and runs a simple search of an mRNA expression dataset"""
print("Running ProbeSetSearch")
- query = (self.base_query +
- """WHERE (MATCH (ProbeSet.Name,
+ query = self.base_query + """WHERE (MATCH (ProbeSet.Name,
ProbeSet.description,
ProbeSet.symbol,
alias,
@@ -102,8 +107,8 @@ class ProbeSetSearch(DoSearch):
AGAINST ('%s' IN BOOLEAN MODE))
and ProbeSet.Id = ProbeSetXRef.ProbeSetId
and ProbeSetXRef.ProbeSetFreezeId = %s
- """ % (self.escape(self.search_term),
- self.escape(self.dataset.id)))
+ """ % (self.escape(self.search_term[0]),
+ self.escape(self.dataset.id))
print("final query is:", pf(query))
@@ -275,7 +280,8 @@ class GoSearch(ProbeSetSearch):
class LrsSearch(ProbeSetSearch):
"""Searches for genes with a QTL within the given LRS values
- LRS searches can take 2 different forms:
+ LRS searches can take 3 different forms:
+ - LRS > (or <) min/max_LRS
- LRS=(min_LRS max_LRS)
- LRS=(min_LRS max_LRS chromosome start_Mb end_Mb)
where min/max_LRS represent the range of LRS scores and start/end_Mb represent
@@ -289,129 +295,128 @@ class LrsSearch(ProbeSetSearch):
self.search_term = [float(value) for value in self.search_term]
- from_clause = ", Geno"
+ self.from_clause = ", Geno"
if self.search_operator == "=":
- if len(self.search_term) >= 2:
- if len(self.search_term) == 2:
- lrs_min, lrs_max = self.search_term
- elif len(self.search_term) == 5:
- lrs_min, lrs_max, chr_num, mb_low, mb_high = self.search_term
- else:
- SomeError
-
- sub_clause = """ %sXRef.LRS > %s and
- %sXRef.LRS < %s and """ % (self.escape(self.dataset.type),
- self.escape(min(lrs_min, lrs_max)),
- self.escape(self.dataset.type),
- self.escape(max(lrs_min, lrs_max)))
-
+ assert isinstance(self.search_term, (list, tuple))
+ self.lrs_min, self.lrs_max = self.search_term[:2]
+
+ self.sub_clause = """ %sXRef.LRS > %s and
+ %sXRef.LRS < %s and """ % self.mescape(self.dataset.type,
+ min(self.lrs_min, self.lrs_max),
+ self.dataset.type,
+ max(self.lrs_min, self.lrs_max))
+
+ if len(self.search_term) > 2:
+ self.chr_num = self.search_term[2]
+ self.sub_clause += """ Geno.Chr = %s and """ % (self.escape(self.chr_num))
if len(self.search_term) == 5:
- sub_clause = sub_clause + """ Geno.Mb > %s and
+ self.mb_low, self.mb_high = self.search_term[3:]
+ self.sub_clause += """ Geno.Mb > %s and
Geno.Mb < %s and
- Geno.Chr = %s and
- """ % (self.escape(min(mb_low, mb_high)),
- self.escape(max(mb_low, mb_high)),
- self.escape(chr_num))
+ """ % self.mescape(min(self.mb_low, self.mb_high),
+ max(self.mb_low, self.mb_high))
+ print("self.sub_clause is:", pf(self.sub_clause))
else:
# Deal with >, <, >=, and <=
- sub_clause = """ %sXRef.LRS %s %s and """ % (self.escape(self.dataset.type),
- self.escape(self.search_operator),
- self.escape(self.search_term[0]))
+ self.sub_clause = """ %sXRef.LRS %s %s and """ % self.mescape(self.dataset.type,
+ self.search_operator,
+ self.search_term[0])
- where_clause = sub_clause + """ %sXRef.Locus = Geno.name and
+ self.where_clause = self.sub_clause + """ %sXRef.Locus = Geno.name and
Geno.SpeciesId = %s and
%s.Chr = Geno.Chr
- """ % (self.escape(self.dataset.type),
- self.escape(self.species_id),
- self.escape(self.dataset.type))
+ """ % self.mescape(self.dataset.type,
+ self.species_id,
+ self.dataset.type)
- print("where_clause is:", pf(where_clause))
+ print("where_clause is:", pf(self.where_clause))
- query = self.compile_final_query(from_clause, where_clause)
+ self.query = self.compile_final_query(self.from_clause, self.where_clause)
- return self.execute(query)
-
-class CisLrsSearch(LrsSearch):
- """Searches for genes on a particular chromosome with a cis-eQTL within the given LRS values
+ return self.execute(self.query)
- A cisLRS search can take 3 forms:
- - cisLRS=(min_LRS max_LRS)
- - cisLRS=(min_LRS max_LRS mb_buffer)
- - cisLRS>min_LRS
- where min/max_LRS represent the range of LRS scores and the mb_buffer is the range around
- a particular QTL where its eQTL would be considered "cis". If there is no third parameter,
- mb_buffer will default to 5 megabases.
- A QTL is a cis-eQTL if a gene's expression is regulated by a QTL in roughly the same area
- (where the area is determined by the mb_buffer that the user can choose).
+class CisTransLrsSearch(LrsSearch):
- """
-
- # This is tentatively a child of LrsSearch; I'll need to check what code, if any, overlaps
- # between this and the LrsSearch code. In the original code, commands are divided by
- # the number of inputs they take, so these commands are completely separate
-
- DoSearch.search_types['CISLRS'] = "CisLrsSearch"
-
- def run(self):
+ def real_run(self, the_operator):
#if isinstance(self.search_term, basestring):
# self.search_term = [self.search_term]
print("self.search_term is:", self.search_term)
self.search_term = [float(value) for value in self.search_term]
- mb_buffer = 5 # default
-
- from_clause = ", Geno "
-
+ self.mb_buffer = 5 # default
+ self.from_clause = ", Geno "
+
if self.search_operator == "=":
if len(self.search_term) == 2:
- lower_limit, upper_limit = self.search_term
+ self.lrs_min, self.lrs_max = self.search_term
#[int(value) for value in self.search_term]
elif len(self.search_term) == 3:
- lower_limit, upper_limit, mb_buffer = self.search_term
+ self.lrs_min, self.lrs_max, self.mb_buffer = self.search_term
else:
SomeError
- sub_clause = """ %sXRef.LRS > %s and
- %sXRef.LRS < %s and
- ABS(%s.Mb-Geno.Mb) < %s and """ % (
- self.escape(self.dataset.type),
- self.escape(min(lower_limit, upper_limit)),
+ self.sub_clause = """ %sXRef.LRS > %s and
+ %sXRef.LRS < %s and """ % (
self.escape(self.dataset.type),
- self.escape(max(lower_limit, upper_limit)),
+ self.escape(min(self.lrs_min, self.lrs_max)),
self.escape(self.dataset.type),
- self.escape(mb_buffer)
+ self.escape(max(self.lrs_min, self.lrs_max))
)
-
else:
# Deal with >, <, >=, and <=
- sub_clause = """ %sXRef.LRS %s %s and
- ABS(%s.Mb-Geno.Mb) < %s and """ % (
+ self.sub_clause = """ %sXRef.LRS %s %s and """ % (
self.escape(self.dataset.type),
self.escape(self.search_operator),
- self.escape(self.search_term[0]),
- self.escape(self.dataset.type),
- self.escape(mb_buffer)
+ self.escape(self.search_term[0])
)
-
- where_clause = sub_clause + """%sXRef.Locus = Geno.name and
+
+ self.where_clause = self.sub_clause + """
+ ABS(%s.Mb-Geno.Mb) %s %s and
+ %sXRef.Locus = Geno.name and
Geno.SpeciesId = %s and
%s.Chr = Geno.Chr""" % (
self.escape(self.dataset.type),
+ the_operator,
+ self.escape(self.mb_buffer),
+ self.escape(self.dataset.type),
self.escape(self.species_id),
self.escape(self.dataset.type)
)
- print("where_clause is:", pf(where_clause))
+ print("where_clause is:", pf(self.where_clause))
- query = self.compile_final_query(from_clause, where_clause)
+ self.query = self.compile_final_query(self.from_clause, self.where_clause)
- return self.execute(query)
+ return self.execute(self.query)
+
+
+class CisLrsSearch(CisTransLrsSearch):
+ """Searches for genes on a particular chromosome with a cis-eQTL within the given LRS values
+
+ A cisLRS search can take 3 forms:
+ - cisLRS=(min_LRS max_LRS)
+ - cisLRS=(min_LRS max_LRS mb_buffer)
+ - cisLRS>min_LRS
+ where min/max_LRS represent the range of LRS scores and the mb_buffer is the range around
+ a particular QTL where its eQTL would be considered "cis". If there is no third parameter,
+ mb_buffer will default to 5 megabases.
+
+ A QTL is a cis-eQTL if a gene's expression is regulated by a QTL in roughly the same area
+ (where the area is determined by the mb_buffer that the user can choose).
+
+ """
+
+ DoSearch.search_types['CISLRS'] = "CisLrsSearch"
+
+ def run(self):
+ return self.real_run("<")
+
-class TransLrsSearch(LrsSearch):
+class TransLrsSearch(CisTransLrsSearch):
"""Searches for genes on a particular chromosome with a cis-eQTL within the given LRS values
A transLRS search can take 2 forms:
@@ -425,70 +430,11 @@ class TransLrsSearch(LrsSearch):
(where the area is determined by the mb_buffer that the user can choose). Opposite of cis-eQTL.
"""
-
- # This is tentatively a child of LrsSearch; I'll need to check what code, if any, overlaps
- # between this and the LrsSearch code. In the original code, commands are divided by
- # the number of inputs they take, so these commands are completely separate
DoSearch.search_types['TRANSLRS'] = "TransLrsSearch"
def run(self):
- if len(self.search_term) == 3:
- lower_limit, upper_limit, min_threshold = [int(value) for value in self.search_term]
-
- where_clause = """ %sXRef.LRS > %s and
- %sXRef.LRS < %s and
- %sXRef.Locus = Geno.name and
- Geno.SpeciesId = %s and
- (%s.Chr != Geno.Chr or
- ABS(%s.Mb-Geno.Mb) > %s) """ % (
- self.dataset.type,
- min(lower_limit, upper_limit),
- self.dataset.type,
- max(lower_limit, upper_limit),
- self.dataset.type,
- self.species_id,
- self.dataset.type,
- self.dataset.type,
- min_threshold
- )
-
- else:
- NeedSomeErrorHere
-
- return None
-
-
-#itemCmd = item[0]
-#lowerLimit = float(item[1])
-#upperLimit = float(item[2])
-#
-#if itemCmd.upper() in ("TRANSLRS", "CISLRS"):
-# if item[3]:
-# mthresh = float(item[3])
-# clauseItem = " %sXRef.LRS > %2.7f and %sXRef.LRS < %2.7f " % \
-# (self.dbType, min(lowerLimit, upperLimit), self.dbType, max(lowerLimit, upperLimit))
-# if itemCmd.upper() == "CISLRS":
-# clauseItem += """ and %sXRef.Locus = Geno.name and Geno.SpeciesId = %s and %s.Chr = Geno.Chr and ABS(%s.Mb-Geno.Mb) < %2.7f """ % (self.dbType, self.speciesId, self.dbType, self.dbType, mthresh)
-# DescriptionText.append(HT.Span(' with a ', HT.U('cis-QTL'), ' having an LRS between %g and %g using a %g Mb exclusion buffer' % (min(lowerLimit, upperLimit), max(lowerLimit, upperLimit), mthresh)))
-# else:
-# clauseItem += """ and %sXRef.Locus = Geno.name and Geno.SpeciesId = %s and (%s.Chr != Geno.Chr or (%s.Chr != Geno.Chr and ABS(%s.Mb-Geno.Mb) > %2.7f)) """ % (self.dbType, self.speciesId, self.dbType, self.dbType, self.dbType, mthresh)
-# DescriptionText.append(HT.Span(' with a ', HT.U('trans-QTL'), ' having an LRS between %g and %g using a %g Mb exclusion buffer' % (min(lowerLimit, upperLimit), max(lowerLimit, upperLimit), mthresh)))
-# query.append(" (%s) " % clauseItem)
-# self.orderByDefalut = "LRS"
-# else:
-# pass
-#elif itemCmd.upper() in ("RANGE"):
-# #XZ, 03/05/2009: Xiaodong changed Data to ProbeSetData
-# clauseItem = " (select Pow(2, max(value) -min(value)) from ProbeSetData where Id = ProbeSetXRef.dataId) > %2.7f and (select Pow(2, max(value) -min(value)) from ProbeSetData where Id = ProbeSetXRef.dataId) < %2.7f " % (min(lowerLimit, upperLimit), max(lowerLimit, upperLimit))
-# query.append(" (%s) " % clauseItem)
-# DescriptionText.append(HT.Span(' with a range of expression that varied between %g and %g' % (min(lowerLimit, upperLimit), max(lowerLimit, upperLimit)), " (fold difference)"))
-#else:
-# clauseItem = " %sXRef.%s > %2.7f and %sXRef.%s < %2.7f " % \
-# (self.dbType, itemCmd, min(lowerLimit, upperLimit), self.dbType, itemCmd, max(lowerLimit, upperLimit))
-# query.append(" (%s) " % clauseItem)
-# self.orderByDefalut = itemCmd
-# DescriptionText.append(HT.Span(' with ', HT.U(itemCmd), ' between %g and %g' % (min(lowerLimit, upperLimit), max(lowerLimit, upperLimit))))
+ return self.real_run(">")
class MeanSearch(ProbeSetSearch):
@@ -508,7 +454,6 @@ if __name__ == "__main__":
import MySQLdb
import sys
-
from base import webqtlConfig
from base.data_set import create_dataset
from base.templatePage import templatePage
@@ -540,11 +485,11 @@ if __name__ == "__main__":
ProbeSetXRef.ProbeSetFreezeId = 112""")
#print(pf(cursor.fetchall()))
- #results = ProbeSetSearch("salt", dataset, cursor, db_conn).run()
+ results = ProbeSetSearch("shh", None, dataset, cursor, db_conn).run()
#results = RifSearch("diabetes", dataset, cursor, db_conn).run()
#results = WikiSearch("nicotine", dataset, cursor, db_conn).run()
- results = CisLrsSearch(['99'], '>', dataset, cursor, db_conn).run() # cisLRS > 99
- #results = LrsSearch('9', '99', '1', '50', '150', '=', dataset, cursor, db_conn).run()
+ #results = CisLrsSearch(['99'], '>', dataset, cursor, db_conn).run() # cisLRS > 99
+ #results = LrsSearch('99', '>', dataset, cursor, db_conn).run()
#results = TransLrsSearch(['9', '999', '10'], dataset, cursor, db_conn).run()
#results = PhenotypeSearch("brain", dataset, cursor, db_conn).run()
#results = GenotypeSearch("rs13475699", dataset, cursor, db_conn).run()
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index fe091f97..63e0153d 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -68,7 +68,7 @@ class SearchResultPage(templatePage):
# return
###########################################
- # Names and IDs of RISet / F2 set
+ # Names and IDs of group / F2 set
###########################################
# All Phenotypes is a special case we'll deal with later
@@ -97,23 +97,23 @@ class SearchResultPage(templatePage):
"""
self.trait_list = []
+
+ group = self.dataset.group
+ species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, group=group)
+
# result_set represents the results for each search term; a search of
# "shh grin2b" would have two sets of results, one for each term
print("self.results is:", pf(self.results))
for result in self.results:
if not result:
continue
-
- group = self.dataset.group
- species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=group)
-
+
#### Excel file needs to be generated ####
print("foo locals are:", locals())
trait_id = result[0]
- this_trait = webqtlTrait(self.db_conn, db=self.dataset, name=trait_id)
+ this_trait = webqtlTrait(self.db_conn, dataset=self.dataset, name=trait_id)
this_trait.retrieveInfo(QTL=True)
- print("this_trait is:", pf(this_trait))
self.trait_list.append(this_trait)
self.dataset.get_trait_info(self.trait_list, species)
@@ -134,6 +134,8 @@ class SearchResultPage(templatePage):
# We fall back to the dataset type as the key to get the right object
search_type = self.dataset.type
+ print("search_type is:", pf(search_type))
+
# This is throwing an error when a_search['key'] is None, so I changed above
#search_type = string.upper(a_search['key'])
#if not search_type:
@@ -146,7 +148,7 @@ class SearchResultPage(templatePage):
self.dataset,
self.cursor,
self.db_conn).run())
-
+
print("in the search results are:", self.results)
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 3dac5933..db2636bc 100755
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -35,12 +35,12 @@ class ShowTrait(templatePage):
self.fd = fd
templatePage.__init__(self, fd)
- assert self.openMysql(), "No datbase!"
+ assert self.openMysql(), "No database!"
this_trait = self.get_this_trait()
##read genotype file
- fd.RISet = this_trait.riset
+ fd.group = this_trait.group
fd.readGenotype()
if not fd.genotype:
@@ -62,7 +62,7 @@ class ShowTrait(templatePage):
# Some fields, like method, are defaulted to None; otherwise in IE the field can't be changed using jquery
hddn = OrderedDict(
FormID = fmID,
- RISet = fd.RISet,
+ group = fd.group,
submitID = '',
scale = 'physic',
additiveCheck = 'ON',
@@ -120,7 +120,7 @@ class ShowTrait(templatePage):
hddn['attribute_names'] = ""
hddn['mappingMethodId'] = webqtlDatabaseFunction.getMappingMethod (cursor=self.cursor,
- groupName=fd.RISet)
+ groupName=fd.group)
if fd.identification:
hddn['identification'] = fd.identification
@@ -159,8 +159,8 @@ class ShowTrait(templatePage):
self.hddn = hddn
self.sample_group_types = OrderedDict()
- self.sample_group_types['samples_primary'] = fd.RISet + " Only"
- self.sample_group_types['samples_other'] = "Non-" + fd.RISet
+ self.sample_group_types['samples_primary'] = fd.group + " Only"
+ self.sample_group_types['samples_other'] = "Non-" + fd.group
self.sample_group_types['samples_all'] = "All Cases"
sample_lists = [group.sample_list for group in self.sample_groups]
print("sample_lists is:", pf(sample_lists))
@@ -180,12 +180,12 @@ class ShowTrait(templatePage):
trait_id = self.fd['trait_id']
cell_id = self.fd.get('CellID')
- this_trait = webqtlTrait(db=dataset, name=trait_id, cellid=cell_id, cursor=self.cursor)
+ this_trait = webqtlTrait(self.db_conn, db=dataset, name=trait_id, cellid=cell_id)
##identification, etc.
self.fd.identification = '%s : %s' % (this_trait.db.shortname, trait_id)
this_trait.returnURL = webqtlConfig.CGIDIR + webqtlConfig.SCRIPTFILE + '?FormID=showDatabase&database=%s\
- &ProbeSetID=%s&RISet=%s&parentsf1=on' %(dataset, trait_id, self.fd['RISet'])
+ &ProbeSetID=%s&group=%s&parentsf1=on' %(dataset, trait_id, self.fd['group'])
if cell_id:
self.fd.identification = '%s/%s'%(self.fd.identification, cell_id)
@@ -198,7 +198,7 @@ class ShowTrait(templatePage):
def dispTraitInformation(self, fd, title1Body, hddn, this_trait):
- _Species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet)
+ _Species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, group=fd.group)
#tbl = HT.TableLite(cellpadding=2, Class="collap", style="margin-left:20px;", width="840", valign="top", id="target1")
@@ -245,9 +245,9 @@ class ShowTrait(templatePage):
else:
pass
- self.cursor.execute('SELECT Name FROM InbredSet WHERE Name="%s"' % fd.RISet)
+ self.cursor.execute('SELECT Name FROM InbredSet WHERE Name="%s"' % fd.group)
if this_trait:
- addSelectionButton = HT.Href(url="#redirect", onClick="addRmvSelection('%s', document.getElementsByName('%s')[0], 'addToSelection');" % (fd.RISet, 'dataInput'))
+ addSelectionButton = HT.Href(url="#redirect", onClick="addRmvSelection('%s', document.getElementsByName('%s')[0], 'addToSelection');" % (fd.group, 'dataInput'))
addSelectionButton_img = HT.Image("/images/add_icon.jpg", name="addselect", alt="Add To Collection", title="Add To Collection", style="border:none;")
#addSelectionButton.append(addSelectionButton_img)
addSelectionText = "Add"
@@ -403,8 +403,8 @@ class ShowTrait(templatePage):
probeResult = self.cursor.fetchone()
if probeResult[0] > 0:
- probeurl = "%s?FormID=showProbeInfo&database=%s&ProbeSetID=%s&CellID=%s&RISet=%s&incparentsf1=ON" \
- % (os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), this_trait.db, this_trait.name, this_trait.cellid, fd.RISet)
+ probeurl = "%s?FormID=showProbeInfo&database=%s&ProbeSetID=%s&CellID=%s&group=%s&incparentsf1=ON" \
+ % (os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), this_trait.db, this_trait.name, this_trait.cellid, fd.group)
probeButton = HT.Href(url="#", onClick="javascript:openNewWin('%s'); return false;" % probeurl)
probeButton_img = HT.Image("/images/probe_icon.jpg", name="probe", alt=" Check sequence of probes ", title=" Check sequence of probes ", style="border:none;")
#probeButton.append(probeButton_img)
@@ -430,7 +430,7 @@ class ShowTrait(templatePage):
# ))
#tSpan = HT.Span(Class="fs13")
- #tSpan.append(str(_Species).capitalize(), ", ", fd.RISet)
+ #tSpan.append(str(_Species).capitalize(), ", ", fd.group)
#
#tbl.append(HT.TR(
# HT.TD('Species and Group: ', Class="fwb fs13", valign="top", nowrap="on"),
@@ -805,6 +805,7 @@ class ShowTrait(templatePage):
#stats_row = HT.TR()
#stats_cell = HT.TD()
+ # This should still be riset here - Sam - Nov. 2012
if fd.genotype.type == "riset":
samplelist = fd.f1list + fd.samplelist
else:
@@ -839,15 +840,15 @@ class ShowTrait(templatePage):
other_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + other_samples #XZ: note that fd.f1list and fd.parlist are added.
print("ac1") # This is the one used for first sall3
self.MDP_menu.append(('All Cases','0'))
- self.MDP_menu.append(('%s Only' % fd.RISet, '1'))
- self.MDP_menu.append(('Non-%s Only' % fd.RISet, '2'))
+ self.MDP_menu.append(('%s Only' % fd.group, '1'))
+ self.MDP_menu.append(('Non-%s Only' % fd.group, '2'))
else:
if (len(other_samples) > 0) and (len(primary_samples) + len(other_samples) > 3):
print("ac2")
self.MDP_menu.append(('All Cases','0'))
- self.MDP_menu.append(('%s Only' % fd.RISet,'1'))
- self.MDP_menu.append(('Non-%s Only' % fd.RISet,'2'))
+ self.MDP_menu.append(('%s Only' % fd.group,'1'))
+ self.MDP_menu.append(('Non-%s Only' % fd.group,'2'))
all_samples = primary_samples
all_samples.sort(key=webqtlUtil.natsort_key)
all_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + all_samples
@@ -895,7 +896,7 @@ class ShowTrait(templatePage):
# for sampleNameOrig in all_samples]]
#
- #Using just the RISet sample
+ #Using just the group sample
for sampleNameOrig in primary_samples:
sampleName = sampleNameOrig.replace("_2nd_", "")
@@ -908,7 +909,7 @@ class ShowTrait(templatePage):
vals2.append(thisValFull)
- #Using all non-RISet samples only
+ #Using all non-group samples only
for sampleNameOrig in other_samples:
sampleName = sampleNameOrig.replace("_2nd_", "")
@@ -951,10 +952,10 @@ class ShowTrait(templatePage):
break
elif (i == 1 and len(primary_samples) < 4):
stats_container = HT.Div(id="stats_tabs%s" % i, Class="ui-tabs")
- #stats_container.append(HT.Div(HT.Italic("Fewer than 4 " + fd.RISet + " case data were entered. No statistical analysis has been attempted.")))
+ #stats_container.append(HT.Div(HT.Italic("Fewer than 4 " + fd.group + " case data were entered. No statistical analysis has been attempted.")))
elif (i == 2 and len(other_samples) < 4):
stats_container = HT.Div(id="stats_tabs%s" % i, Class="ui-tabs")
- stats_container.append(HT.Div(HT.Italic("Fewer than 4 non-" + fd.RISet + " case data were entered. No statistical analysis has been attempted.")))
+ stats_container.append(HT.Div(HT.Italic("Fewer than 4 non-" + fd.group + " case data were entered. No statistical analysis has been attempted.")))
#stats_script_text = """$(function() { $("#stats_tabs0").tabs(); $("#stats_tabs1").tabs(); $("#stats_tabs2").tabs();});"""
else:
continue
@@ -995,7 +996,7 @@ class ShowTrait(templatePage):
except:
plotTitle = str(this_trait.name)
- #normalplot_img = BasicStatisticsFunctions.plotNormalProbability(vals=vals, RISet=fd.RISet, title=plotTitle, specialStrains=specialStrains)
+ #normalplot_img = BasicStatisticsFunctions.plotNormalProbability(vals=vals, group=fd.group, title=plotTitle, specialStrains=specialStrains)
#normalplot.append(HT.TR(HT.TD(normalplot_img)))
#normalplot.append(HT.TR(HT.TD(HT.BR(),HT.BR(),"This plot evaluates whether data are \
#normally distributed. Different symbols represent different groups.",HT.BR(),HT.BR(),
@@ -1018,7 +1019,7 @@ class ShowTrait(templatePage):
#barName_div = HT.Div(id="statstabs-3")
#barName_container = HT.Paragraph()
#barName = HT.TableLite(cellspacing=0, cellpadding=0, width="100%")
- #barName_img = BasicStatisticsFunctions.plotBarGraph(identification=fd.identification, RISet=fd.RISet, vals=vals, type="name")
+ #barName_img = BasicStatisticsFunctions.plotBarGraph(identification=fd.identification, group=fd.group, vals=vals, type="name")
#barName.append(HT.TR(HT.TD(barName_img)))
#barName_container.append(barName)
#barName_div.append(barName_container)
@@ -1027,7 +1028,7 @@ class ShowTrait(templatePage):
#barRank_div = HT.Div(id="statstabs-4")
#barRank_container = HT.Paragraph()
#barRank = HT.TableLite(cellspacing=0, cellpadding=0, width="100%")
- #barRank_img = BasicStatisticsFunctions.plotBarGraph(identification=fd.identification, RISet=fd.RISet, vals=vals, type="rank")
+ #barRank_img = BasicStatisticsFunctions.plotBarGraph(identification=fd.identification, group=fd.group, vals=vals, type="rank")
#barRank.append(HT.TR(HT.TD(barRank_img)))
#barRank_container.append(barRank)
#barRank_div.append(barRank_container)
@@ -1048,16 +1049,16 @@ class ShowTrait(templatePage):
def build_correlation_tools(self, fd, this_trait):
- #species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet)
+ #species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, group=fd.group)
- RISetgp = fd.RISet
+ this_group = fd.group
# We're checking a string here!
- assert isinstance(RISetgp, basestring), "We need a string type thing here"
- if RISetgp[:3] == 'BXD':
- RISetgp = 'BXD'
+ assert isinstance(this_group, basestring), "We need a string type thing here"
+ if this_group[:3] == 'BXD':
+ this_group = 'BXD'
- if RISetgp:
+ if this_group:
#sample_correlation = HT.Input(type='button',name='sample_corr', value=' Compute ', Class="button sample_corr")
#lit_correlation = HT.Input(type='button',name='lit_corr', value=' Compute ', Class="button lit_corr")
#tissue_correlation = HT.Input(type='button',name='tiss_corr', value=' Compute ', Class="button tiss_corr")
@@ -1074,7 +1075,7 @@ class ShowTrait(templatePage):
self.cursor.execute('''SELECT PublishFreeze.FullName,PublishFreeze.Name FROM
PublishFreeze,InbredSet WHERE PublishFreeze.InbredSetId = InbredSet.Id
and InbredSet.Name = %s and PublishFreeze.public > %s''',
- (RISetgp, webqtlConfig.PUBLICTHRESH))
+ (this_group, webqtlConfig.PUBLICTHRESH))
for item in self.cursor.fetchall():
dataset_menu.append(dict(tissue=None,
datasets=[item]))
@@ -1082,7 +1083,7 @@ class ShowTrait(templatePage):
self.cursor.execute('''SELECT GenoFreeze.FullName,GenoFreeze.Name FROM GenoFreeze,
InbredSet WHERE GenoFreeze.InbredSetId = InbredSet.Id and InbredSet.Name =
%s and GenoFreeze.public > %s''',
- (RISetgp, webqtlConfig.PUBLICTHRESH))
+ (this_group, webqtlConfig.PUBLICTHRESH))
for item in self.cursor.fetchall():
dataset_menu.append(dict(tissue=None,
datasets=[item]))
@@ -1098,7 +1099,7 @@ class ShowTrait(templatePage):
InbredSet WHERE ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and ProbeFreeze.TissueId = %s and
ProbeSetFreeze.public > %s and ProbeFreeze.InbredSetId = InbredSet.Id and InbredSet.Name like %s
order by ProbeSetFreeze.CreateTime desc, ProbeSetFreeze.AvgId ''',
- (tissue_id, webqtlConfig.PUBLICTHRESH, "%" + RISetgp + "%"))
+ (tissue_id, webqtlConfig.PUBLICTHRESH, "%" + this_group + "%"))
print("phun8")
dataset_sub_menu = [item for item in self.cursor.fetchall() if item]
#for item2 in self.cursor.fetchall():
@@ -1257,11 +1258,11 @@ class ShowTrait(templatePage):
def dispMappingTools(self, fd, title4Body, this_trait):
- _Species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet)
+ _Species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, group=fd.group)
- RISetgp = fd.RISet
- if RISetgp[:3] == 'BXD':
- RISetgp = 'BXD'
+ this_group = fd.group
+ if this_group[:3] == 'BXD':
+ this_group = 'BXD'
#check boxes - one for regular interval mapping, the other for composite
permCheck1= HT.Input(type='checkbox', Class='checkbox', name='permCheck1',checked="on")
@@ -1454,7 +1455,7 @@ class ShowTrait(templatePage):
# Treat Interval Mapping and Marker Regression and Pair Scan as a group for displaying
#disable Interval Mapping and Marker Regression and Pair Scan for human and the dataset doesn't have genotype file
- mappingMethodId = webqtlDatabaseFunction.getMappingMethod(cursor=self.cursor, groupName=RISetgp)
+ mappingMethodId = webqtlDatabaseFunction.getMappingMethod(cursor=self.cursor, groupName=this_group)
mapping_script = HT.Script(language="Javascript")
mapping_script_text = """$(function() { $("#mapping_tabs").tabs(); });"""
@@ -1526,7 +1527,7 @@ class ShowTrait(templatePage):
sample_names=primary_sample_names,
this_trait=this_trait,
sample_group_type='primary',
- header="%s Only" % (fd.RISet))
+ header="%s Only" % (fd.group))
other_sample_names = []
for sample in this_trait.data.keys():
@@ -1547,7 +1548,7 @@ class ShowTrait(templatePage):
sample_names=other_sample_names,
this_trait=this_trait,
sample_group_type='other',
- header="Non-%s" % (fd.RISet))
+ header="Non-%s" % (fd.group))
self.sample_groups = (primary_samples, other_samples)
else:
diff --git a/wqflask/wqflask/templates/index_page.html b/wqflask/wqflask/templates/index_page.html
index a113bc15..c01898b3 100644
--- a/wqflask/wqflask/templates/index_page.html
+++ b/wqflask/wqflask/templates/index_page.html
@@ -92,8 +92,8 @@
"btn" value="Advanced Search" onclick=
"javascript:window.open('/index3.html', '_self');">
- <input type="hidden" name="FormID" value="searchResult"> <input type=
- "hidden" name="RISet" value="BXD">
+ <input type="hidden" name="FormID" value="searchResult">
+ <!--!<input type="hidden" name="RISet" value="BXD">-->
</fieldset>
</form>
</section>
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index e393ced6..54cdd42b 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -23,7 +23,7 @@
{% if search_terms %}
<li>
{% for word in search_terms %}
- <strong>{{word.search_term}}</strong> {% if not loop.last %} or {% endif %}
+ <strong>{{word.search_term[0]}}</strong> {% if not loop.last %} or {% endif %}
{% endfor %}
</li>
{% endif %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 41d1d714..fb93af53 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -65,6 +65,9 @@ def search_page():
the_search = search_results.SearchResultPage(request.args)
print("template_vars is:", pf(the_search.__dict__))
#print("trait_list is:", pf(the_search.__dict__['trait_list'][0].__dict__))
+ #for trait in the_search.trait_list:
+ # print(" -", trait.description_display)
+
return render_template("search_result_page.html", **the_search.__dict__)