about summary refs log tree commit diff
path: root/wqflask
diff options
context:
space:
mode:
authorLei Yan2015-08-06 18:44:34 +0000
committerLei Yan2015-08-06 18:44:34 +0000
commitbb6a7d24e00a0449899ebae719f346072136be1d (patch)
treea684e17ef50cd8ca51c20a06b0b7e5e31f194c7e /wqflask
parent7bb0af72804d8112f41927e8184247c7447b1780 (diff)
downloadgenenetwork2-bb6a7d24e00a0449899ebae719f346072136be1d.tar.gz
Committer: Lei Yan <lei@penguin.uthsc.edu>
On branch master
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/wqflask/gsearch.py18
-rwxr-xr-xwqflask/wqflask/templates/gsearch_gene.html62
2 files changed, 46 insertions, 34 deletions
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 396da4cf..7e647b76 100755
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -16,7 +16,7 @@ class GSearch(object):
 				Species.`Name` AS species_name,
 				InbredSet.`Name` AS inbredset_name,
 				Tissue.`Name` AS tissue_name,
-				ProbeSetFreeze.FullName AS probesetfreeze_fullname,
+				ProbeSetFreeze.Name AS probesetfreeze_name,
 				ProbeSet.Name AS probeset_name,
 				ProbeSet.Symbol AS probeset_symbol,
 				ProbeSet.`description` AS probeset_description,
@@ -35,10 +35,21 @@ class GSearch(object):
 				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
+				AND ProbeSetFreeze.public > 0
+				ORDER BY species_name, inbredset_name, tissue_name, probesetfreeze_name, probeset_name
 				LIMIT 1000
 				""" % (self.terms)
-			self.results = g.db.execute(sql).fetchall()
+			re = g.db.execute(sql).fetchall()
+			self.trait_list = []
+			for line in re:
+				dataset = create_dataset(line[3], "ProbeSet")
+				print("dataset: %s %s %s" % (line[3], dataset.name, dataset.id))
+				trait_id = line[4]
+				this_trait = GeneralTrait(dataset=dataset, name=trait_id, get_qtl_info=True)
+				self.trait_list.append(this_trait)
+				species = webqtlDatabaseFunction.retrieve_species(dataset.group.name)
+				dataset.get_trait_info([this_trait], species)
+
 		elif self.type == "phenotype":
 			sql = """
 				SELECT
@@ -80,4 +91,3 @@ class GSearch(object):
 				self.trait_list.append(this_trait)
 				species = webqtlDatabaseFunction.retrieve_species(dataset.group.name)
 				dataset.get_trait_info([this_trait], species)
-
diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html
index 3e1cb32e..6cf16c08 100755
--- a/wqflask/wqflask/templates/gsearch_gene.html
+++ b/wqflask/wqflask/templates/gsearch_gene.html
@@ -24,37 +24,44 @@
             <br />
             <br />
             <table class="table table-hover table-striped" id="trait_table">
-                <thead>
-                    <tr>
+				<thead>
+					<tr>
+						<th style="width: 30px;"></th>
 						<th>Index</th>
-						<th>Symbol</th>
-						<th>Record</th>
-						<th>Description</th>
 						<th>Species</th>
 						<th>Group</th>
 						<th>Tissue</th>
 						<th>Dataset</th>
-						<th>Chr</th>
-						<th>Mb</th>
+						<th>Record</th>
+						<th>Symbol</th>
+						<th>Description</th>
+						<th>Location</th>
 						<th>Mean</th>
-						<th>Max LRS</th>
-						<th>Locus</th>
-						<th>Pvalue</th>
-						<th>Additive</th>
-                    </tr>
-                </thead>
-
+						<th style="text-align: right;">Max&nbsp;&nbsp;<br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
+						<th>Max LRS Location</th>
+						<th style="text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
+					</tr>
+				</thead>
                 <tbody>
-                    {% for this_trait in results %}
-                    <TR>
-						<td><input type="checkbox">{{ loop.index }}</td>
-                        {% for item in this_trait %}
-							<TD>{{ item }}</TD>
-						{% endfor %}
-                    </TR>
-                {% endfor %}
+				{% for this_trait in trait_list %}
+					<TR id="trait:{{ this_trait.name }}:{{ this_trait.dataset.name }}">
+						<TD><INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"></TD>
+						<TD>{{ loop.index }}</TD>
+						<TD>{{ this_trait.dataset.group.species }}</TD>
+						<TD>{{ this_trait.dataset.group.name }}</TD>
+						<TD>{{ this_trait.dataset.name }}</TD>
+						<TD>{{ this_trait.dataset.name }}</TD>
+						<TD><a href="{{ url_for('show_trait_page', trait_id = this_trait.name, dataset = this_trait.dataset.name)}}">{{ this_trait.name }}</a></TD>
+						<TD>{{ this_trait.symbol }}</TD>
+						<TD>{{ this_trait.description_display }}</TD>
+						<TD>{{ this_trait.location_repr }}</TD>
+						<TD align="right">{{ '%0.3f' % this_trait.mean|float }}</TD>
+						<TD align="right">{{ '%0.3f' % this_trait.LRS_score_repr|float }}</TD>
+						<TD>{{ this_trait.LRS_location_repr }}</TD>
+						<TD align="right">{{ '%0.3f' % this_trait.additive|float }}</TD>
+					</TR>
+				{% endfor %}
                 </tbody>
-
             </table>
         </div>
     </div>
@@ -123,7 +130,7 @@
             console.time("Creating table");
             $('#trait_table').DataTable( {
                 "columns": [
-                    { "type": "natural" },
+                    { "bSortClasses": false },
                     { "type": "natural" },
                     { "type": "natural", "width": "35%"  },
                     { "type": "natural", "width": "15%"  },
@@ -136,16 +143,11 @@
                     { "type": "natural", "width": "15%"  },
 					{ "type": "natural" },
 					{ "type": "natural" },
-					{ "type": "natural" },
-                    { "type": "cust-txt" }
+					{ "type": "natural" }
                 ],
-				"sDom": "RJtir",
-                "iDisplayLength": -1,
                 "autoWidth": true,
                 "bLengthChange": true,
                 "bDeferRender": true,
-                "bSortClasses": false,
-                "scrollY": "700px",
                 "scrollCollapse": false,
                 "colResize": {
                     "tableWidthFixed": false,