aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask/templates
diff options
context:
space:
mode:
authorAlexander Kabui2020-12-04 21:41:28 +0300
committerAlexander Kabui2020-12-04 21:41:28 +0300
commitf67f0f0d8f62f8bb6f8b708886c6ec2252450aeb (patch)
treead01d1e1f2e118ddb263d325a8b64b43064366d6 /wqflask/wqflask/templates
parent9b7c09e14576a39c3f986e5b6e633b0380a72095 (diff)
parent8084309bdfa46e29d3cc941911fa25b23f8400d5 (diff)
downloadgenenetwork2-f67f0f0d8f62f8bb6f8b708886c6ec2252450aeb.tar.gz
Merge branch 'testing' of https://github.com/genenetwork/genenetwork2 into bugfix/markdown-links-fix
Diffstat (limited to 'wqflask/wqflask/templates')
-rw-r--r--wqflask/wqflask/templates/collections/view.html33
-rw-r--r--wqflask/wqflask/templates/correlation_page.html54
-rw-r--r--wqflask/wqflask/templates/environment.html152
-rw-r--r--wqflask/wqflask/templates/search_result_page.html46
4 files changed, 178 insertions, 107 deletions
diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html
index e37f8104..ccec495b 100644
--- a/wqflask/wqflask/templates/collections/view.html
+++ b/wqflask/wqflask/templates/collections/view.html
@@ -73,7 +73,7 @@
<form id="export_form" method="POST" action="/export_traits_csv">
<button class="btn btn-default" id="select_all" type="button"><span class="glyphicon glyphicon-ok"></span> Select All</button>
<button class="btn btn-default" id="invert" type="button"><span class="glyphicon glyphicon-ok"></span> Invert</button>
- <button class="btn btn-success" id="add" disabled="disabled" type="button"><i class="icon-plus-sign"></i> Copy</button>
+ <button class="btn btn-success" id="add" type="button" disabled><i class="icon-plus-sign"></i> Copy</button>
<input type="hidden" name="database_name" id="database_name" value="None">
<input type="hidden" name="export_data" id="export_data" value="">
<input type="hidden" name="file_name" id="file_name" value="collection_table">
@@ -81,7 +81,7 @@
<input type="text" id="searchbox" class="form-control" style="width: 200px; display: inline; padding-bottom: 9px;" placeholder="Search Table For ...">
<input type="text" id="select_top" class="form-control" style="width: 200px; display: inline; padding-bottom: 9px;" placeholder="Select Top ...">
<button class="btn btn-default" id="deselect_all" type="button"><span class="glyphicon glyphicon-remove"></span> Deselect</button>
- <button id="remove" class="btn btn-danger" data-url="/collections/remove" disabled="disabled" type="button"><i class="icon-minus-sign"></i> Delete Rows</button>
+ <button id="remove" class="btn btn-danger" data-url="/collections/remove" type="button" disabled><i class="icon-minus-sign"></i> Delete Rows</button>
<button id="delete" class="btn btn-danger submit_special" data-url="/collections/delete" title="Delete this collection" > Delete Collection</button>
</form>
</div>
@@ -109,10 +109,7 @@
<tbody>
{% for this_trait in trait_obs %}
<TR id="trait:{{ this_trait.name }}:{{ this_trait.dataset.name }}">
- <TD align="center" style="padding: 0px;">
- <INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox"
- VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}">
- </TD>
+ <TD align="center" style="padding: 0px;"><INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"></TD>
<TD data-export="{{ loop.index }}" align="right">{{ loop.index }}</TD>
<TD title="{{ this_trait.dataset.fullname }}" data-export="{{ this_trait.dataset.fullname }}">{{ this_trait.dataset.fullname }}</TD>
<TD data-export="{{ this_trait.name }}">
@@ -178,15 +175,21 @@
<script language="javascript" type="text/javascript">
$(document).ready( function () {
-
- $('#trait_table tr').click(function(event) {
- if (event.target.type !== 'checkbox') {
- $(':checkbox', this).trigger('click');
- }
- });
-
- console.time("Creating table");
$('#trait_table').dataTable( {
+ 'drawCallback': function( settings ) {
+ $('#trait_table tr').off().on("click", function(event) {
+ if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') {
+ var obj =$(this).find('input');
+ obj.prop('checked', !obj.is(':checked'));
+ }
+ if ($(this).hasClass("selected")){
+ $(this).removeClass("selected")
+ } else {
+ $(this).addClass("selected")
+ }
+ change_buttons()
+ });
+ },
"columns": [
{
"orderDataType": "dom-checkbox",
@@ -220,7 +223,7 @@
"paging": false,
"orderClasses": true
} );
- console.timeEnd("Creating table");
+
submit_special = function(url) {
$("#collection_form").attr("action", url);
diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html
index 6419b185..aa74abf5 100644
--- a/wqflask/wqflask/templates/correlation_page.html
+++ b/wqflask/wqflask/templates/correlation_page.html
@@ -75,6 +75,7 @@
<div>
<form id="export_form" method="POST" action="/export_traits_csv">
<button class="btn btn-default" id="select_all" type="button"><span class="glyphicon glyphicon-ok"></span> Select All</button>
+ <button class="btn btn-default" id="invert" type="button"><span class="glyphicon glyphicon-adjust"></span> Invert</button>
<button class="btn btn-success" id="add" type="button" disabled><span class="glyphicon glyphicon-plus-sign"></span> Add</button>
<input type="hidden" name="database_name" id="database_name" value="None">
<input type="hidden" name="export_data" id="export_data" value="">
@@ -256,41 +257,6 @@
{% endif %}
$(document).ready( function () {
-
- $('#trait_table tr').click(function(event) {
- if (event.target.type !== 'checkbox') {
- $(':checkbox', this).trigger('click');
- }
- });
-
- function change_buttons() {
- buttons = ["#add", "#remove"];
- num_checked = $('.trait_checkbox:checked').length;
- if (num_checked === 0) {
- for (_i = 0, _len = buttons.length; _i < _len; _i++) {
- button = buttons[_i];
- $(button).prop("disabled", true);
- }
- } else {
- for (_j = 0, _len2 = buttons.length; _j < _len2; _j++) {
- button = buttons[_j];
- $(button).prop("disabled", false);
- }
- }
- if ($(this).is(":checked")) {
- if (!$(this).closest('tr').hasClass('selected')) {
- $(this).closest('tr').addClass('selected')
- }
- }
- else {
- if ($(this).closest('tr').hasClass('selected')) {
- $(this).closest('tr').removeClass('selected')
- }
- }
- }
-
- console.time("Creating table");
-
table_conf = {
buttons: [
{
@@ -305,6 +271,20 @@
postfixButtons: [ 'colvisRestore' ]
}
],
+ 'drawCallback': function( settings ) {
+ $('#trait_table tr').off().on("click", function(event) {
+ if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') {
+ var obj =$(this).find('input');
+ obj.prop('checked', !obj.is(':checked'));
+ }
+ if ($(this).hasClass("selected")){
+ $(this).removeClass("selected")
+ } else {
+ $(this).addClass("selected")
+ }
+ });
+ $('.trait_checkbox:checkbox').on("change", change_buttons);
+ },
"data": table_json,
"columns": [
{
@@ -557,7 +537,7 @@
"sDom": "itir",
"autoWidth": true,
"bSortClasses": false,
- "scrollY": "50vh",
+ "scrollY": "100vh",
"scroller": true,
"scrollCollapse": true
}
@@ -570,8 +550,6 @@
} );
} ).draw();
- console.timeEnd("Creating table");
-
$('.toggle-vis').on('click', function (e) {
e.preventDefault();
diff --git a/wqflask/wqflask/templates/environment.html b/wqflask/wqflask/templates/environment.html
index 94b31464..5fe01dad 100644
--- a/wqflask/wqflask/templates/environment.html
+++ b/wqflask/wqflask/templates/environment.html
@@ -8,33 +8,143 @@
{% block content %}
- <div class="github-btn-container">
- <div class="github-btn ">
- <a href="https://github.com/genenetwork/gn-docs">
- Edit Text
- <img src="/static/images/edit.png">
- </a>
- </div>
-</div>
<div id="markdown" class="container">
<div class="cls-table-style">{{ rendered_markdown|safe }} </div>
</div>
-<style type="text/css">
-table {
- width: 100%;
-}
-table, th, td {
- border: 1px solid black;
+{% if svg_data %}
+
+<div class="graph-legend">
+ <h1>Chord dependency Graph of Genenetwork2</h1>
+ Graph generated from <a href="http://git.genenetwork.org/guix-bioinformatics/guix-bioinformatics/src/branch/master/gn/packages/genenetwork.scm">genenetwork.scm</a>. You can zoom in and out within the bounding box.
+</div>
+
+<div id="guix-graph"></div>
+{% endif %}
+
+{% endblock %}
+
+{% block js %}
+
+{% if svg_data %}
+<script language="javascript" type="text/javascript" src="{{ url_for('js', filename='d3js/d3.min.js') }}"></script>
+<script type="text/javascript">
+ {{ svg_data|safe }}
+ // based on http://bl.ocks.org/mbostock/1046712 under GPLv3
+ // Adapted from: https://elephly.net/graph.html
+ var outerRadius = (nodeArray.length * 10) / 2,
+ innerRadius = outerRadius - 100,
+ width = outerRadius * 2,
+ height = outerRadius * 2,
+ colors = d3.scale.category20c(),
+ matrix = [];
+
+ function neighborsOf (node) {
+ return links.filter(function (e) {
+ return e.source === node;
+ }).map(function (e) {
+ return e.target;
+ });
+ }
+
+ function zoomed () {
+ zoomer.attr("transform",
+ "translate(" + d3.event.translate + ")" +
+ "scale(" + d3.event.scale + ")");
+ }
+
+ function fade (opacity, root) {
+ return function (g, i) {
+ root.selectAll("g path.chord")
+ .filter(function (d) {
+ return d.source.index != i && d.target.index != i;
+ })
+ .transition()
+ .style("opacity", opacity);
+ };
+ }
+
+ // Now that we have all nodes in an object we can replace each reference
+ // with the actual node object.
+ links.forEach(function (link) {
+ link.target = nodes[link.target];
+ link.source = nodes[link.source];
+ });
+
+ // Construct a square matrix for package dependencies
+ nodeArray.forEach(function (d, index, arr) {
+ var source = index,
+ row = matrix[source];
+ if (!row) {
+ row = matrix[source] = [];
+ for (var i = -1; ++i < arr.length;) row[i] = 0;
+ }
+ neighborsOf(d).forEach(function (d) { row[d.index]++; });
+ });
+
+ // chord layout
+ var chord = d3.layout.chord()
+ .padding(0.01)
+ .sortSubgroups(d3.descending)
+ .sortChords(d3.descending)
+ .matrix(matrix);
+
+ var arc = d3.svg.arc()
+ .innerRadius(innerRadius)
+ .outerRadius(innerRadius + 20);
+
+ var zoom = d3.behavior.zoom()
+ .scaleExtent([0.1, 10])
+ .on("zoom", zoomed);
+
+ var svg = d3.select("#guix-graph").append("svg")
+ .attr("width", "100%")
+ .attr("height", "100%")
+ .attr('viewBox','0 0 '+Math.min(width,height)+' '+Math.min(width,height))
+ .attr('preserveAspectRatio','xMinYMin')
+ .call(zoom);
+
+ var zoomer = svg.append("g");
+
+ var container = zoomer.append("g")
+ .attr("transform", "translate(" + outerRadius + "," + outerRadius + ")");
+
+ // Group for arcs and labels
+ var g = container.selectAll(".group")
+ .data(chord.groups)
+ .enter().append("g")
+ .attr("class", "group")
+ .on("mouseout", fade(1, container))
+ .on("mouseover", fade(0.1, container));
+
+ // Draw one segment per package
+ g.append("path")
+ .style("fill", function (d) { return colors(d.index); })
+ .style("stroke", function (d) { return colors(d.index); })
+ .attr("d", arc);
-}
+ // Add circular labels
+ g.append("text")
+ .each(function (d) { d.angle = (d.startAngle + d.endAngle) / 2; })
+ .attr("dy", ".35em")
+ .attr("transform", function (d) {
+ return "rotate(" + (d.angle * 180 / Math.PI - 90) + ")"
+ + "translate(" + (innerRadius + 26) + ")"
+ + (d.angle > Math.PI ? "rotate(180)" : "");
+ })
+ .style("text-anchor", function (d) { return d.angle > Math.PI ? "end" : null; })
+ .text(function (d) { return nodeArray[d.index].label; });
-td,th{
- padding-top:8px;
- padding-bottom: 8px;
- text-align: center;
-}
+ // Draw chords from source to target; color by source.
+ container.selectAll(".chord")
+ .data(chord.chords)
+ .enter().append("path")
+ .attr("class", "chord")
+ .style("stroke", function (d) { return d3.rgb(colors(d.source.index)).darker(); })
+ .style("fill", function (d) { return colors(d.source.index); })
+ .attr("d", d3.svg.chord().radius(innerRadius));
+</script>
+{% endif %}
-</style>
{% endblock %}
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index 2a8d6931..87c97c50 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -129,6 +129,7 @@
{% endif %}
<input type="hidden" name="export_data" id="export_data" value="">
<button class="btn btn-default" id="select_all" type="button"><span class="glyphicon glyphicon-ok"></span> Select</button>
+ <button class="btn btn-default" id="invert" type="button"><span class="glyphicon glyphicon-adjust"></span> Invert</button>
<button class="btn btn-success" id="add" type="button" disabled><span class="glyphicon glyphicon-plus-sign"></span> Add</button>
<button class="btn btn-default" id="export_traits">Download <span class="glyphicon glyphicon-download"></span></button>
<input type="text" id="searchbox" class="form-control" style="width: 200px; display: inline;" placeholder="Search This Table For ...">
@@ -203,42 +204,21 @@
}
});
- function change_buttons() {
- buttons = ["#add", "#remove"];
- num_checked = $('.trait_checkbox:checked').length;
- if (num_checked === 0) {
- for (_i = 0, _len = buttons.length; _i < _len; _i++) {
- button = buttons[_i];
- $(button).prop("disabled", true);
- }
- } else {
- for (_j = 0, _len2 = buttons.length; _j < _len2; _j++) {
- button = buttons[_j];
- $(button).prop("disabled", false);
- }
- }
- //});
- if ($(this).is(":checked")) {
- if (!$(this).closest('tr').hasClass('selected')) {
- $(this).closest('tr').addClass('selected')
- }
- }
- else {
- if ($(this).closest('tr').hasClass('selected')) {
- $(this).closest('tr').removeClass('selected')
- }
- }
- }
-
//ZS: Need to make sort by symbol, also need to make sure blank symbol fields at the bottom and symbols starting with numbers below letters
trait_table = $('#trait_table').DataTable( {
'drawCallback': function( settings ) {
- $('#trait_table tr').click(function(event) {
- if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') {
- $(':checkbox', this).trigger('click');
- }
- });
- $('.trait_checkbox:checkbox').on("change", change_buttons);
+ $('#trait_table tr').off().on("click", function(event) {
+ if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') {
+ var obj =$(this).find('input');
+ obj.prop('checked', !obj.is(':checked'));
+ }
+ if ($(this).hasClass("selected")){
+ $(this).removeClass("selected")
+ } else {
+ $(this).addClass("selected")
+ }
+ change_buttons()
+ });
},
'createdRow': function ( row, data, index ) {
$('td', row).eq(0).attr("style", "text-align: center; padding: 0px 10px 2px 10px;");