aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2021-05-10 08:24:42 +0300
committerAlexander Kabui2021-05-10 08:24:42 +0300
commit27538980f93c1d72b0b2d76151312f3fbce4c9a5 (patch)
tree39ca6113713f93ea4ec345d3bd19ee2c5a479258
parent049a438741d19b1cf6c8c290ec01343b51690b30 (diff)
downloadgenenetwork2-27538980f93c1d72b0b2d76151312f3fbce4c9a5.tar.gz
add previous endpoint for correlation
-rw-r--r--wqflask/base/data_set.py37
-rw-r--r--wqflask/wqflask/views.py13
2 files changed, 8 insertions, 42 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 468c4da0..d0f5e6f2 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -655,42 +655,7 @@ class DataSet(object):
"Dataset {} is not yet available in GeneNetwork.".format(self.name))
pass
- def fetch_probe_trait_data(self, sample_list=None):
- if sample_list:
- self.samplelist = sample_list
- else:
- self.samplelist = self.group.samplelist
-
- if self.group.parlist != None and self.group.f1list != None:
- if (self.group.parlist + self.group.f1list) in self.samplelist:
- self.samplelist += self.group.parlist + self.group.f1list
-
- query = """
- SELECT Strain.Name, Strain.Id FROM Strain, Species
- WHERE Strain.Name IN {}
- and Strain.SpeciesId=Species.Id
- and Species.name = '{}'
- """.format(create_in_clause(self.samplelist), *mescape(self.group.species))
- logger.sql(query)
- results = dict(g.db.execute(query).fetchall())
- sample_ids = [results[item] for item in self.samplelist]
-
- query = """SELECT * from ProbeSetData WHERE Id in ( SELECT ProbeSetXRef.DataId FROM (ProbeSet, ProbeSetXRef, ProbeSetFreeze) WHERE ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id and ProbeSetFreeze.Name = 'HC_M2_0606_P' and ProbeSet.Id = ProbeSetXRef.ProbeSetId order by ProbeSet.Id ) and StrainId in ({})""".format(
- ",".join(str(sample_id) for sample_id in sample_ids))
- results = g.db.execute(query).fetchall()
-
- # with conn:
- # cursor = conn.cursor()
- # cursor.execute(query)
- # results = cursor.fetchall()
- trait_data = {}
- for trait_id, StrainId, value in results:
- if trait_id in trait_data:
- trait_data[trait_id].append(value)
- else:
- trait_data[trait_id] = [value]
- self.trait_data = trait_data
def get_trait_data(self, sample_list=None):
if sample_list:
@@ -711,7 +676,6 @@ class DataSet(object):
logger.sql(query)
results = dict(g.db.execute(query).fetchall())
sample_ids = [results[item] for item in self.samplelist]
- print("the number of sample ids are", len(sample_ids))
# MySQL limits the number of tables that can be used in a join to 61,
# so we break the sample ids into smaller chunks
@@ -762,7 +726,6 @@ class DataSet(object):
trait_sample_data.append(results)
trait_count = len(trait_sample_data[0])
- print("the trait count is >>>", trait_count)
self.trait_data = collections.defaultdict(list)
# put all of the separate data together into a dictionary where the keys are
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index b042a211..19779651 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -881,11 +881,14 @@ def network_graph_page():
def corr_compute_page():
logger.info("In corr_compute, request.form is:", pf(request.form))
logger.info(request.url)
- import time
- initial_time = time.time()
- correlation_results = compute_correlation(request.form)
- print(">>>>Time taken by this endpoint",time.time()-initial_time)
- return render_template("test_correlation_page.html",correlation_results=correlation_results)
+ template_vars = show_corr_results.CorrelationResults(request.form)
+ return render_template("correlation_page.html", **template_vars.__dict__)
+
+ # to test the new correlation api uncomment these lines
+
+ # correlation_results = compute_correlation(request.form)
+ # print(">>>>Time taken by this endpoint",time.time()-initial_time)
+ # return render_template("test_correlation_page.html",correlation_results=correlation_results)
@app.route("/corr_matrix", methods=('POST',))
def corr_matrix_page():