From b5aa5cb11c5f13daa7d416c37cc49f504921b037 Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Thu, 16 Jul 2015 20:00:10 +0000 Subject: Committer: Lei Yan On branch master --- wqflask/wqflask/gsearch.py | 31 ++++++- wqflask/wqflask/templates/gsearch.html | 63 ------------- wqflask/wqflask/templates/gsearch0.html | 48 ++++++++++ wqflask/wqflask/templates/gsearch1.html | 55 ++++++++++++ wqflask/wqflask/templates/gsearch2.html | 8 ++ wqflask/wqflask/templates/gsearchact.html | 137 ---------------------------- wqflask/wqflask/templates/gsearchact0.html | 139 +++++++++++++++++++++++++++++ wqflask/wqflask/templates/gsearchact1.html | 118 ++++++++++++++++++++++++ wqflask/wqflask/templates/gsearchact2.html | 51 ++++++++--- wqflask/wqflask/views.py | 23 +++-- 10 files changed, 450 insertions(+), 223 deletions(-) delete mode 100755 wqflask/wqflask/templates/gsearch.html create mode 100755 wqflask/wqflask/templates/gsearch0.html create mode 100755 wqflask/wqflask/templates/gsearch1.html delete mode 100755 wqflask/wqflask/templates/gsearchact.html create mode 100755 wqflask/wqflask/templates/gsearchact0.html create mode 100755 wqflask/wqflask/templates/gsearchact1.html diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 706a3655..4792f77b 100755 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -4,7 +4,6 @@ from flask import Flask, g class GSearch(object): - # http://gn2_lei.genenetwork.org/gsearch?species=mouse&group=BXD&search_terms=shh def __init__(self, kw): if 'species' in kw and 'group' in kw: self.species = kw['species'] @@ -81,3 +80,33 @@ class GSearch(object): LIMIT 1000 """ % (self.species_id, self.terms) self.results = g.db.execute(sql).fetchall() + else: + self.terms = kw['terms'] + sql = """ + SELECT + Species.`Name` AS species_name, + InbredSet.`Name` AS inbredset_name, + Tissue.`Name` AS tissue_name, + ProbeSetFreeze.FullName AS probesetfreeze_fullname, + ProbeSet.Name AS probeset_name, + ProbeSet.Symbol AS probeset_symbol, + ProbeSet.`description` AS probeset_description, + ProbeSet.Chr AS chr, + ProbeSet.Mb AS mb, + ProbeSetXRef.Mean AS mean, + ProbeSetXRef.LRS AS lrs, + ProbeSetXRef.`Locus` AS locus, + ProbeSetXRef.`pValue` AS pvalue, + ProbeSetXRef.`additive` AS additive + FROM Species, InbredSet, ProbeSetXRef, ProbeSet, ProbeFreeze, ProbeSetFreeze, Tissue + WHERE InbredSet.`SpeciesId`=Species.`Id` + AND ProbeFreeze.InbredSetId=InbredSet.`Id` + AND ProbeFreeze.`TissueId`=Tissue.`Id` + AND ProbeSetFreeze.ProbeFreezeId=ProbeFreeze.Id + AND ( MATCH (ProbeSet.Name,ProbeSet.description,ProbeSet.symbol,alias,GenbankId, UniGeneId, Probe_Target_Description) AGAINST ('%s' IN BOOLEAN MODE) ) + AND ProbeSet.Id = ProbeSetXRef.ProbeSetId + AND ProbeSetXRef.ProbeSetFreezeId=ProbeSetFreeze.Id + ORDER BY species_name, inbredset_name, tissue_name, probesetfreeze_fullname, probeset_name + LIMIT 1000 + """ % (self.terms) + self.results = g.db.execute(sql).fetchall() diff --git a/wqflask/wqflask/templates/gsearch.html b/wqflask/wqflask/templates/gsearch.html deleted file mode 100755 index 28301515..00000000 --- a/wqflask/wqflask/templates/gsearch.html +++ /dev/null @@ -1,63 +0,0 @@ -{% extends "base.html" %} -{% block title %}GeneNetwork{% endblock %} -{% block content %} - - -
- - {{ flash_me() }} - -
- -
- -
-
-
- -{%endblock%} - -{% block js %} - -{% endblock %} \ No newline at end of file diff --git a/wqflask/wqflask/templates/gsearch0.html b/wqflask/wqflask/templates/gsearch0.html new file mode 100755 index 00000000..45ab0d3b --- /dev/null +++ b/wqflask/wqflask/templates/gsearch0.html @@ -0,0 +1,48 @@ +{% extends "base.html" %} +{% block title %}GeneNetwork{% endblock %} +{% block content %} + + +
+ + {{ flash_me() }} + +
+ +
+ +
+
+
+ +{%endblock%} + +{% block js %} + +{% endblock %} \ No newline at end of file diff --git a/wqflask/wqflask/templates/gsearch1.html b/wqflask/wqflask/templates/gsearch1.html new file mode 100755 index 00000000..500e7f3d --- /dev/null +++ b/wqflask/wqflask/templates/gsearch1.html @@ -0,0 +1,55 @@ +{% extends "base.html" %} +{% block title %}GeneNetwork{% endblock %} +{% block content %} + + +
+ + {{ flash_me() }} + +
+ +
+ +
+
+
+ +{%endblock%} + +{% block js %} + +{% endblock %} \ No newline at end of file diff --git a/wqflask/wqflask/templates/gsearch2.html b/wqflask/wqflask/templates/gsearch2.html index 430bf889..9a6da575 100755 --- a/wqflask/wqflask/templates/gsearch2.html +++ b/wqflask/wqflask/templates/gsearch2.html @@ -25,6 +25,14 @@ +
+ +
+ + +
+
+
diff --git a/wqflask/wqflask/templates/gsearchact.html b/wqflask/wqflask/templates/gsearchact.html deleted file mode 100755 index 295ad2fd..00000000 --- a/wqflask/wqflask/templates/gsearchact.html +++ /dev/null @@ -1,137 +0,0 @@ -{% extends "base.html" %} -{% block title %}Search Results{% endblock %} -{% block css %} - - - -{% endblock %} -{% block content %} - - -
- -

