aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/data_set.py
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/base/data_set.py')
-rwxr-xr-xwqflask/base/data_set.py71
1 files changed, 59 insertions, 12 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 96e04df0..9fa7beb3 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -168,13 +168,13 @@ class Markers(object):
for marker, p_value in itertools.izip(self.markers, p_values):
marker['p_value'] = p_value
- if marker['p_value'] == 0:
- marker['lod_score'] = 0
- marker['lrs_value'] = 0
- else:
- marker['lod_score'] = -math.log10(marker['p_value'])
- #Using -log(p) for the LRS; need to ask Rob how he wants to get LRS from p-values
- marker['lrs_value'] = -math.log10(marker['p_value']) * 4.61
+ if math.isnan(marker['p_value']):
+ print("p_value is:", marker['p_value'])
+ marker['lod_score'] = -math.log10(marker['p_value'])
+ #Using -log(p) for the LRS; need to ask Rob how he wants to get LRS from p-values
+ marker['lrs_value'] = -math.log10(marker['p_value']) * 4.61
+
+
class HumanMarkers(Markers):
@@ -189,6 +189,8 @@ class HumanMarkers(Markers):
marker['name'] = splat[1]
marker['Mb'] = float(splat[3]) / 1000000
self.markers.append(marker)
+
+ #print("markers is: ", pf(self.markers))
def add_pvalues(self, p_values):
@@ -315,10 +317,10 @@ class DatasetGroup(object):
#determine default genotype object
if self.incparentsf1 and genotype_1.type != "intercross":
- genotype = genotype_2
+ self.genotype = genotype_2
else:
self.incparentsf1 = 0
- genotype = genotype_1
+ self.genotype = genotype_1
self.samplelist = list(genotype.prgy)
@@ -436,8 +438,13 @@ class DataSet(object):
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
+ def get_trait_data(self, sample_list=None):
+ if sample_list:
+ self.samplelist = sample_list + self.group.parlist + self.group.f1list
+ else:
+ self.samplelist = self.group.samplelist + self.group.parlist + self.group.f1list
+
+
query = """
SELECT Strain.Name, Strain.Id FROM Strain, Species
WHERE Strain.Name IN {}
@@ -1055,7 +1062,6 @@ class MrnaAssayDataSet(DataSet):
""" % (escape(self.name), escape(self.dataset.name))
results = g.db.execute(query).fetchone()
return results[0]
-
def retrieve_sample_data(self, trait):
query = """
@@ -1076,6 +1082,47 @@ class MrnaAssayDataSet(DataSet):
""" % (escape(trait), escape(self.name))
results = g.db.execute(query).fetchall()
return results
+
+
+ def retrieve_genes(self, column_name):
+ query = """
+ select ProbeSet.Name, ProbeSet.%s
+ from ProbeSet,ProbeSetXRef
+ where ProbeSetXRef.ProbeSetFreezeId = %s and
+ ProbeSetXRef.ProbeSetId=ProbeSet.Id;
+ """ % (column_name, escape(str(self.id)))
+ results = g.db.execute(query).fetchall()
+
+ return dict(results)
+
+ #def retrieve_gene_symbols(self):
+ # query = """
+ # select ProbeSet.Name, ProbeSet.Symbol, ProbeSet.GeneId
+ # from ProbeSet,ProbeSetXRef
+ # where ProbeSetXRef.ProbeSetFreezeId = %s and
+ # ProbeSetXRef.ProbeSetId=ProbeSet.Id;
+ # """ % (self.id)
+ # results = g.db.execute(query).fetchall()
+ # symbol_dict = {}
+ # for item in results:
+ # symbol_dict[item[0]] = item[1]
+ # return symbol_dict
+ #
+ #def retrieve_gene_ids(self):
+ # query = """
+ # select ProbeSet.Name, ProbeSet.GeneId
+ # from ProbeSet,ProbeSetXRef
+ # where ProbeSetXRef.ProbeSetFreezeId = %s and
+ # ProbeSetXRef.ProbeSetId=ProbeSet.Id;
+ # """ % (self.id)
+ # return process_and_run_query(query)
+ # results = g.db.execute(query).fetchall()
+ # symbol_dict = {}
+ # for item in results:
+ # symbol_dict[item[0]] = item[1]
+ # return symbol_dict
+
+
class TempDataSet(DataSet):