aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/base')
-rwxr-xr-xwqflask/base/data_set.py36
-rwxr-xr-xwqflask/base/trait.py4
-rwxr-xr-xwqflask/base/webqtlConfig.py4
3 files changed, 30 insertions, 14 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 58f08ae7..017c6052 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -436,7 +436,7 @@ class DataSet(object):
except TypeError:
print("Dataset {} is not yet available in GeneNetwork.".format(self.name))
pass
-
+
def get_trait_data(self):
self.samplelist = self.group.samplelist + self.group.parlist + self.group.f1list
query = """
@@ -470,11 +470,18 @@ class DataSet(object):
# method=method,
# returnNumber=returnNumber)
+ if self.type == "Publish":
+ dataset_type = "Phenotype"
+ else:
+ dataset_type = self.type
temp = ['T%s.value' % item for item in sample_ids_step]
- query = "SELECT {}.Name,".format(escape(self.type))
+ if self.type == "Publish":
+ query = "SELECT {}XRef.Id,".format(escape(self.type))
+ else:
+ query = "SELECT {}.Name,".format(escape(dataset_type))
data_start_pos = 1
query += string.join(temp, ', ')
- query += ' FROM ({}, {}XRef, {}Freeze) '.format(*mescape(self.type,
+ query += ' FROM ({}, {}XRef, {}Freeze) '.format(*mescape(dataset_type,
self.type,
self.type))
@@ -484,13 +491,22 @@ class DataSet(object):
and T{}.StrainId={}\n
""".format(*mescape(self.type, item, item, self.type, item, item))
- query += """
- WHERE {}XRef.{}FreezeId = {}Freeze.Id
- and {}Freeze.Name = '{}'
- and {}.Id = {}XRef.{}Id
- order by {}.Id
- """.format(*mescape(self.type, self.type, self.type, self.type,
- self.name, self.type, self.type, self.type, self.type))
+ if self.type == "Publish":
+ query += """
+ WHERE {}XRef.InbredSetId = {}Freeze.InbredSetId
+ and {}Freeze.Name = '{}'
+ and {}.Id = {}XRef.PhenotypeId
+ order by {}.Id
+ """.format(*mescape(self.type, self.type, self.type, self.name,
+ dataset_type, self.type, dataset_type ))
+ else:
+ query += """
+ WHERE {}XRef.{}FreezeId = {}Freeze.Id
+ and {}Freeze.Name = '{}'
+ and {}.Id = {}XRef.{}Id
+ order by {}.Id
+ """.format(*mescape(self.type, self.type, self.type, self.type,
+ self.name, dataset_type, self.type, self.type, dataset_type))
results = g.db.execute(query).fetchall()
trait_sample_data.append(results)
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index a1e6b0d3..c893c887 100755
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -322,7 +322,7 @@ class GeneralTrait(object):
#print(" mike: {} -> {} - {}".format(field, type(trait_info[i]), trait_info[i]))
holder = trait_info[i]
if isinstance(trait_info[i], basestring):
- holder = unicode(trait_info[i], "utf8")
+ holder = unicode(trait_info[i], "utf8", "ignore")
setattr(self, field, holder)
if self.dataset.type == 'Publish':
@@ -603,4 +603,4 @@ class GeneralTrait(object):
else:
ZValue = 0.5*log((1.0+self.correlation)/(1.0-self.correlation))
ZValue = ZValue*sqrt(self.overlap-3)
- self.p_value = 2.0*(1.0 - reaper.normp(abs(ZValue)))
+ self.p_value = 2.0*(1.0 - reaper.normp(abs(ZValue))) \ No newline at end of file
diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py
index 67a9c63f..23d32233 100755
--- a/wqflask/base/webqtlConfig.py
+++ b/wqflask/base/webqtlConfig.py
@@ -53,8 +53,8 @@ GNROOT = "/home/zas1024/gene/" # Will remove this and dependent items later
SECUREDIR = GNROOT + 'secure/'
COMMON_LIB = GNROOT + 'support/admin'
HTMLPATH = GNROOT + 'web/'
-PYLMM_PATH = '/home/zas1024/'
-SNP_PATH = '/mnt/xvdf1/snps/'
+PYLMM_PATH = '/home/zas1024/plink/'
+SNP_PATH = '/home/zas1024/snps/'
IMGDIR = HTMLPATH +'image/'
IMAGESPATH = HTMLPATH + 'images/'
UPLOADPATH = IMAGESPATH + 'upload/'