To study a record, click on its ID below.
Check records below and click Add button to add to selection.

- -
-
- - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - {% for this_trait in results %} - - - - {% for item in this_trait[1:] %} - - {% endfor %} - - {% endfor %} - - -
IndexTissueDatasetRecordSymbolDescriptionChrMbMeanMax LRSLocusPvalueAdditive
{{ loop.index }}{{ item }}
-
-
- - - -{% endblock %} - -{% block js %} - - - - - - - - -{% endblock %} diff --git a/wqflask/wqflask/templates/gsearchact0.html b/wqflask/wqflask/templates/gsearchact0.html new file mode 100755 index 00000000..54e156e1 --- /dev/null +++ b/wqflask/wqflask/templates/gsearchact0.html @@ -0,0 +1,139 @@ +{% extends "base.html" %} +{% block title %}Search Results{% endblock %} +{% block css %} + + + +{% endblock %} +{% block content %} + + +
+ +

To study a record, click on its ID below.
Check records below and click Add button to add to selection.

+ +
+
+ + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + {% for this_trait in results %} + + + + {% for item in this_trait %} + + {% endfor %} + + {% endfor %} + + +
IndexSpeciesGroupTissueDatasetRecordSymbolDescriptionChrMbMeanMax LRSLocusPvalueAdditive
{{ loop.index }}{{ item }}
+
+
+ + + +{% endblock %} + +{% block js %} + + + + + + + + +{% endblock %} diff --git a/wqflask/wqflask/templates/gsearchact1.html b/wqflask/wqflask/templates/gsearchact1.html new file mode 100755 index 00000000..dcc82f91 --- /dev/null +++ b/wqflask/wqflask/templates/gsearchact1.html @@ -0,0 +1,118 @@ +{% extends "base.html" %} +{% block title %}Search Results{% endblock %} +{% block css %} + + + +{% endblock %} +{% block content %} + + +
+ +

To study a record, click on its ID below.
Check records below and click Add button to add to selection.

+ +
+
+ + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + {% for this_trait in results %} + + + + {% for item in this_trait[1:] %} + + {% endfor %} + + {% endfor %} + + +
IndexGroupTissueDatasetRecordSymbolDescriptionChrMbMeanMax LRSLocusPvalueAdditive
{{ loop.index }}{{ item }}
+
+
+ + + +{% endblock %} + +{% block js %} + + + + + + + + +{% endblock %} diff --git a/wqflask/wqflask/templates/gsearchact2.html b/wqflask/wqflask/templates/gsearchact2.html index d99bfadc..295ad2fd 100755 --- a/wqflask/wqflask/templates/gsearchact2.html +++ b/wqflask/wqflask/templates/gsearchact2.html @@ -21,10 +21,11 @@

- +
- + + @@ -43,6 +44,8 @@ {% for this_trait in results %} + + {% for item in this_trait[1:] %} {% endfor %} @@ -65,7 +68,7 @@ -
GroupIndex Tissue Dataset Record
{{ loop.index }}{{ item }}